Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: base/threading/thread_local_storage.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/threading/thread_local_storage.h ('k') | base/threading/thread_local_storage_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_storage.h" 5 #include "base/threading/thread_local_storage.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 using base::internal::PlatformThreadLocalStorage; 10 using base::internal::PlatformThreadLocalStorage;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Remove our stack allocated vector. 164 // Remove our stack allocated vector.
165 PlatformThreadLocalStorage::SetTLSValue(key, NULL); 165 PlatformThreadLocalStorage::SetTLSValue(key, NULL);
166 } 166 }
167 167
168 } // namespace 168 } // namespace
169 169
170 namespace base { 170 namespace base {
171 171
172 namespace internal { 172 namespace internal {
173 173
174 #if defined(OS_WIN) 174 #if defined(OS_POSIX)
175 void PlatformThreadLocalStorage::OnThreadExit() {
176 PlatformThreadLocalStorage::TLSKey key =
177 base::subtle::NoBarrier_Load(&g_native_tls_key);
178 if (key == PlatformThreadLocalStorage::TLS_KEY_OUT_OF_INDEXES)
179 return;
180 void *tls_data = GetTLSValue(key);
181 // Maybe we have never initialized TLS for this thread.
182 if (!tls_data)
183 return;
184 OnThreadExitInternal(tls_data);
185 }
186 #elif defined(OS_POSIX)
187 void PlatformThreadLocalStorage::OnThreadExit(void* value) { 175 void PlatformThreadLocalStorage::OnThreadExit(void* value) {
188 OnThreadExitInternal(value); 176 OnThreadExitInternal(value);
189 } 177 }
190 #endif // defined(OS_WIN) 178 #endif // defined(OS_POSIX)
191 179
192 } // namespace internal 180 } // namespace internal
193 181
194 ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor) { 182 ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor) {
195 initialized_ = false; 183 initialized_ = false;
196 slot_ = 0; 184 slot_ = 0;
197 Initialize(destructor); 185 Initialize(destructor);
198 } 186 }
199 187
200 void ThreadLocalStorage::StaticSlot::Initialize(TLSDestructorFunc destructor) { 188 void ThreadLocalStorage::StaticSlot::Initialize(TLSDestructorFunc destructor) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 PlatformThreadLocalStorage::GetTLSValue( 228 PlatformThreadLocalStorage::GetTLSValue(
241 base::subtle::NoBarrier_Load(&g_native_tls_key))); 229 base::subtle::NoBarrier_Load(&g_native_tls_key)));
242 if (!tls_data) 230 if (!tls_data)
243 tls_data = ConstructTlsVector(); 231 tls_data = ConstructTlsVector();
244 DCHECK_GT(slot_, 0); 232 DCHECK_GT(slot_, 0);
245 DCHECK_LT(slot_, kThreadLocalStorageSize); 233 DCHECK_LT(slot_, kThreadLocalStorageSize);
246 tls_data[slot_] = value; 234 tls_data[slot_] = value;
247 } 235 }
248 236
249 } // namespace base 237 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/thread_local_storage.h ('k') | base/threading/thread_local_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698