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

Side by Side Diff: mojo/public/utility/thread_local.h

Issue 128803002: Mojo: Remove utility:: namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 6 years, 11 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 | « mojo/public/utility/run_loop_unittest.cc ('k') | mojo/public/utility/thread_local_posix.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // WARNING: Thread local storage is a bit tricky to get right. Please make 5 // WARNING: Thread local storage is a bit tricky to get right. Please make
6 // sure that this is really the proper solution for what you're trying to 6 // sure that this is really the proper solution for what you're trying to
7 // achieve. Don't prematurely optimize, most likely you can just use a Lock. 7 // achieve. Don't prematurely optimize, most likely you can just use a Lock.
8 // 8 //
9 // These classes implement a wrapper around the platform's TLS storage 9 // These classes implement a wrapper around the platform's TLS storage
10 // mechanism. On construction, they will allocate a TLS slot, and free the 10 // mechanism. On construction, they will allocate a TLS slot, and free the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 #include "build/build_config.h" 51 #include "build/build_config.h"
52 52
53 #if defined(OS_POSIX) 53 #if defined(OS_POSIX)
54 #include <pthread.h> 54 #include <pthread.h>
55 #endif 55 #endif
56 56
57 #include "mojo/public/system/macros.h" 57 #include "mojo/public/system/macros.h"
58 58
59 namespace mojo { 59 namespace mojo {
60 namespace utility {
61 namespace internal { 60 namespace internal {
62 61
63 // Helper functions that abstract the cross-platform APIs. Do not use directly. 62 // Helper functions that abstract the cross-platform APIs. Do not use directly.
64 struct ThreadLocalPlatform { 63 struct ThreadLocalPlatform {
65 #if defined(OS_WIN) 64 #if defined(OS_WIN)
66 typedef unsigned long SlotType; 65 typedef unsigned long SlotType;
67 #elif defined(OS_POSIX) 66 #elif defined(OS_POSIX)
68 typedef pthread_key_t SlotType; 67 typedef pthread_key_t SlotType;
69 #endif 68 #endif
70 69
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void Set(bool val) { 116 void Set(bool val) {
118 tlp_.Set(val ? this : NULL); 117 tlp_.Set(val ? this : NULL);
119 } 118 }
120 119
121 private: 120 private:
122 ThreadLocalPointer<void> tlp_; 121 ThreadLocalPointer<void> tlp_;
123 122
124 MOJO_DISALLOW_COPY_AND_ASSIGN(ThreadLocalBoolean); 123 MOJO_DISALLOW_COPY_AND_ASSIGN(ThreadLocalBoolean);
125 }; 124 };
126 125
127 } // namespace utility
128 } // namespace mojo 126 } // namespace mojo
129 127
130 #endif // MOJO_PUBLIC_UTILITY_THREAD_LOCAL_H_ 128 #endif // MOJO_PUBLIC_UTILITY_THREAD_LOCAL_H_
OLDNEW
« no previous file with comments | « mojo/public/utility/run_loop_unittest.cc ('k') | mojo/public/utility/thread_local_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698