summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 17:20:10 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 17:20:10 +0000
commit29813a64ab632f758361714c0aa90672b0621fd2 (patch)
treeceb20b4d3647b8d09609a419096d94cebbc806cb /base
parent8b99df89198cdcd2674999099e21ee8d7b7678d0 (diff)
downloadchromium_src-29813a64ab632f758361714c0aa90672b0621fd2.zip
chromium_src-29813a64ab632f758361714c0aa90672b0621fd2.tar.gz
chromium_src-29813a64ab632f758361714c0aa90672b0621fd2.tar.bz2
Move base::ThreadLocalPlatform to base::internal::ThreadLocalPlatform.
BUG=none TEST=none Review URL: http://codereview.chromium.org/4744002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65812 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/thread_local.h15
-rw-r--r--base/thread_local_posix.cc4
-rw-r--r--base/thread_local_win.cc4
3 files changed, 18 insertions, 5 deletions
diff --git a/base/thread_local.h b/base/thread_local.h
index 075e209..eba48d2 100644
--- a/base/thread_local.h
+++ b/base/thread_local.h
@@ -57,6 +57,8 @@
namespace base {
+namespace internal {
+
// Helper functions that abstract the cross-platform APIs. Do not use directly.
struct ThreadLocalPlatform {
#if defined(OS_WIN)
@@ -71,27 +73,30 @@ struct ThreadLocalPlatform {
static void SetValueInSlot(SlotType& slot, void* value);
};
+} // namespace internal
+
template <typename Type>
class ThreadLocalPointer {
public:
ThreadLocalPointer() : slot_() {
- ThreadLocalPlatform::AllocateSlot(slot_);
+ internal::ThreadLocalPlatform::AllocateSlot(slot_);
}
~ThreadLocalPointer() {
- ThreadLocalPlatform::FreeSlot(slot_);
+ internal::ThreadLocalPlatform::FreeSlot(slot_);
}
Type* Get() {
- return static_cast<Type*>(ThreadLocalPlatform::GetValueFromSlot(slot_));
+ return static_cast<Type*>(
+ internal::ThreadLocalPlatform::GetValueFromSlot(slot_));
}
void Set(Type* ptr) {
- ThreadLocalPlatform::SetValueInSlot(slot_, ptr);
+ internal::ThreadLocalPlatform::SetValueInSlot(slot_, ptr);
}
private:
- typedef ThreadLocalPlatform::SlotType SlotType;
+ typedef internal::ThreadLocalPlatform::SlotType SlotType;
SlotType slot_;
diff --git a/base/thread_local_posix.cc b/base/thread_local_posix.cc
index 2abfc0e..4d03403 100644
--- a/base/thread_local_posix.cc
+++ b/base/thread_local_posix.cc
@@ -10,6 +10,8 @@
namespace base {
+namespace internal {
+
// static
void ThreadLocalPlatform::AllocateSlot(SlotType& slot) {
int error = pthread_key_create(&slot, NULL);
@@ -33,4 +35,6 @@ void ThreadLocalPlatform::SetValueInSlot(SlotType& slot, void* value) {
CHECK_EQ(error, 0);
}
+} // namespace internal
+
} // namespace base
diff --git a/base/thread_local_win.cc b/base/thread_local_win.cc
index 368c0d6..ea14a67 100644
--- a/base/thread_local_win.cc
+++ b/base/thread_local_win.cc
@@ -10,6 +10,8 @@
namespace base {
+namespace internal {
+
// static
void ThreadLocalPlatform::AllocateSlot(SlotType& slot) {
slot = TlsAlloc();
@@ -35,4 +37,6 @@ void ThreadLocalPlatform::SetValueInSlot(SlotType& slot, void* value) {
}
}
+} // namespace internal
+
} // namespace base