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

Side by Side Diff: base/threading/worker_pool_posix.cc

Issue 2386653002: Replace base::Callback with base::OnceCallback in base::PendingTask (Closed)
Patch Set: move UnsafeConvertOnceClosureToRepeating Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « base/task_scheduler/task_tracker.cc ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/worker_pool_posix.h" 5 #include "base/threading/worker_pool_posix.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 PlatformThread::SetName(name); 83 PlatformThread::SetName(name);
84 84
85 for (;;) { 85 for (;;) {
86 PendingTask pending_task = pool_->WaitForTask(); 86 PendingTask pending_task = pool_->WaitForTask();
87 if (pending_task.task.is_null()) 87 if (pending_task.task.is_null())
88 break; 88 break;
89 TRACE_TASK_EXECUTION("WorkerThread::ThreadMain::Run", pending_task); 89 TRACE_TASK_EXECUTION("WorkerThread::ThreadMain::Run", pending_task);
90 90
91 tracked_objects::TaskStopwatch stopwatch; 91 tracked_objects::TaskStopwatch stopwatch;
92 stopwatch.Start(); 92 stopwatch.Start();
93 pending_task.task.Run(); 93 std::move(pending_task.task).Run();
94 stopwatch.Stop(); 94 stopwatch.Stop();
95 95
96 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( 96 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking(
97 pending_task.birth_tally, pending_task.time_posted, stopwatch); 97 pending_task.birth_tally, pending_task.time_posted, stopwatch);
98 } 98 }
99 99
100 // The WorkerThread is non-joinable, so it deletes itself. 100 // The WorkerThread is non-joinable, so it deletes itself.
101 delete this; 101 delete this;
102 } 102 }
103 103
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return PendingTask(FROM_HERE, base::Closure()); 184 return PendingTask(FROM_HERE, base::Closure());
185 } 185 }
186 } 186 }
187 187
188 PendingTask pending_task = std::move(pending_tasks_.front()); 188 PendingTask pending_task = std::move(pending_tasks_.front());
189 pending_tasks_.pop(); 189 pending_tasks_.pop();
190 return pending_task; 190 return pending_task;
191 } 191 }
192 192
193 } // namespace base 193 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_tracker.cc ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698