Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Side by Side Diff: base/threading/thread.cc

Issue 1113953002: Revert of base: Remove use of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/threading/thread.h ('k') | base/threading/thread_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/thread.h" 5 #include "base/threading/thread.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h"
10 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
11 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
12 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 11 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
13 #include "base/threading/thread_id_name_manager.h" 12 #include "base/threading/thread_id_name_manager.h"
14 #include "base/threading/thread_local.h" 13 #include "base/threading/thread_local.h"
15 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
16 15
17 #if defined(OS_WIN) 16 #if defined(OS_WIN)
18 #include "base/win/scoped_com_initializer.h" 17 #include "base/win/scoped_com_initializer.h"
19 #endif 18 #endif
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // We should only be called on the same thread that started us. 155 // We should only be called on the same thread that started us.
157 156
158 // Reading thread_id_ without a lock can lead to a benign data race 157 // Reading thread_id_ without a lock can lead to a benign data race
159 // with ThreadMain, so we annotate it to stay silent under ThreadSanitizer. 158 // with ThreadMain, so we annotate it to stay silent under ThreadSanitizer.
160 DCHECK_NE(ANNOTATE_UNPROTECTED_READ(thread_id_), PlatformThread::CurrentId()); 159 DCHECK_NE(ANNOTATE_UNPROTECTED_READ(thread_id_), PlatformThread::CurrentId());
161 160
162 if (stopping_ || !message_loop_) 161 if (stopping_ || !message_loop_)
163 return; 162 return;
164 163
165 stopping_ = true; 164 stopping_ = true;
166 task_runner()->PostTask(FROM_HERE, base::Bind(&ThreadQuitHelper)); 165 message_loop_->PostTask(FROM_HERE, base::Bind(&ThreadQuitHelper));
167 } 166 }
168 167
169 bool Thread::IsRunning() const { 168 bool Thread::IsRunning() const {
170 return running_; 169 return running_;
171 } 170 }
172 171
173 void Thread::SetPriority(ThreadPriority priority) { 172 void Thread::SetPriority(ThreadPriority priority) {
174 // The thread must be started (and id known) for this to be 173 // The thread must be started (and id known) for this to be
175 // compatible with all platforms. 174 // compatible with all platforms.
176 DCHECK_NE(thread_id_, kInvalidThreadId); 175 DCHECK_NE(thread_id_, kInvalidThreadId);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 243
245 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. 244 // Assert that MessageLoop::Quit was called by ThreadQuitHelper.
246 DCHECK(GetThreadWasQuitProperly()); 245 DCHECK(GetThreadWasQuitProperly());
247 246
248 // We can't receive messages anymore. 247 // We can't receive messages anymore.
249 message_loop_ = NULL; 248 message_loop_ = NULL;
250 } 249 }
251 } 250 }
252 251
253 } // namespace base 252 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/thread.h ('k') | base/threading/thread_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698