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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 2346823002: Forward return value of PostTaskToTaskScheduler() to PostTask() in SequencedWorkerPool. (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index 1f461c10d3ca101ff416dc6b32033baebef475bd..eea7afd738a679d854a600985f95e2e438d3d33a 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -381,8 +381,10 @@ class SequencedWorkerPool::Inner {
};
// 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.
- void PostTaskToTaskScheduler(const SequencedTask& sequenced,
+ bool PostTaskToTaskScheduler(const SequencedTask& sequenced,
const TimeDelta& delay);
// Returns the TaskScheduler TaskRunner for the specified |sequence_token_id|
@@ -731,7 +733,8 @@ bool SequencedWorkerPool::Inner::PostTask(
if (subtle::NoBarrier_Load(&g_all_pools_state) ==
AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER) {
- PostTaskToTaskScheduler(sequenced, delay);
+ if (!PostTaskToTaskScheduler(sequenced, delay))
+ return false;
} else {
pending_tasks_.insert(sequenced);
@@ -770,7 +773,7 @@ bool SequencedWorkerPool::Inner::PostTask(
return true;
}
-void SequencedWorkerPool::Inner::PostTaskToTaskScheduler(
+bool SequencedWorkerPool::Inner::PostTaskToTaskScheduler(
const SequencedTask& sequenced,
const TimeDelta& delay) {
DCHECK_EQ(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER,
@@ -800,7 +803,7 @@ void SequencedWorkerPool::Inner::PostTaskToTaskScheduler(
.WithFileIO()
.WithPriority(task_priority_)
.WithShutdownBehavior(task_shutdown_behavior);
- GetTaskSchedulerTaskRunner(sequenced.sequence_token_id, traits)
+ return GetTaskSchedulerTaskRunner(sequenced.sequence_token_id, traits)
->PostDelayedTask(sequenced.posted_from, sequenced.task, delay);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698