diff options
-rw-r--r-- | base/thread_local.h | 15 | ||||
-rw-r--r-- | base/thread_local_posix.cc | 4 | ||||
-rw-r--r-- | base/thread_local_win.cc | 4 | ||||
-rw-r--r-- | chrome/test/data/reliability/known_crashes.txt | 2 |
4 files changed, 19 insertions, 6 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 diff --git a/chrome/test/data/reliability/known_crashes.txt b/chrome/test/data/reliability/known_crashes.txt index 1840a2d..6f59e74 100644 --- a/chrome/test/data/reliability/known_crashes.txt +++ b/chrome/test/data/reliability/known_crashes.txt @@ -81,7 +81,7 @@ PREFIX : `anonymous namespace'::purecall____purecall___browserclosednotification PREFIX : `anonymous namespace'::invalidparameter____purecall___browserclosednotificationobserver::observe___notificationservice::notify # 57041 -PREFIX: `anonymous namespace'::purecall____purecall___`anonymous namespace'::do_malloc___base::threadlocalplatform::getvaluefromslot___notificationservice::currentPREFIX: `anonymous namespace'::invalidparameter____purecall___`anonymous namespace'::do_malloc___base::threadlocalplatform::getvaluefromslot___notificationservice::current +PREFIX: `anonymous namespace'::purecall____purecall___`anonymous namespace'::do_malloc___base::internal::threadlocalplatform::getvaluefromslot___notificationservice::currentPREFIX: `anonymous namespace'::invalidparameter____purecall___`anonymous namespace'::do_malloc___base::internal::threadlocalplatform::getvaluefromslot___notificationservice::current PREFIX: `anonymous namespace'::purecall____purecall___`anonymous namespace'::do_free_with_callback___notificationservice::notify___browserlist::removebrowser___browser::~browser PREFIX: `anonymous namespace'::invalidparameter____purecall___`anonymous namespace'::do_free_with_callback___notificationservice::notify___browserlist::removebrowser___browser::~browser PREFIX: `anonymous namespace'::invalidparameter____purecall___notificationservice::notify___browserlist::removebrowser___browser::~browser___browse |