Commit d342122f authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Use non-nestable delayed tasks in incremental marking job

Bug: chromium:926189
Change-Id: Ibd90f3cfdb37f07f3668f9ad79cff6e4305dc874
Reviewed-on: https://chromium-review.googlesource.com/c/1477674Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59688}
parent decf7c77
...@@ -70,6 +70,17 @@ class TaskRunner { ...@@ -70,6 +70,17 @@ class TaskRunner {
virtual void PostDelayedTask(std::unique_ptr<Task> task, virtual void PostDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) = 0; double delay_in_seconds) = 0;
/**
* Schedules a task to be invoked by this TaskRunner. The task is scheduled
* after the given number of seconds |delay_in_seconds|. The TaskRunner
* implementation takes ownership of |task|. The |task| cannot be nested
* within other task executions.
*
* Requires that |TaskRunner::NonNestableDelayedTasksEnabled()| is true.
*/
virtual void PostNonNestableDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) {}
/** /**
* 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
...@@ -90,6 +101,11 @@ class TaskRunner { ...@@ -90,6 +101,11 @@ class TaskRunner {
*/ */
virtual bool NonNestableTasksEnabled() const { return false; } virtual bool NonNestableTasksEnabled() const { return false; }
/**
* Returns true if non-nestable delayed tasks are enabled for this TaskRunner.
*/
virtual bool NonNestableDelayedTasksEnabled() const { return false; }
TaskRunner() = default; TaskRunner() = default;
virtual ~TaskRunner() = default; virtual ~TaskRunner() = default;
......
...@@ -62,6 +62,13 @@ void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) { ...@@ -62,6 +62,13 @@ void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) {
heap->isolate(), this, heap->isolate(), this,
EmbedderHeapTracer::EmbedderStackState::kUnknown, task_type)); EmbedderHeapTracer::EmbedderStackState::kUnknown, task_type));
} }
} else {
if (taskrunner->NonNestableDelayedTasksEnabled()) {
taskrunner->PostNonNestableDelayedTask(
base::make_unique<Task>(
heap->isolate(), this,
EmbedderHeapTracer::EmbedderStackState::kEmpty, task_type),
kDelayInSeconds);
} else { } else {
taskrunner->PostDelayedTask( taskrunner->PostDelayedTask(
base::make_unique<Task>( base::make_unique<Task>(
...@@ -70,6 +77,7 @@ void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) { ...@@ -70,6 +77,7 @@ void IncrementalMarkingJob::ScheduleTask(Heap* heap, TaskType task_type) {
kDelayInSeconds); kDelayInSeconds);
} }
} }
}
} }
StepResult IncrementalMarkingJob::Task::Step( StepResult IncrementalMarkingJob::Task::Step(
......
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