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

Unified Diff: base/threading/platform_thread_mac.mm

Issue 11438022: Add ability to retrieve a thread_name given a thread_id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make some of the try servers happier. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | base/threading/platform_thread_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/platform_thread_mac.mm
diff --git a/base/threading/platform_thread_mac.mm b/base/threading/platform_thread_mac.mm
index 96c672023f915af3bf93929e7ed557cc6ba1020c..48041a06a4f0ba8b3e44b1fc3e19ff748a46942c 100644
--- a/base/threading/platform_thread_mac.mm
+++ b/base/threading/platform_thread_mac.mm
@@ -12,18 +12,11 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/threading/thread_local.h"
+#include "base/threading/thread_id_name_manager.h"
#include "base/tracked_objects.h"
namespace base {
-namespace {
-
-LazyInstance<ThreadLocalPointer<char> >::Leaky
- current_thread_name = LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
// If Cocoa is to be used on more than one thread, it must know that the
// application is multithreaded. Since it's possible to enter Cocoa code
// from threads created by pthread_thread_create, Cocoa won't necessarily
@@ -47,7 +40,7 @@ void InitThreading() {
// static
void PlatformThread::SetName(const char* name) {
- current_thread_name.Pointer()->Set(const_cast<char*>(name));
+ ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name);
tracked_objects::ThreadData::InitializeThreadContext(name);
// pthread_setname_np is only available in 10.6 or later, so test
@@ -67,11 +60,6 @@ void PlatformThread::SetName(const char* name) {
dynamic_pthread_setname_np(shortened_name.c_str());
}
-// static
-const char* PlatformThread::GetName() {
- return current_thread_name.Pointer()->Get();
-}
-
namespace {
void SetPriorityNormal(mach_port_t mach_thread_id) {
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | base/threading/platform_thread_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698