Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: third_party/WebKit/Source/wtf/ThreadingPthreads.cpp

Issue 2623273007: Fast path for ThreadSpecific for main thread on TLS-slow platforms (Closed)
Patch Set: [WIP] Fast path for currentThread() for main thread on TLS-slow platforms Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
diff --git a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
index ad9b520ac9f44add1284c67ea911ffe9aed00030..5cb42578f75b6390e9e352239a15bffeb2f91edc 100644
--- a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
+++ b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
@@ -80,13 +80,13 @@ static Mutex* atomicallyInitializedStaticMutex;
void initializeThreading() {
// This should only be called once.
DCHECK(!atomicallyInitializedStaticMutex);
+ WTFThreadData::initialize();
// StringImpl::empty() does not construct its static string in a threadsafe
// fashion, so ensure it has been initialized from here.
StringImpl::empty();
StringImpl::empty16Bit();
atomicallyInitializedStaticMutex = new Mutex;
- wtfThreadData();
initializeDates();
// Force initialization of static DoubleToStringConverter converter variable
// inside EcmaScriptConverter function while we are in single thread mode.
@@ -103,15 +103,7 @@ void unlockAtomicallyInitializedStaticMutex() {
}
ThreadIdentifier currentThread() {
-// TLS lookup is fast on these platforms.
-#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
- return wtfThreadData().threadId();
-#else
- // TODO(csharrison): For platforms where TLS lookup is slow, use the hack that
- // oilpan uses in ThreadState::current() to check if this is the main thread
- // via stack address.
- return internal::currentThreadSyscall();
-#endif
+ return WTFThreadData::current().threadId();
}
MutexBase::MutexBase(bool recursive) {

Powered by Google App Engine
This is Rietveld 408576698