Chromium Code Reviews| Index: base/threading/thread.cc |
| diff --git a/base/threading/thread.cc b/base/threading/thread.cc |
| index 7bff24232e2bf2d66fda4485a4246ebae2e98332..aa8323838bfbf8606e57a805a90d8d0d701a65f4 100644 |
| --- a/base/threading/thread.cc |
| +++ b/base/threading/thread.cc |
| @@ -62,6 +62,7 @@ Thread::Thread(const std::string& name) |
| stopping_(false), |
| running_(false), |
| thread_(0), |
| + id_(kInvalidThreadId), |
| message_loop_(nullptr), |
| message_loop_timer_slack_(TIMER_SLACK_NONE), |
| name_(name) { |
| @@ -176,11 +177,6 @@ void Thread::StopSoon() { |
| task_runner()->PostTask(FROM_HERE, base::Bind(&ThreadQuitHelper)); |
| } |
| -PlatformThreadId Thread::thread_id() const { |
| - AutoLock lock(thread_lock_); |
| - return thread_.id(); |
| -} |
| - |
| bool Thread::IsRunning() const { |
| // If the thread's already started (i.e. message_loop_ is non-null) and |
| // not yet requested to stop (i.e. stopping_ is false) we can just return |
| @@ -212,6 +208,7 @@ bool Thread::GetThreadWasQuitProperly() { |
| void Thread::ThreadMain() { |
| // Complete the initialization of our Thread object. |
| + id_ = PlatformThread::CurrentId(); |
|
gab
2015/07/02 12:00:52
Need to lock to make sure this change is flushed t
Takashi Toyoshima
2015/07/03 04:22:56
Done.
|
| PlatformThread::SetName(name_.c_str()); |
| ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. |
| @@ -231,10 +228,6 @@ void Thread::ThreadMain() { |
| } |
| #endif |
| - // Make sure the thread_id() returns current thread. |
| - // (This internally acquires lock against PlatformThread::Create) |
| - DCHECK_EQ(thread_id(), PlatformThread::CurrentId()); |
| - |
| // Let the thread do extra initialization. |
| Init(); |