Chromium Code Reviews| 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*(); |
| } |