OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |