mayNotBeMainThread is sensitive to which thread it is first called on |
||
Issue descriptionThis makes it dangerous to add call sites to this useful trick. Instead, it should initialize once (along with the rest of WTF main thread initialization). As a bonus, this makes the inline function substantially shorter (especially now that we have threadsafe static locals in Chromium).
,
Mar 7 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140 commit 11dcf4d494498d0a49f8a1674ad2a9f1e1f59140 Author: jbroman <jbroman@chromium.org> Date: Tue Mar 07 18:38:07 2017 WTF: Initialize main-thread stack estimates when WTF starts up. Initializing this statically makes it sensitive to which thread it runs on for the first time. Instead of using a static local, an ordinary global variable is initialized once, when WTF knows it is on the main thread. As a side effect, the check for static initialization in the function itself is no longer required (and happens to even be safe if it is called before initialization), which means the function need not be exported (only the variables must be), and should compile to less code. Finally, the method (which is useful to callers outside of WTF) is moved into the general WTF namespace, and only the implementation details are kept in WTF::internal. BUG= 697994 Review-Url: https://codereview.chromium.org/2728453006 Cr-Commit-Position: refs/heads/master@{#455150} [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/StackUtil.cpp [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/StackUtil.h [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/ThreadSpecific.h [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/Threading.h [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/ThreadingWin.cpp [modify] https://crrev.com/11dcf4d494498d0a49f8a1674ad2a9f1e1f59140/third_party/WebKit/Source/wtf/WTF.cpp
,
Mar 7 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by haraken@chromium.org
, Mar 2 2017