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..11d87122c32e6da0624c670e48ed77fa5b6c8d6f 100644 |
--- a/base/message_loop/message_loop.h |
+++ b/base/message_loop/message_loop.h |
@@ -291,12 +291,10 @@ 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. |
+ // This function is only valid when this message loop is running and |
+ // BindToCurrentThread has already been called. |
+ std::string GetThreadName() const; |
// Gets the TaskRunner associated with this message loop. |
const scoped_refptr<SingleThreadTaskRunner>& task_runner() { |
@@ -517,7 +515,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 +533,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. |
+ PlatformThreadId thread_id_; |
+ |
template <class T, class R> friend class base::subtle::DeleteHelperInternal; |
template <class T, class R> friend class base::subtle::ReleaseHelperInternal; |