Index: content/renderer/categorized_worker_pool.cc |
diff --git a/content/renderer/categorized_worker_pool.cc b/content/renderer/categorized_worker_pool.cc |
index 47298b3b8ecd11ade943fabbcff164a0f925baf3..0927573f9589efe4178543638aba1f7fe617ab50 100644 |
--- a/content/renderer/categorized_worker_pool.cc |
+++ b/content/renderer/categorized_worker_pool.cc |
@@ -53,15 +53,15 @@ class CategorizedWorkerPool::CategorizedWorkerPoolSequencedTaskRunner |
// Overridden from base::TaskRunner: |
bool PostDelayedTask(const tracked_objects::Location& from_here, |
- const base::Closure& task, |
+ base::OnceClosure task, |
base::TimeDelta delay) override { |
- return PostNonNestableDelayedTask(from_here, task, delay); |
+ return PostNonNestableDelayedTask(from_here, std::move(task), delay); |
} |
bool RunsTasksOnCurrentThread() const override { return true; } |
// Overridden from base::SequencedTaskRunner: |
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
- const base::Closure& task, |
+ base::OnceClosure task, |
base::TimeDelta delay) override { |
base::AutoLock lock(lock_); |
@@ -72,7 +72,7 @@ class CategorizedWorkerPool::CategorizedWorkerPoolSequencedTaskRunner |
tasks_.erase(tasks_.begin(), tasks_.begin() + completed_tasks_.size()); |
- tasks_.push_back(make_scoped_refptr(new ClosureTask(task))); |
+ tasks_.push_back(make_scoped_refptr(new ClosureTask(std::move(task)))); |
graph_.Reset(); |
for (const auto& graph_task : tasks_) { |
int dependencies = 0; |
@@ -186,7 +186,7 @@ void CategorizedWorkerPool::Shutdown() { |
// Overridden from base::TaskRunner: |
bool CategorizedWorkerPool::PostDelayedTask( |
const tracked_objects::Location& from_here, |
- const base::Closure& task, |
+ base::OnceClosure task, |
base::TimeDelta delay) { |
base::AutoLock lock(lock_); |
@@ -202,7 +202,7 @@ bool CategorizedWorkerPool::PostDelayedTask( |
}); |
tasks_.erase(end, tasks_.end()); |
- tasks_.push_back(make_scoped_refptr(new ClosureTask(task))); |
+ tasks_.push_back(make_scoped_refptr(new ClosureTask(std::move(task)))); |
graph_.Reset(); |
for (const auto& graph_task : tasks_) { |
// Delayed tasks are assigned FOREGROUND category, ensuring that they run as |
@@ -415,13 +415,12 @@ void CategorizedWorkerPool::SignalHasReadyToRunTasksWithLockAcquired() { |
} |
} |
-CategorizedWorkerPool::ClosureTask::ClosureTask(const base::Closure& closure) |
- : closure_(closure) {} |
+CategorizedWorkerPool::ClosureTask::ClosureTask(base::OnceClosure closure) |
+ : closure_(std::move(closure)) {} |
// Overridden from cc::Task: |
void CategorizedWorkerPool::ClosureTask::RunOnWorkerThread() { |
- closure_.Run(); |
- closure_.Reset(); |
+ std::move(closure_).Run(); |
} |
CategorizedWorkerPool::ClosureTask::~ClosureTask() {} |