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

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

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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. 4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void unlockAtomicallyInitializedStaticMutex() { 143 void unlockAtomicallyInitializedStaticMutex() {
144 atomicallyInitializedStaticMutex->unlock(); 144 atomicallyInitializedStaticMutex->unlock();
145 } 145 }
146 146
147 void initializeThreading() { 147 void initializeThreading() {
148 // This should only be called once. 148 // This should only be called once.
149 DCHECK(!atomicallyInitializedStaticMutex); 149 DCHECK(!atomicallyInitializedStaticMutex);
150 150
151 WTFThreadData::initializeOnMainThread();
152
151 // StringImpl::empty() does not construct its static string in a threadsafe 153 // StringImpl::empty() does not construct its static string in a threadsafe
152 // fashion, so ensure it has been initialized from here. 154 // fashion, so ensure it has been initialized from here.
153 StringImpl::empty(); 155 StringImpl::empty();
154 StringImpl::empty16Bit(); 156 StringImpl::empty16Bit();
155 atomicallyInitializedStaticMutex = new Mutex; 157 atomicallyInitializedStaticMutex = new Mutex;
156 wtfThreadData();
157 initializeDates(); 158 initializeDates();
158 // Force initialization of static DoubleToStringConverter converter variable 159 // Force initialization of static DoubleToStringConverter converter variable
159 // inside EcmaScriptConverter function while we are in single thread mode. 160 // inside EcmaScriptConverter function while we are in single thread mode.
160 double_conversion::DoubleToStringConverter::EcmaScriptConverter(); 161 double_conversion::DoubleToStringConverter::EcmaScriptConverter();
161 } 162 }
162 163
163 ThreadIdentifier currentThread() { 164 ThreadIdentifier currentThread() {
164 return wtfThreadData().threadId(); 165 return wtfThreadData().threadId();
165 } 166 }
166 167
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 411 }
411 412
412 void willCreateThread() { 413 void willCreateThread() {
413 s_threadCreated = true; 414 s_threadCreated = true;
414 } 415 }
415 #endif 416 #endif
416 417
417 } // namespace WTF 418 } // namespace WTF
418 419
419 #endif // OS(WIN) 420 #endif // OS(WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698