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

Side by Side Diff: third_party/WebKit/Source/wtf/WTF.cpp

Issue 2728453006: WTF: Initialize main-thread stack estimates when WTF starts up. (Closed)
Patch Set: comment about why currentThread works this way Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/ThreadingWin.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "wtf/WTF.h" 31 #include "wtf/WTF.h"
32 32
33 #include "wtf/Assertions.h" 33 #include "wtf/Assertions.h"
34 #include "wtf/Functional.h" 34 #include "wtf/Functional.h"
35 #include "wtf/StackUtil.h"
36 #include "wtf/ThreadSpecific.h"
35 #include "wtf/Threading.h" 37 #include "wtf/Threading.h"
36 #include "wtf/allocator/Partitions.h" 38 #include "wtf/allocator/Partitions.h"
37 #include "wtf/text/AtomicString.h" 39 #include "wtf/text/AtomicString.h"
38 #include "wtf/text/StringStatics.h" 40 #include "wtf/text/StringStatics.h"
39 #include "wtf/typed_arrays/ArrayBufferContents.h" 41 #include "wtf/typed_arrays/ArrayBufferContents.h"
40 42
41 namespace WTF { 43 namespace WTF {
42 44
43 extern void initializeThreading(); 45 extern void initializeThreading();
44 46
(...skipping 11 matching lines...) Expand all
56 58
57 bool isMainThread() { 59 bool isMainThread() {
58 return currentThread() == s_mainThreadIdentifier; 60 return currentThread() == s_mainThreadIdentifier;
59 } 61 }
60 62
61 void initialize(void (*callOnMainThreadFunction)(MainThreadFunction, void*)) { 63 void initialize(void (*callOnMainThreadFunction)(MainThreadFunction, void*)) {
62 // WTF, and Blink in general, cannot handle being re-initialized. 64 // WTF, and Blink in general, cannot handle being re-initialized.
63 // Make that explicit here. 65 // Make that explicit here.
64 RELEASE_ASSERT(!s_initialized); 66 RELEASE_ASSERT(!s_initialized);
65 s_initialized = true; 67 s_initialized = true;
68 initializeCurrentThread();
69 s_mainThreadIdentifier = currentThread();
70
66 initializeThreading(); 71 initializeThreading();
67 72
68 s_callOnMainThreadFunction = callOnMainThreadFunction; 73 s_callOnMainThreadFunction = callOnMainThreadFunction;
69 s_mainThreadIdentifier = currentThread(); 74 internal::initializeMainThreadStackEstimate();
70 AtomicString::init(); 75 AtomicString::init();
71 StringStatics::init(); 76 StringStatics::init();
72 } 77 }
73 78
74 } // namespace WTF 79 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/ThreadingWin.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698