Bug 33878 - Add ThreadSpecific for for ENABLE(SINGLE_THREADED)
Summary: Add ThreadSpecific for for ENABLE(SINGLE_THREADED)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-19 20:08 PST by Kwang Yul Seo
Modified: 2010-01-21 23:36 PST (History)
3 users (show)

See Also:


Attachments
Implement ThreadSpecific with a simple getter/setter for ENABLE(SINGLE_THREADED) (2.42 KB, patch)
2010-01-19 20:16 PST, Kwang Yul Seo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kwang Yul Seo 2010-01-19 20:08:56 PST
When ENABLE(SINGLE_THREADED) is true, ThreadSpecific can be replaced with a simple getter/setter. 

Due to the change in https://bugs.webkit.org/show_bug.cgi?id=33236, an implementation of ThreadSpecific must be available to build WebKit. This causes a build failure for platforms without a proper ThreadSpecific implementation.
Comment 1 Kwang Yul Seo 2010-01-19 20:16:23 PST
Created attachment 46971 [details]
Implement ThreadSpecific with a simple getter/setter for ENABLE(SINGLE_THREADED)
Comment 2 Eric Seidel (no email) 2010-01-21 16:51:26 PST
I think Alexey is your best reviewer here.
Comment 3 Alexey Proskuryakov 2010-01-21 17:00:57 PST
The implementation looks fine, but I don't understand what ENABLE(SINGLE_THREADED) means. Is it about thread use in WebCore? If so, why do JSC-only changes made in bug 33236 make this patch necessary?
Comment 4 Kwang Yul Seo 2010-01-21 20:31:20 PST
ENABLE(SINGLE_THREADED) is used mainly by Qt port and it means both JavaScriptCore and WebCore are single-threaded. As ThreadSpecific can be used by both JavaScriptCore and WebCore, checking only ENABLE(JSC_MULTIPLE_THREADS) is not correct here.


Before 33236 is landed, ThreadSpecific was not used at all when some multi-threaded WebCore features such as database and workers are disabled. However, as the following code is added in 33236,  an implementation of ThreadSpecific is required even for single-threaded WebKit build.


#if ENABLE(JSC_MULTIPLE_THREADS)

pthread_once_t createIdentifierTableSpecificOnce = PTHREAD_ONCE_INIT;
static void createIdentifierTableSpecificCallback()
{
    ASSERT(!g_identifierTableSpecific);
    g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
}
void createIdentifierTableSpecific()
{
    pthread_once(&createIdentifierTableSpecificOnce, createIdentifierTableSpecificCallback);
    ASSERT(g_identifierTableSpecific);
}

#else

void createIdentifierTableSpecific()
{
    ASSERT(!g_identifierTableSpecific);
    g_identifierTableSpecific = new ThreadSpecific<ThreadIdentifierTableData>();
}

#endif
Comment 5 Alexey Proskuryakov 2010-01-21 21:01:22 PST
Comment on attachment 46971 [details]
Implement ThreadSpecific with a simple getter/setter for ENABLE(SINGLE_THREADED)

ok, r=me
Comment 6 WebKit Commit Bot 2010-01-21 23:36:35 PST
Comment on attachment 46971 [details]
Implement ThreadSpecific with a simple getter/setter for ENABLE(SINGLE_THREADED)

Clearing flags on attachment: 46971

Committed r53682: <http://trac.webkit.org/changeset/53682>
Comment 7 WebKit Commit Bot 2010-01-21 23:36:42 PST
All reviewed patches have been landed.  Closing bug.