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

Unified Diff: base/threading/worker_pool_posix.cc

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix 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 | « base/threading/worker_pool_posix.h ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/worker_pool_posix.cc
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index b0a2b87157a8c38add6bf5bec37236a5d53ab16e..cc06224bf1bb4a849ff78639dccd4b26f5880364 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -36,7 +36,7 @@ class WorkerPoolImpl {
~WorkerPoolImpl();
void PostTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ OnceClosure task,
bool task_is_slow);
private:
@@ -52,9 +52,9 @@ WorkerPoolImpl::~WorkerPoolImpl() {
}
void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ OnceClosure task,
bool task_is_slow) {
- pool_->PostTask(from_here, task);
+ pool_->PostTask(from_here, std::move(task));
}
base::LazyInstance<WorkerPoolImpl> g_lazy_worker_pool =
@@ -90,7 +90,7 @@ void WorkerThread::ThreadMain() {
tracked_objects::TaskStopwatch stopwatch;
stopwatch.Start();
- pending_task.task.Run();
+ std::move(pending_task.task).Run();
stopwatch.Stop();
tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking(
@@ -105,9 +105,10 @@ void WorkerThread::ThreadMain() {
// static
bool WorkerPool::PostTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
+ OnceClosure task,
bool task_is_slow) {
- g_lazy_worker_pool.Pointer()->PostTask(from_here, task, task_is_slow);
+ g_lazy_worker_pool.Pointer()->PostTask(from_here, std::move(task),
+ task_is_slow);
return true;
}
@@ -140,8 +141,8 @@ void PosixDynamicThreadPool::Terminate() {
void PosixDynamicThreadPool::PostTask(
const tracked_objects::Location& from_here,
- const base::Closure& task) {
- PendingTask pending_task(from_here, task);
+ OnceClosure task) {
+ PendingTask pending_task(from_here, std::move(task));
AddTask(&pending_task);
}
« no previous file with comments | « base/threading/worker_pool_posix.h ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698