Commit e8faae72 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[platform] Add TaskRunner::PostNonNestableTask

The API will be used to post GC tasks that benefit from being executed
at top level.

Bug: chromium:843903
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I062855e810ca9a8d8af8ae8b66e02c85e108798b
Reviewed-on: https://chromium-review.googlesource.com/c/1273045Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56528}
parent 2148d827
...@@ -53,6 +53,15 @@ class TaskRunner { ...@@ -53,6 +53,15 @@ class TaskRunner {
*/ */
virtual void PostTask(std::unique_ptr<Task> task) = 0; virtual void PostTask(std::unique_ptr<Task> task) = 0;
/**
* Schedules a task to be invoked by this TaskRunner. The TaskRunner
* implementation takes ownership of |task|. The |task| cannot be nested
* within other task executions.
*
* Requires that |TaskRunner::NonNestableTasksEnabled()| is true.
*/
virtual void PostNonNestableTask(std::unique_ptr<Task> task) {}
/** /**
* Schedules a task to be invoked by this TaskRunner. The task is scheduled * Schedules a task to be invoked by this TaskRunner. The task is scheduled
* after the given number of seconds |delay_in_seconds|. The TaskRunner * after the given number of seconds |delay_in_seconds|. The TaskRunner
...@@ -64,7 +73,7 @@ class TaskRunner { ...@@ -64,7 +73,7 @@ class TaskRunner {
/** /**
* Schedules an idle task to be invoked by this TaskRunner. The task is * Schedules an idle task to be invoked by this TaskRunner. The task is
* scheduled when the embedder is idle. Requires that * scheduled when the embedder is idle. Requires that
* TaskRunner::SupportsIdleTasks(isolate) is true. Idle tasks may be reordered * |TaskRunner::IdleTasksEnabled()| is true. Idle tasks may be reordered
* relative to other task types and may be starved for an arbitrarily long * relative to other task types and may be starved for an arbitrarily long
* time if no idle time is available. The TaskRunner implementation takes * time if no idle time is available. The TaskRunner implementation takes
* ownership of |task|. * ownership of |task|.
...@@ -76,6 +85,11 @@ class TaskRunner { ...@@ -76,6 +85,11 @@ class TaskRunner {
*/ */
virtual bool IdleTasksEnabled() = 0; virtual bool IdleTasksEnabled() = 0;
/**
* Returns true if non-nestable tasks are enabled for this TaskRunner.
*/
virtual bool NonNestableTasksEnabled() const { return false; }
TaskRunner() = default; TaskRunner() = default;
virtual ~TaskRunner() = default; virtual ~TaskRunner() = default;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment