| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Jian Li <jianli@chromium.org> | 2 * Copyright (C) 2009 Jian Li <jianli@chromium.org> |
| 3 * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> | 3 * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 USING_FAST_MALLOC(PlatformThreadSpecificKey); | 46 USING_FAST_MALLOC(PlatformThreadSpecificKey); |
| 47 WTF_MAKE_NONCOPYABLE(PlatformThreadSpecificKey); | 47 WTF_MAKE_NONCOPYABLE(PlatformThreadSpecificKey); |
| 48 | 48 |
| 49 public: | 49 public: |
| 50 friend class DoublyLinkedListNode<PlatformThreadSpecificKey>; | 50 friend class DoublyLinkedListNode<PlatformThreadSpecificKey>; |
| 51 | 51 |
| 52 PlatformThreadSpecificKey(void (*destructor)(void*)) | 52 PlatformThreadSpecificKey(void (*destructor)(void*)) |
| 53 : destructor_(destructor) { | 53 : destructor_(destructor) { |
| 54 tls_key_ = TlsAlloc(); | 54 tls_key_ = TlsAlloc(); |
| 55 if (tls_key_ == TLS_OUT_OF_INDEXES) | 55 if (tls_key_ == TLS_OUT_OF_INDEXES) |
| 56 CRASH(); | 56 IMMEDIATE_CRASH(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 ~PlatformThreadSpecificKey() { TlsFree(tls_key_); } | 59 ~PlatformThreadSpecificKey() { TlsFree(tls_key_); } |
| 60 | 60 |
| 61 void SetValue(void* data) { TlsSetValue(tls_key_, data); } | 61 void SetValue(void* data) { TlsSetValue(tls_key_, data); } |
| 62 void* Value() { return TlsGetValue(tls_key_); } | 62 void* Value() { return TlsGetValue(tls_key_); } |
| 63 | 63 |
| 64 void CallDestructor() { | 64 void CallDestructor() { |
| 65 if (void* data = Value()) | 65 if (void* data = Value()) |
| 66 destructor_(data); | 66 destructor_(data); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 while (key) { | 121 while (key) { |
| 122 PlatformThreadSpecificKey* next_key = key->Next(); | 122 PlatformThreadSpecificKey* next_key = key->Next(); |
| 123 key->CallDestructor(); | 123 key->CallDestructor(); |
| 124 key = next_key; | 124 key = next_key; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace WTF | 128 } // namespace WTF |
| 129 | 129 |
| 130 #endif // OS(WIN) | 130 #endif // OS(WIN) |
| OLD | NEW |