| OLD | NEW |
| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 static Mutex& threadMapMutex() | 162 static Mutex& threadMapMutex() |
| 163 { | 163 { |
| 164 static Mutex mutex; | 164 static Mutex mutex; |
| 165 return mutex; | 165 return mutex; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void initializeThreading() | 168 void initializeThreading() |
| 169 { | 169 { |
| 170 if (atomicallyInitializedStaticMutex) | 170 // This should only be called once. |
| 171 return; | 171 ASSERT(!atomicallyInitializedStaticMutex); |
| 172 | 172 |
| 173 WTF::double_conversion::initialize(); | 173 WTF::double_conversion::initialize(); |
| 174 // StringImpl::empty() does not construct its static string in a threadsafe
fashion, | 174 // StringImpl::empty() does not construct its static string in a threadsafe
fashion, |
| 175 // so ensure it has been initialized from here. | 175 // so ensure it has been initialized from here. |
| 176 StringImpl::empty(); | 176 StringImpl::empty(); |
| 177 atomicallyInitializedStaticMutex = new Mutex; | 177 atomicallyInitializedStaticMutex = new Mutex; |
| 178 threadMapMutex(); | 178 threadMapMutex(); |
| 179 initializeRandomNumberGenerator(); | 179 initializeRandomNumberGenerator(); |
| 180 wtfThreadData(); | 180 wtfThreadData(); |
| 181 s_dtoaP5Mutex = new Mutex; | 181 s_dtoaP5Mutex = new Mutex; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Time is too far in the future (and would overflow unsigned long) - wait f
orever. | 503 // Time is too far in the future (and would overflow unsigned long) - wait f
orever. |
| 504 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) | 504 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) |
| 505 return INFINITE; | 505 return INFINITE; |
| 506 | 506 |
| 507 return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0); | 507 return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0); |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace WTF | 510 } // namespace WTF |
| 511 | 511 |
| 512 #endif // OS(WINDOWS) | 512 #endif // OS(WINDOWS) |
| OLD | NEW |