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

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

Issue 2646003003: Avoid checking for WTFThreadData::staticData in wtfThreadData() (Closed)
Patch Set: 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/ThreadSpecific.h
diff --git a/third_party/WebKit/Source/wtf/ThreadSpecific.h b/third_party/WebKit/Source/wtf/ThreadSpecific.h
index 5b197de00b5e533550547a6575b3cc4d7f3dfa1a..94efb869f22092348c22ed15c47574f99e706e3d 100644
--- a/third_party/WebKit/Source/wtf/ThreadSpecific.h
+++ b/third_party/WebKit/Source/wtf/ThreadSpecific.h
@@ -73,8 +73,13 @@ class ThreadSpecific {
public:
ThreadSpecific();
- bool
- isSet(); // Useful as a fast check to see if this thread has set this value.
+
+ // Useful as a fast check to see if this thread has set this value.
+ bool isSet();
+
+ // Must only be called during thread initialization.
+ void initializeOnOffThread();
esprehn 2017/01/19 23:47:45 OnOffThread is weirdly named, did this lose a word
Charlie Harrison 2017/01/19 23:54:41 Nope, I'm just awkward at naming things :P
+ void initializeOnMainThread();
T* operator->();
operator T*();
T& operator*();
@@ -240,7 +245,7 @@ inline void ThreadSpecific<T>::destroy(void* ptr) {
// longer has a graceful shutdown sequence. Be careful to call this function
// (which can be re-entrant) while the pointer is still set, to avoid lazily
// allocating WTFThreadData after it is destroyed.
- if (isMainThread())
+ if (internal::isMainThreadSyscall())
return;
data->value->~T();
@@ -290,6 +295,11 @@ inline ThreadSpecific<T>::operator T*() {
}
template <typename T>
+inline void ThreadSpecific<T>::initializeOnOffThread() {}
+template <typename T>
+inline void ThreadSpecific<T>::initializeOnMainThread() {}
+
+template <typename T>
inline T* ThreadSpecific<T>::operator->() {
return operator T*();
}

Powered by Google App Engine
This is Rietveld 408576698