Index: base/message_loop/message_loop.h |
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h |
index 8e73d42b1e278dac9f68a58eeb1a01af84f6149e..357202810b3515c362d471563b385e9a0212339f 100644 |
--- a/base/message_loop/message_loop.h |
+++ b/base/message_loop/message_loop.h |
@@ -9,6 +9,7 @@ |
#include <queue> |
#include <string> |
+#include "base/atomicops.h" |
#include "base/base_export.h" |
#include "base/callback_forward.h" |
#include "base/debug/task_annotator.h" |
@@ -291,12 +292,8 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
// Returns the type passed to the constructor. |
Type type() const { return type_; } |
- // Optional call to connect the thread name with this loop. |
- void set_thread_name(const std::string& thread_name) { |
- DCHECK(thread_name_.empty()) << "Should not rename this thread!"; |
- thread_name_ = thread_name; |
- } |
- const std::string& thread_name() const { return thread_name_; } |
+ // Returns the name of the thread this message loop is bound to. |
+ std::string GetThreadName() const; |
// Gets the TaskRunner associated with this message loop. |
const scoped_refptr<SingleThreadTaskRunner>& task_runner() { |
@@ -517,7 +514,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
// if type_ is TYPE_CUSTOM and pump_ is null. |
MessagePumpFactoryCallback pump_factory_; |
- std::string thread_name_; |
// A profiling histogram showing the counts of various messages and events. |
HistogramBase* message_histogram_; |
@@ -536,6 +532,9 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { |
scoped_refptr<SingleThreadTaskRunner> task_runner_; |
std::unique_ptr<ThreadTaskRunnerHandle> thread_task_runner_handle_; |
+ // Id of the thread this message loop is bound to. |
+ subtle::Atomic32 thread_id_; |
+ |
template <class T, class R> friend class base::subtle::DeleteHelperInternal; |
template <class T, class R> friend class base::subtle::ReleaseHelperInternal; |