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

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

Issue 2857103005: Exempt the Service Thread from BLOCK_SHUTDOWN DCHECKs (Closed)
Patch Set: CR Feedback Created 3 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') | no next file » | 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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 owning_sequence_checker_.DetachFromSequence(); 218 owning_sequence_checker_.DetachFromSequence();
219 } 219 }
220 220
221 PlatformThreadId Thread::GetThreadId() const { 221 PlatformThreadId Thread::GetThreadId() const {
222 // If the thread is created but not started yet, wait for |id_| being ready. 222 // If the thread is created but not started yet, wait for |id_| being ready.
223 base::ThreadRestrictions::ScopedAllowWait allow_wait; 223 base::ThreadRestrictions::ScopedAllowWait allow_wait;
224 id_event_.Wait(); 224 id_event_.Wait();
225 return id_; 225 return id_;
226 } 226 }
227 227
228 PlatformThreadHandle Thread::GetThreadHandle() const {
229 AutoLock lock(thread_lock_);
230 return thread_;
231 }
232
228 bool Thread::IsRunning() const { 233 bool Thread::IsRunning() const {
229 // TODO(gab): Fix improper usage of this API (http://crbug.com/629139) and 234 // TODO(gab): Fix improper usage of this API (http://crbug.com/629139) and
230 // enable this check. 235 // enable this check.
231 // DCHECK(owning_sequence_checker_.CalledOnValidSequence()); 236 // DCHECK(owning_sequence_checker_.CalledOnValidSequence());
232 237
233 // If the thread's already started (i.e. |message_loop_| is non-null) and not 238 // If the thread's already started (i.e. |message_loop_| is non-null) and not
234 // yet requested to stop (i.e. |stopping_| is false) we can just return true. 239 // yet requested to stop (i.e. |stopping_| is false) we can just return true.
235 // (Note that |stopping_| is touched only on the same sequence that starts / 240 // (Note that |stopping_| is touched only on the same sequence that starts /
236 // started the new thread so we need no locking here.) 241 // started the new thread so we need no locking here.)
237 if (message_loop_ && !stopping_) 242 if (message_loop_ && !stopping_)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 run_loop_ = nullptr; 362 run_loop_ = nullptr;
358 } 363 }
359 364
360 void Thread::ThreadQuitHelper() { 365 void Thread::ThreadQuitHelper() {
361 DCHECK(run_loop_); 366 DCHECK(run_loop_);
362 run_loop_->QuitWhenIdle(); 367 run_loop_->QuitWhenIdle();
363 SetThreadWasQuitProperly(true); 368 SetThreadWasQuitProperly(true);
364 } 369 }
365 370
366 } // namespace base 371 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698