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

Unified Diff: base/task_scheduler/task_tracker.h

Issue 1862113002: TaskScheduler: Don't use a callback to post a task from TaskTracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread_unittest.cc ('k') | base/task_scheduler/task_tracker.cc » ('j') | no next file with comments »
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 811bd9a136c3c47064c483a82dc04933ab56d569..5bada90dde211c052237409a0646992493ddb54b 100644
--- a/base/task_scheduler/task_tracker.h
+++ b/base/task_scheduler/task_tracker.h
@@ -35,14 +35,12 @@ class BASE_EXPORT TaskTracker {
// This must only be called once.
void Shutdown();
- // Posts |task| by calling |post_task_callback| unless the current shutdown
- // state prevents that. A task forwarded to |post_task_callback| must be
- // handed back to this instance's RunTask() when it is to be executed.
- void PostTask(const Callback<void(std::unique_ptr<Task>)>& post_task_callback,
- std::unique_ptr<Task> task);
-
- // Runs |task| unless the current shutdown state prevents that. |task| must
- // have been successfully posted via PostTask() first.
+ // Informs this TaskTracker that |task| is about to be posted. Returns true if
+ // this operation is allowed (|task| should be posted if-and-only-if it is).
+ bool WillPostTask(const Task* task);
+
+ // Runs |task| unless the current shutdown state prevents that. WillPostTask()
+ // must have allowed |task| to be posted.
void RunTask(const Task* task);
// Returns true while shutdown is in progress (i.e. Shutdown() has been called
@@ -55,10 +53,9 @@ class BASE_EXPORT TaskTracker {
}
private:
- // Called before a task with |shutdown_behavior| is handed off to
- // |post_task_callback| by PostTask(). Updates |num_tasks_blocking_shutdown_|
- // if necessary and returns true if the current shutdown state allows the task
- // to be posted.
+ // 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.
bool BeforePostTask(TaskShutdownBehavior shutdown_behavior);
// Called before a task with |shutdown_behavior| is run by RunTask(). Updates
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread_unittest.cc ('k') | base/task_scheduler/task_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698