| OLD | NEW |
| 1 #include "SkTLS.h" | 1 #include "SkTLS.h" |
| 2 | 2 |
| 3 // enable to help debug TLS storage | 3 // enable to help debug TLS storage |
| 4 //#define SK_TRACE_TLS_LIFETIME | 4 //#define SK_TRACE_TLS_LIFETIME |
| 5 | 5 |
| 6 | 6 |
| 7 #ifdef SK_TRACE_TLS_LIFETIME | 7 #ifdef SK_TRACE_TLS_LIFETIME |
| 8 #include "SkThread.h" | 8 #include "SkThread.h" |
| 9 static int32_t gTLSRecCount; | 9 static int32_t gTLSRecCount; |
| 10 #endif | 10 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 void SkTLS::Destructor(void* ptr) { | 38 void SkTLS::Destructor(void* ptr) { |
| 39 #ifdef SK_TRACE_TLS_LIFETIME | 39 #ifdef SK_TRACE_TLS_LIFETIME |
| 40 SkDebugf("SkTLS::Destructor(%p)\n", ptr); | 40 SkDebugf("SkTLS::Destructor(%p)\n", ptr); |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 SkTLSRec* rec = (SkTLSRec*)ptr; | 43 SkTLSRec* rec = (SkTLSRec*)ptr; |
| 44 do { | 44 do { |
| 45 SkTLSRec* next = rec->fNext; | 45 SkTLSRec* next = rec->fNext; |
| 46 SkDELETE(rec); | 46 SkDELETE(rec); |
| 47 rec = next; | 47 rec = next; |
| 48 } while (NULL != rec); | 48 } while (rec); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) { | 51 void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) { |
| 52 if (NULL == createProc) { | 52 if (NULL == createProc) { |
| 53 return NULL; | 53 return NULL; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void* ptr = SkTLS::PlatformGetSpecific(true); | 56 void* ptr = SkTLS::PlatformGetSpecific(true); |
| 57 | 57 |
| 58 if (ptr) { | 58 if (ptr) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // we have a new head of our chain | 114 // we have a new head of our chain |
| 115 SkTLS::PlatformSetSpecific(next); | 115 SkTLS::PlatformSetSpecific(next); |
| 116 } | 116 } |
| 117 SkDELETE(curr); | 117 SkDELETE(curr); |
| 118 break; | 118 break; |
| 119 } | 119 } |
| 120 prev = curr; | 120 prev = curr; |
| 121 curr = next; | 121 curr = next; |
| 122 } | 122 } |
| 123 } | 123 } |
| OLD | NEW |