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

Unified Diff: base/task_scheduler/task_tracker.h

Issue 2019763002: TaskScheduler: Atomic operations in TaskTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/task_scheduler/task_tracker.cc » ('j') | base/task_scheduler/task_tracker.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_tracker.h
diff --git a/base/task_scheduler/task_tracker.h b/base/task_scheduler/task_tracker.h
index 795ae4937058d0a8f24719b9ae0edfa3641e0b5f..b0bce5d50f0277e59ab105b0f2f3cdd08191ce1f 100644
--- a/base/task_scheduler/task_tracker.h
+++ b/base/task_scheduler/task_tracker.h
@@ -54,6 +54,8 @@ class BASE_EXPORT TaskTracker {
}
private:
+ class State;
+
// Called before WillPostTask() informs the tracing system that a task has
// been posted. Updates |num_tasks_blocking_shutdown_| if necessary and
// returns true if the current shutdown state allows the task to be posted.
@@ -69,16 +71,22 @@ class BASE_EXPORT TaskTracker {
// necessary.
void AfterRunTask(TaskShutdownBehavior shutdown_behavior);
- // Synchronizes access to all members.
+ // Called when the number of tasks blocking shutdown becomes zero after
+ // shutdown has started.
+ void OnNumTasksBlockingShutdownIsZero();
robliao 2016/05/27 22:16:14 Alternately OnBlockingShutdownTasksComplete
fdoray 2016/05/30 15:48:05 Done.
+
+ // Number of tasks blocking shutdown and boolean indicating whether shutdown
+ // has started.
+ const std::unique_ptr<State> state_;
+
+ // Synchronizes access to all members below.
mutable SchedulerLock lock_;
- // Condition variable signaled when |num_tasks_blocking_shutdown_| reaches
- // zero while shutdown is in progress. Null if shutdown isn't in progress.
+ // Condition variable signaled when the number of tasks blocking shutdown
+ // reaches zero while shutdown is in progress. Null if shutdown isn't in
+ // progress.
std::unique_ptr<ConditionVariable> shutdown_cv_;
- // Number of tasks blocking shutdown.
- size_t num_tasks_blocking_shutdown_ = 0;
-
// Number of BLOCK_SHUTDOWN tasks posted during shutdown.
HistogramBase::Sample num_block_shutdown_tasks_posted_during_shutdown_ = 0;
« no previous file with comments | « no previous file | base/task_scheduler/task_tracker.cc » ('j') | base/task_scheduler/task_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698