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

Unified Diff: third_party/WebKit/Source/wtf/WTFThreadData.h

Issue 2646003003: Avoid checking for WTFThreadData::staticData in wtfThreadData() (Closed)
Patch Set: fix bad rebase 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
« no previous file with comments | « third_party/WebKit/Source/wtf/ThreadingWin.cpp ('k') | third_party/WebKit/Source/wtf/WTFThreadData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/WTFThreadData.h
diff --git a/third_party/WebKit/Source/wtf/WTFThreadData.h b/third_party/WebKit/Source/wtf/WTFThreadData.h
index a8228fce72e0e288153d3311b0ea25875cfe92b0..5b7011c600479cbfad2f906e75ceefd493cc7daf 100644
--- a/third_party/WebKit/Source/wtf/WTFThreadData.h
+++ b/third_party/WebKit/Source/wtf/WTFThreadData.h
@@ -55,6 +55,9 @@ class WTF_EXPORT WTFThreadData {
ThreadIdentifier threadId() const { return m_threadId; }
+ // Must be called on the main thread before any callers to wtfThreadData().
+ static void initialize();
+
#if OS(WIN) && COMPILER(MSVC)
static size_t threadStackSize();
#endif
@@ -74,10 +77,7 @@ class WTF_EXPORT WTFThreadData {
};
inline WTFThreadData& wtfThreadData() {
- // WTFThreadData is used on main thread before it could possibly be used
- // on secondary ones, so there is no need for synchronization here.
- if (!WTFThreadData::staticData)
- WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
+ DCHECK(WTFThreadData::staticData);
return **WTFThreadData::staticData;
}
« no previous file with comments | « third_party/WebKit/Source/wtf/ThreadingWin.cpp ('k') | third_party/WebKit/Source/wtf/WTFThreadData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698