OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkTypes.h" | 7 #include "SkTypes.h" |
8 #if defined(SK_BUILD_FOR_WIN32) | 8 #if defined(SK_BUILD_FOR_WIN32) |
9 | 9 |
10 #include "SkTLS.h" | 10 #include "SkTLS.h" |
11 #include "SkMutex.h" | 11 #include "SkMutex.h" |
12 | 12 |
13 static bool gOnce = false; | 13 static bool gOnce = false; |
14 static DWORD gTlsIndex; | 14 static DWORD gTlsIndex; |
15 SK_DECLARE_STATIC_MUTEX(gMutex); | 15 static SkMutex gMutex; |
16 | 16 |
17 void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) { | 17 void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) { |
18 if (!forceCreateTheSlot && !gOnce) { | 18 if (!forceCreateTheSlot && !gOnce) { |
19 return nullptr; | 19 return nullptr; |
20 } | 20 } |
21 | 21 |
22 if (!gOnce) { | 22 if (!gOnce) { |
23 SkAutoMutexAcquire tmp(gMutex); | 23 SkAutoMutexAcquire tmp(gMutex); |
24 if (!gOnce) { | 24 if (!gOnce) { |
25 gTlsIndex = TlsAlloc(); | 25 gTlsIndex = TlsAlloc(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #else | 70 #else |
71 | 71 |
72 #pragma data_seg(".CRT$XLB") | 72 #pragma data_seg(".CRT$XLB") |
73 PIMAGE_TLS_CALLBACK skia_tls_callback = onTLSCallback; | 73 PIMAGE_TLS_CALLBACK skia_tls_callback = onTLSCallback; |
74 #pragma data_seg() | 74 #pragma data_seg() |
75 | 75 |
76 #endif | 76 #endif |
77 } | 77 } |
78 | 78 |
79 #endif//defined(SK_BUILD_FOR_WIN32) | 79 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |