diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/platform/ThreadGlobalData.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/platform/ThreadGlobalData.cpp')
-rw-r--r-- | WebCore/platform/ThreadGlobalData.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/WebCore/platform/ThreadGlobalData.cpp b/WebCore/platform/ThreadGlobalData.cpp index 5c3c294..434ee5a 100644 --- a/WebCore/platform/ThreadGlobalData.cpp +++ b/WebCore/platform/ThreadGlobalData.cpp @@ -31,6 +31,7 @@ #include "StringImpl.h" #include "ThreadTimers.h" #include <wtf/UnusedParam.h> +#include <wtf/WTFThreadData.h> #if USE(ICU_UNICODE) #include "TextCodecICU.h" @@ -55,9 +56,7 @@ ThreadGlobalData* ThreadGlobalData::staticData; #endif ThreadGlobalData::ThreadGlobalData() - : m_emptyString(new StringImpl) - , m_atomicStringTable(new HashSet<StringImpl*>) - , m_eventNames(new EventNames) + : m_eventNames(new EventNames) , m_threadTimers(new ThreadTimers) #ifndef NDEBUG , m_isMainThread(isMainThread()) @@ -69,6 +68,12 @@ ThreadGlobalData::ThreadGlobalData() , m_cachedConverterTEC(new TECConverterWrapper) #endif { + // This constructor will have been called on the main thread before being called on + // any other thread, and is only called once per thread – this makes this a convenient + // point to call methods that internally perform a one-time initialization that is not + // threadsafe. + wtfThreadData(); + StringImpl::empty(); } ThreadGlobalData::~ThreadGlobalData() @@ -80,16 +85,7 @@ ThreadGlobalData::~ThreadGlobalData() delete m_cachedConverterICU; #endif delete m_eventNames; - delete m_atomicStringTable; delete m_threadTimers; - - // Using member variable m_isMainThread instead of calling WTF::isMainThread() directly - // to avoid issues described in https://bugs.webkit.org/show_bug.cgi?id=25973. - // In short, some pthread-based platforms and ports can not use WTF::CurrentThread() and WTF::isMainThread() - // in destructors of thread-specific data. - ASSERT(m_isMainThread || m_emptyString->hasOneRef()); // We intentionally don't clean up static data on application quit, so there will be many strings remaining on the main thread. - - delete m_emptyString; } } // namespace WebCore |