| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 for (;;) { | 87 for (;;) { |
| 88 PendingTask pending_task = pool_->WaitForTask(); | 88 PendingTask pending_task = pool_->WaitForTask(); |
| 89 if (pending_task.task.is_null()) | 89 if (pending_task.task.is_null()) |
| 90 break; | 90 break; |
| 91 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run", | 91 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run", |
| 92 "src_file", pending_task.posted_from.file_name(), | 92 "src_file", pending_task.posted_from.file_name(), |
| 93 "src_func", pending_task.posted_from.function_name()); | 93 "src_func", pending_task.posted_from.function_name()); |
| 94 | 94 |
| 95 TrackedTime start_time = | 95 TrackedTime start_time = |
| 96 tracked_objects::ThreadData::NowForStartOfRun(); | 96 tracked_objects::ThreadData::NowForStartOfRun(pending_task.birth_tally); |
| 97 | 97 |
| 98 pending_task.task.Run(); | 98 pending_task.task.Run(); |
| 99 | 99 |
| 100 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( | 100 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( |
| 101 pending_task.birth_tally, TrackedTime(pending_task.time_posted), | 101 pending_task.birth_tally, TrackedTime(pending_task.time_posted), |
| 102 start_time, tracked_objects::ThreadData::NowForEndOfRun()); | 102 start_time, tracked_objects::ThreadData::NowForEndOfRun()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // The WorkerThread is non-joinable, so it deletes itself. | 105 // The WorkerThread is non-joinable, so it deletes itself. |
| 106 delete this; | 106 delete this; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return PendingTask(FROM_HERE, base::Closure()); | 207 return PendingTask(FROM_HERE, base::Closure()); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 PendingTask pending_task = pending_tasks_.front(); | 211 PendingTask pending_task = pending_tasks_.front(); |
| 212 pending_tasks_.pop(); | 212 pending_tasks_.pop(); |
| 213 return pending_task; | 213 return pending_task; |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace base | 216 } // namespace base |
| OLD | NEW |