OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/threading/thread_local.h" | 5 #include "base/threading/thread_local.h" |
6 | 6 |
7 #include "base/logging.h" | |
8 | |
9 namespace base { | 7 namespace base { |
10 namespace internal { | 8 namespace internal { |
11 | 9 |
12 // static | 10 // static |
13 void ThreadLocalPlatform::AllocateSlot(SlotType* slot) { | 11 void ThreadLocalPlatform::AllocateSlot(SlotType* slot) { |
14 bool succeed = slot->Initialize(NULL); | 12 slot->Initialize(nullptr); |
15 CHECK(succeed); | |
16 } | 13 } |
17 | 14 |
18 // static | 15 // static |
19 void ThreadLocalPlatform::FreeSlot(SlotType slot) { | 16 void ThreadLocalPlatform::FreeSlot(SlotType slot) { |
20 slot.Free(); | 17 slot.Free(); |
21 } | 18 } |
22 | 19 |
23 // static | 20 // static |
24 void* ThreadLocalPlatform::GetValueFromSlot(SlotType slot) { | 21 void* ThreadLocalPlatform::GetValueFromSlot(SlotType slot) { |
25 return slot.Get(); | 22 return slot.Get(); |
26 } | 23 } |
27 | 24 |
28 // static | 25 // static |
29 void ThreadLocalPlatform::SetValueInSlot(SlotType slot, void* value) { | 26 void ThreadLocalPlatform::SetValueInSlot(SlotType slot, void* value) { |
30 slot.Set(value); | 27 slot.Set(value); |
31 } | 28 } |
32 | 29 |
33 } // namespace internal | 30 } // namespace internal |
34 } // namespace base | 31 } // namespace base |
OLD | NEW |