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

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

Issue 6469070: More DCHECK() updates. A mixture of _EQ and _GE. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updating pickle.h order Created 9 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « base/synchronization/waitable_event_win.cc ('k') | base/tracked_objects.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <windows.h> 7 #include <windows.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 29 matching lines...) Expand all
40 // Atomically test-and-set the tls_key. If the key is TLS_OUT_OF_INDEXES, 40 // Atomically test-and-set the tls_key. If the key is TLS_OUT_OF_INDEXES,
41 // go ahead and set it. Otherwise, do nothing, as another 41 // go ahead and set it. Otherwise, do nothing, as another
42 // thread already did our dirty work. 42 // thread already did our dirty work.
43 if (InterlockedCompareExchange(&tls_key_, value, TLS_OUT_OF_INDEXES) != 43 if (InterlockedCompareExchange(&tls_key_, value, TLS_OUT_OF_INDEXES) !=
44 TLS_OUT_OF_INDEXES) { 44 TLS_OUT_OF_INDEXES) {
45 // We've been shortcut. Another thread replaced tls_key_ first so we need 45 // We've been shortcut. Another thread replaced tls_key_ first so we need
46 // to destroy our index and use the one the other thread got first. 46 // to destroy our index and use the one the other thread got first.
47 TlsFree(value); 47 TlsFree(value);
48 } 48 }
49 } 49 }
50 DCHECK(TlsGetValue(tls_key_) == NULL); 50 DCHECK(!TlsGetValue(tls_key_));
51 51
52 // Create an array to store our data. 52 // Create an array to store our data.
53 void** tls_data = new void*[kThreadLocalStorageSize]; 53 void** tls_data = new void*[kThreadLocalStorageSize];
54 memset(tls_data, 0, sizeof(void*[kThreadLocalStorageSize])); 54 memset(tls_data, 0, sizeof(void*[kThreadLocalStorageSize]));
55 TlsSetValue(tls_key_, tls_data); 55 TlsSetValue(tls_key_, tls_data);
56 return tls_data; 56 return tls_data;
57 } 57 }
58 58
59 ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor) 59 ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor)
60 : initialized_(false), 60 : initialized_(false),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 #else // _WIN64 190 #else // _WIN64
191 191
192 #pragma data_seg(".CRT$XLB") 192 #pragma data_seg(".CRT$XLB")
193 PIMAGE_TLS_CALLBACK p_thread_callback_base = OnThreadExit; 193 PIMAGE_TLS_CALLBACK p_thread_callback_base = OnThreadExit;
194 194
195 // Reset the default section. 195 // Reset the default section.
196 #pragma data_seg() 196 #pragma data_seg()
197 197
198 #endif // _WIN64 198 #endif // _WIN64
199 } // extern "C" 199 } // extern "C"
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event_win.cc ('k') | base/tracked_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698