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

Unified Diff: base/threading/worker_pool_posix.cc

Issue 1886453003: Make PendingTask move-only and pass it by value on retaining params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac test fix Created 4 years, 5 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/pending_task.cc ('k') | components/scheduler/base/task_queue_impl.h » ('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 dcebe0ab7d2fb704d118a6f797a272ef6c1c0aeb..b0a2b87157a8c38add6bf5bec37236a5d53ab16e 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -150,8 +150,7 @@ void PosixDynamicThreadPool::AddTask(PendingTask* pending_task) {
DCHECK(!terminated_)
<< "This thread pool is already terminated. Do not post new tasks.";
- pending_tasks_.push(*pending_task);
- pending_task->task.Reset();
+ pending_tasks_.push(std::move(*pending_task));
// We have enough worker threads.
if (static_cast<size_t>(num_idle_threads_) >= pending_tasks_.size()) {
@@ -186,7 +185,7 @@ PendingTask PosixDynamicThreadPool::WaitForTask() {
}
}
- PendingTask pending_task = pending_tasks_.front();
+ PendingTask pending_task = std::move(pending_tasks_.front());
pending_tasks_.pop();
return pending_task;
}
« no previous file with comments | « base/pending_task.cc ('k') | components/scheduler/base/task_queue_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698