summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-14 23:52:33 +0000
committerkmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-14 23:52:33 +0000
commit6c40ccce333577885785d8528d8743df30c254fb (patch)
tree0e71b0bc9712f316bc8642361b4b52268e9593d6
parent5dd4a2c8d4c8cb889069388fcf0105962b99c50d (diff)
downloadchromium_src-6c40ccce333577885785d8528d8743df30c254fb.zip
chromium_src-6c40ccce333577885785d8528d8743df30c254fb.tar.gz
chromium_src-6c40ccce333577885785d8528d8743df30c254fb.tar.bz2
Revert 109962 - Revert 109903 - Revert 109898 - Set the profiler's thread name at a central place
[I've removed the code, via a separate CL, that DCHECK() earlier today] 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 TBR=jar@chromium.org Review URL: http://codereview.chromium.org/8564014 TBR=jar@chromium.org Review URL: http://codereview.chromium.org/8565030 TBR=jar@chromium.org Review URL: http://codereview.chromium.org/8555022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109980 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/threading/platform_thread_posix.cc3
-rw-r--r--base/threading/platform_thread_win.cc2
-rw-r--r--base/threading/thread.cc2
-rw-r--r--content/browser/browser_main_loop.cc2
4 files changed, 4 insertions, 5 deletions
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 772d1f2..55b3f69 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -13,7 +13,6 @@
#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>
@@ -176,7 +175,6 @@ 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
@@ -212,7 +210,6 @@ 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 4feec0c..03e0831 100644
--- a/base/threading/platform_thread_win.cc
+++ b/base/threading/platform_thread_win.cc
@@ -8,7 +8,6 @@
#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"
@@ -101,7 +100,6 @@ 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 616aac8..d49f247 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -8,6 +8,7 @@
#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 {
@@ -151,6 +152,7 @@ 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.
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index d722637..bdc2280 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -11,6 +11,7 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/threading/thread_restrictions.h"
+#include "base/tracked_objects.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/trace_controller.h"
#include "content/common/hi_res_timer_manager.h"
@@ -296,6 +297,7 @@ void BrowserMainLoop::InitializeMainThread() {
const char* kThreadName = "CrBrowserMain";
base::PlatformThread::SetName(kThreadName);
main_message_loop_->set_thread_name(kThreadName);
+ tracked_objects::ThreadData::InitializeThreadContext(kThreadName);
// Register the main thread by instantiating it, but don't call any methods.
main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI,