Index: base/threading/platform_thread_posix.cc |
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc |
index b17c34d43d5ccaf92275616147976156b62b6567..b02a60858f954469037cf18c66d2716cf4479234 100644 |
--- a/base/threading/platform_thread_posix.cc |
+++ b/base/threading/platform_thread_posix.cc |
@@ -11,7 +11,7 @@ |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/safe_strerror_posix.h" |
-#include "base/threading/thread_local.h" |
+#include "base/threading/thread_id_name_manager.h" |
#include "base/threading/thread_restrictions.h" |
#include "base/tracked_objects.h" |
@@ -46,12 +46,6 @@ void InitThreading(); |
namespace { |
-#if !defined(OS_MACOSX) |
-// Mac name code is in in platform_thread_mac.mm. |
-LazyInstance<ThreadLocalPointer<char> >::Leaky |
- current_thread_name = LAZY_INSTANCE_INITIALIZER; |
-#endif |
- |
struct ThreadParams { |
PlatformThread::Delegate* delegate; |
bool joinable; |
@@ -203,9 +197,7 @@ void PlatformThread::Sleep(TimeDelta duration) { |
#if defined(OS_LINUX) |
// static |
void PlatformThread::SetName(const char* name) { |
- // have to cast away const because ThreadLocalPointer does not support const |
- // void* |
- current_thread_name.Pointer()->Set(const_cast<char*>(name)); |
+ ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); |
tracked_objects::ThreadData::InitializeThreadContext(name); |
// On linux we can get the thread names to show up in the debugger by setting |
@@ -230,9 +222,7 @@ void PlatformThread::SetName(const char* name) { |
#else |
// static |
void PlatformThread::SetName(const char* name) { |
- // have to cast away const because ThreadLocalPointer does not support const |
- // void* |
- current_thread_name.Pointer()->Set(const_cast<char*>(name)); |
+ ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); |
tracked_objects::ThreadData::InitializeThreadContext(name); |
// (This should be relatively simple to implement for the BSDs; I |
@@ -240,14 +230,10 @@ void PlatformThread::SetName(const char* name) { |
} |
#endif // defined(OS_LINUX) |
- |
-#if !defined(OS_MACOSX) |
-// Mac is implemented in platform_thread_mac.mm. |
// static |
const char* PlatformThread::GetName() { |
- return current_thread_name.Pointer()->Get(); |
+ return ThreadIdNameManager::GetInstance()->GetName(CurrentId()); |
} |
-#endif |
// static |
bool PlatformThread::Create(size_t stack_size, Delegate* delegate, |