diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-14 16:49:30 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-14 16:49:30 +0000 |
commit | c2fe9dd2f549eb246b6a98397ab542bc6c06bd7d (patch) | |
tree | b5845c5be213eb9e116c581141af463bc677b722 /base/threading | |
parent | 98b968dcdd7875c9ca932f31e2564fa96cf1a9c8 (diff) | |
download | chromium_src-c2fe9dd2f549eb246b6a98397ab542bc6c06bd7d.zip chromium_src-c2fe9dd2f549eb246b6a98397ab542bc6c06bd7d.tar.gz chromium_src-c2fe9dd2f549eb246b6a98397ab542bc6c06bd7d.tar.bz2 |
Set the profiler's thread name at a central place
This will automatically catch thread names in several of the
child processes we are after, and it also catches the name
for a webkcore thread.
r=rtenneti
Review URL: http://codereview.chromium.org/8558003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading')
-rw-r--r-- | base/threading/platform_thread_posix.cc | 3 | ||||
-rw-r--r-- | base/threading/platform_thread_win.cc | 2 | ||||
-rw-r--r-- | base/threading/thread.cc | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc index 55b3f69..772d1f2 100644 --- a/base/threading/platform_thread_posix.cc +++ b/base/threading/platform_thread_posix.cc @@ -13,6 +13,7 @@ #include "base/safe_strerror_posix.h" #include "base/threading/thread_local.h" #include "base/threading/thread_restrictions.h" +#include "base/tracked_objects.h" #if defined(OS_MACOSX) #include <mach/mach.h> @@ -175,6 +176,7 @@ 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)); + tracked_objects::ThreadData::InitializeThreadContext(name); // http://0pointer.de/blog/projects/name-your-threads.html @@ -210,6 +212,7 @@ 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)); + tracked_objects::ThreadData::InitializeThreadContext(name); // (This should be relatively simple to implement for the BSDs; I // just don't have one handy to test the code on.) diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc index 03e0831..4feec0c 100644 --- a/base/threading/platform_thread_win.cc +++ b/base/threading/platform_thread_win.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/threading/thread_local.h" #include "base/threading/thread_restrictions.h" +#include "base/tracked_objects.h" #include "base/win/windows_version.h" @@ -100,6 +101,7 @@ void PlatformThread::Sleep(int duration_ms) { // static void PlatformThread::SetName(const char* name) { current_thread_name.Set(const_cast<char*>(name)); + tracked_objects::ThreadData::InitializeThreadContext(name); // The debugger needs to be around to catch the name in the exception. If // there isn't a debugger, we are just needlessly throwing an exception. diff --git a/base/threading/thread.cc b/base/threading/thread.cc index d49f247..616aac8 100644 --- a/base/threading/thread.cc +++ b/base/threading/thread.cc @@ -8,7 +8,6 @@ #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/threading/thread_local.h" #include "base/synchronization/waitable_event.h" -#include "base/tracked_objects.h" namespace base { @@ -152,7 +151,6 @@ void Thread::ThreadMain() { ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. message_loop.set_thread_name(name_); message_loop_ = &message_loop; - tracked_objects::ThreadData::InitializeThreadContext(name_); // Let the thread do extra initialization. // Let's do this before signaling we are started. |