OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 } // namespace internal | 76 } // namespace internal |
77 | 77 |
78 static Mutex* atomicallyInitializedStaticMutex; | 78 static Mutex* atomicallyInitializedStaticMutex; |
79 | 79 |
80 void initializeThreading() { | 80 void initializeThreading() { |
81 // This should only be called once. | 81 // This should only be called once. |
82 DCHECK(!atomicallyInitializedStaticMutex); | 82 DCHECK(!atomicallyInitializedStaticMutex); |
83 | 83 |
| 84 WTFThreadData::initializeOnMainThread(); |
| 85 |
84 // StringImpl::empty() does not construct its static string in a threadsafe | 86 // StringImpl::empty() does not construct its static string in a threadsafe |
85 // fashion, so ensure it has been initialized from here. | 87 // fashion, so ensure it has been initialized from here. |
86 StringImpl::empty(); | 88 StringImpl::empty(); |
87 StringImpl::empty16Bit(); | 89 StringImpl::empty16Bit(); |
88 atomicallyInitializedStaticMutex = new Mutex; | 90 atomicallyInitializedStaticMutex = new Mutex; |
89 wtfThreadData(); | |
90 initializeDates(); | 91 initializeDates(); |
91 // Force initialization of static DoubleToStringConverter converter variable | 92 // Force initialization of static DoubleToStringConverter converter variable |
92 // inside EcmaScriptConverter function while we are in single thread mode. | 93 // inside EcmaScriptConverter function while we are in single thread mode. |
93 double_conversion::DoubleToStringConverter::EcmaScriptConverter(); | 94 double_conversion::DoubleToStringConverter::EcmaScriptConverter(); |
94 } | 95 } |
95 | 96 |
96 void lockAtomicallyInitializedStaticMutex() { | 97 void lockAtomicallyInitializedStaticMutex() { |
97 DCHECK(atomicallyInitializedStaticMutex); | 98 DCHECK(atomicallyInitializedStaticMutex); |
98 atomicallyInitializedStaticMutex->lock(); | 99 atomicallyInitializedStaticMutex->lock(); |
99 } | 100 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 247 } |
247 | 248 |
248 void willCreateThread() { | 249 void willCreateThread() { |
249 s_threadCreated = true; | 250 s_threadCreated = true; |
250 } | 251 } |
251 #endif | 252 #endif |
252 | 253 |
253 } // namespace WTF | 254 } // namespace WTF |
254 | 255 |
255 #endif // OS(POSIX) | 256 #endif // OS(POSIX) |
OLD | NEW |