Commit 5cea1b0c authored by fdoray's avatar fdoray Committed by Commit bot

Forward return value of PostTaskToTaskScheduler() to PostTask() in SequencedWorkerPool.

With this CL, SequencedWorkerPool::Inner::PostTask (and hence all task
posting APIs associated with SequencedWorkerPool) returns false when
redirection to TaskScheduler is enabled and the posted task definitely
will not run.

BUG=622400

Review-Url: https://codereview.chromium.org/2346823002
Cr-Commit-Position: refs/heads/master@{#418939}
parent 64bf38de
...@@ -381,8 +381,10 @@ class SequencedWorkerPool::Inner { ...@@ -381,8 +381,10 @@ class SequencedWorkerPool::Inner {
}; };
// Helper used by PostTask() to complete the work when redirection is on. // Helper used by PostTask() to complete the work when redirection is on.
// Returns true if the task may run at some point in the future and false if
// it will definitely not run.
// Coalesce upon resolution of http://crbug.com/622400. // Coalesce upon resolution of http://crbug.com/622400.
void PostTaskToTaskScheduler(const SequencedTask& sequenced, bool PostTaskToTaskScheduler(const SequencedTask& sequenced,
const TimeDelta& delay); const TimeDelta& delay);
// Returns the TaskScheduler TaskRunner for the specified |sequence_token_id| // Returns the TaskScheduler TaskRunner for the specified |sequence_token_id|
...@@ -731,7 +733,8 @@ bool SequencedWorkerPool::Inner::PostTask( ...@@ -731,7 +733,8 @@ bool SequencedWorkerPool::Inner::PostTask(
if (subtle::NoBarrier_Load(&g_all_pools_state) == if (subtle::NoBarrier_Load(&g_all_pools_state) ==
AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) { AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) {
PostTaskToTaskScheduler(sequenced, delay); if (!PostTaskToTaskScheduler(sequenced, delay))
return false;
} else { } else {
pending_tasks_.insert(sequenced); pending_tasks_.insert(sequenced);
...@@ -770,7 +773,7 @@ bool SequencedWorkerPool::Inner::PostTask( ...@@ -770,7 +773,7 @@ bool SequencedWorkerPool::Inner::PostTask(
return true; return true;
} }
void SequencedWorkerPool::Inner::PostTaskToTaskScheduler( bool SequencedWorkerPool::Inner::PostTaskToTaskScheduler(
const SequencedTask& sequenced, const SequencedTask& sequenced,
const TimeDelta& delay) { const TimeDelta& delay) {
DCHECK_EQ(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER, DCHECK_EQ(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER,
...@@ -800,7 +803,7 @@ void SequencedWorkerPool::Inner::PostTaskToTaskScheduler( ...@@ -800,7 +803,7 @@ void SequencedWorkerPool::Inner::PostTaskToTaskScheduler(
.WithFileIO() .WithFileIO()
.WithPriority(task_priority_) .WithPriority(task_priority_)
.WithShutdownBehavior(task_shutdown_behavior); .WithShutdownBehavior(task_shutdown_behavior);
GetTaskSchedulerTaskRunner(sequenced.sequence_token_id, traits) return GetTaskSchedulerTaskRunner(sequenced.sequence_token_id, traits)
->PostDelayedTask(sequenced.posted_from, sequenced.task, delay); ->PostDelayedTask(sequenced.posted_from, sequenced.task, delay);
} }
......
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