Index: base/message_loop.cc |
diff --git a/base/message_loop.cc b/base/message_loop.cc |
index e3f6ea3440251bfcb43901ed4a32826381aa5171..522c9243cf0a986548fd12a834442af453cabb7e 100644 |
--- a/base/message_loop.cc |
+++ b/base/message_loop.cc |
@@ -15,6 +15,7 @@ |
#include "base/message_pump_default.h" |
#include "base/metrics/histogram.h" |
#include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
+#include "base/threading/platform_thread.h" |
#include "base/threading/thread_local.h" |
#include "base/time.h" |
#include "base/tracked_objects.h" |
@@ -122,10 +123,11 @@ MessageLoop::DestructionObserver::~DestructionObserver() { |
//------------------------------------------------------------------------------ |
-MessageLoop::MessageLoop(Type type) |
+MessageLoop::MessageLoop(const char* thread_name, Type type) |
: type_(type), |
nestable_tasks_allowed_(true), |
exception_restoration_(false), |
+ thread_name_(thread_name), |
message_histogram_(NULL), |
state_(NULL), |
should_leak_tasks_(true), |
@@ -166,6 +168,9 @@ MessageLoop::MessageLoop(Type type) |
DCHECK_EQ(TYPE_DEFAULT, type_); |
pump_ = new base::MessagePumpDefault(); |
} |
+ base::PlatformThread::SetName(thread_name_.c_str()); |
+ // Tell the name to race detector. |
+ ANNOTATE_THREAD_NAME(thread_name_.c_str()); |
} |
MessageLoop::~MessageLoop() { |