OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project 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 "src/base/platform/platform.h" | 5 #include "src/base/platform/platform.h" |
6 | 6 |
7 #if V8_OS_POSIX | 7 #if V8_OS_POSIX |
8 #include <unistd.h> // NOLINT | 8 #include <unistd.h> // NOLINT |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 for (size_t i = 0; i < arraysize(keys_); ++i) { | 42 for (size_t i = 0; i < arraysize(keys_); ++i) { |
43 keys_[i] = Thread::CreateThreadLocalKey(); | 43 keys_[i] = Thread::CreateThreadLocalKey(); |
44 } | 44 } |
45 } | 45 } |
46 ~ThreadLocalStorageTest() { | 46 ~ThreadLocalStorageTest() { |
47 for (size_t i = 0; i < arraysize(keys_); ++i) { | 47 for (size_t i = 0; i < arraysize(keys_); ++i) { |
48 Thread::DeleteThreadLocalKey(keys_[i]); | 48 Thread::DeleteThreadLocalKey(keys_[i]); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 void Run() FINAL { | 52 void Run() final { |
53 for (size_t i = 0; i < arraysize(keys_); i++) { | 53 for (size_t i = 0; i < arraysize(keys_); i++) { |
54 CHECK(!Thread::HasThreadLocal(keys_[i])); | 54 CHECK(!Thread::HasThreadLocal(keys_[i])); |
55 } | 55 } |
56 for (size_t i = 0; i < arraysize(keys_); i++) { | 56 for (size_t i = 0; i < arraysize(keys_); i++) { |
57 Thread::SetThreadLocal(keys_[i], GetValue(i)); | 57 Thread::SetThreadLocal(keys_[i], GetValue(i)); |
58 } | 58 } |
59 for (size_t i = 0; i < arraysize(keys_); i++) { | 59 for (size_t i = 0; i < arraysize(keys_); i++) { |
60 CHECK(Thread::HasThreadLocal(keys_[i])); | 60 CHECK(Thread::HasThreadLocal(keys_[i])); |
61 } | 61 } |
62 for (size_t i = 0; i < arraysize(keys_); i++) { | 62 for (size_t i = 0; i < arraysize(keys_); i++) { |
(...skipping 28 matching lines...) Expand all Loading... |
91 | 91 |
92 | 92 |
93 TEST_F(ThreadLocalStorageTest, DoTest) { | 93 TEST_F(ThreadLocalStorageTest, DoTest) { |
94 Run(); | 94 Run(); |
95 Start(); | 95 Start(); |
96 Join(); | 96 Join(); |
97 } | 97 } |
98 | 98 |
99 } // namespace base | 99 } // namespace base |
100 } // namespace v8 | 100 } // namespace v8 |
OLD | NEW |