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

Unified Diff: base/task_scheduler/scheduler_worker.cc

Issue 2781933003: Change SchedulerWorker::ShouldExit Checks Ordering (Closed)
Patch Set: Fix Wording Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/scheduler_worker.cc
diff --git a/base/task_scheduler/scheduler_worker.cc b/base/task_scheduler/scheduler_worker.cc
index ec7ff0e3cc75a7505429e7d1dc18509d8695aefc..e6a0f51eba03346834e23edfbd454adc4321d38b 100644
--- a/base/task_scheduler/scheduler_worker.cc
+++ b/base/task_scheduler/scheduler_worker.cc
@@ -331,8 +331,12 @@ void SchedulerWorker::CreateThreadAssertSynchronized() {
}
bool SchedulerWorker::ShouldExit() {
- return task_tracker_->IsShutdownComplete() ||
- join_called_for_testing_.IsSet() || should_exit_.IsSet();
+ // The ordering of the checks is important below. This SchedulerWorker may be
+ // 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.
+ // SchedulerWorker is released, |should_exit_| will be set, so check that
+ // first.
+ return should_exit_.IsSet() || join_called_for_testing_.IsSet() ||
+ task_tracker_->IsShutdownComplete();
}
} // namespace internal
« 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