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

Unified Diff: base/message_loop/incoming_task_queue.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: disable WorkQueue copy Created 4 years, 8 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 | base/message_loop/message_loop.h » ('j') | base/stl_util.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/incoming_task_queue.cc
diff --git a/base/message_loop/incoming_task_queue.cc b/base/message_loop/incoming_task_queue.cc
index ebecc1ba54ce35df2cfef606eca13c8ed4062569..0034f473485745c6166ab7776919de7c0703da79 100644
--- a/base/message_loop/incoming_task_queue.cc
+++ b/base/message_loop/incoming_task_queue.cc
@@ -97,7 +97,7 @@ int IncomingTaskQueue::ReloadWorkQueue(TaskQueue* work_queue) {
// incoming queue becomes nonempty we need to schedule it again.
message_loop_scheduled_ = false;
} else {
- incoming_queue_.Swap(work_queue);
+ incoming_queue_.swap(*work_queue);
}
// Reset the count of high resolution tasks since our queue is now empty.
int high_res_tasks = high_res_task_count_;
@@ -155,8 +155,7 @@ bool IncomingTaskQueue::PostPendingTask(PendingTask* pending_task) {
*pending_task);
bool was_empty = incoming_queue_.empty();
- incoming_queue_.push(*pending_task);
- pending_task->task.Reset();
+ incoming_queue_.push(std::move(*pending_task));
if (is_ready_for_scheduling_ &&
(always_schedule_work_ || (!message_loop_scheduled_ && was_empty))) {
« no previous file with comments | « no previous file | base/message_loop/message_loop.h » ('j') | base/stl_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698