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

Side by Side Diff: base/task_scheduler/scheduler_worker.cc

Issue 2781933003: Change SchedulerWorker::ShouldExit Checks Ordering (Closed)
Patch Set: Fix Wording Created 3 years, 8 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 | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/task_scheduler/scheduler_worker.h" 5 #include "base/task_scheduler/scheduler_worker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void SchedulerWorker::CreateThread() { 324 void SchedulerWorker::CreateThread() {
325 thread_ = Thread::Create(make_scoped_refptr(this)); 325 thread_ = Thread::Create(make_scoped_refptr(this));
326 } 326 }
327 327
328 void SchedulerWorker::CreateThreadAssertSynchronized() { 328 void SchedulerWorker::CreateThreadAssertSynchronized() {
329 thread_lock_.AssertAcquired(); 329 thread_lock_.AssertAcquired();
330 CreateThread(); 330 CreateThread();
331 } 331 }
332 332
333 bool SchedulerWorker::ShouldExit() { 333 bool SchedulerWorker::ShouldExit() {
334 return task_tracker_->IsShutdownComplete() || 334 // The ordering of the checks is important below. This SchedulerWorker may be
335 join_called_for_testing_.IsSet() || should_exit_.IsSet(); 335 // released and outlive task_tracker_ in unit tests. However, when the
fdoray 2017/03/29 12:16:32 |task_tracker_|
robliao 2017/03/29 17:30:27 Done.
336 // SchedulerWorker is released, |should_exit_| will be set, so check that
337 // first.
338 return should_exit_.IsSet() || join_called_for_testing_.IsSet() ||
339 task_tracker_->IsShutdownComplete();
336 } 340 }
337 341
338 } // namespace internal 342 } // namespace internal
339 } // namespace base 343 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698