| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run", | 87 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run", |
| 88 "src_file", pending_task.posted_from.file_name(), | 88 "src_file", pending_task.posted_from.file_name(), |
| 89 "src_func", pending_task.posted_from.function_name()); | 89 "src_func", pending_task.posted_from.function_name()); |
| 90 | 90 |
| 91 #if defined(TRACK_ALL_TASK_OBJECTS) | 91 #if defined(TRACK_ALL_TASK_OBJECTS) |
| 92 TimeTicks start_of_run = tracked_objects::ThreadData::Now(); | 92 TimeTicks start_of_run = tracked_objects::ThreadData::Now(); |
| 93 #endif // defined(TRACK_ALL_TASK_OBJECTS) | 93 #endif // defined(TRACK_ALL_TASK_OBJECTS) |
| 94 pending_task.task.Run(); | 94 pending_task.task.Run(); |
| 95 #if defined(TRACK_ALL_TASK_OBJECTS) | 95 #if defined(TRACK_ALL_TASK_OBJECTS) |
| 96 tracked_objects::ThreadData::TallyADeathIfActive(pending_task.post_births, | 96 tracked_objects::ThreadData::TallyADeathIfActive(pending_task.post_births, |
| 97 pending_task.time_posted, TimeTicks(), start_of_run); | 97 pending_task.time_posted, TimeTicks(), start_of_run, |
| 98 tracked_objects::ThreadData::Now()); |
| 98 #endif // defined(TRACK_ALL_TASK_OBJECTS) | 99 #endif // defined(TRACK_ALL_TASK_OBJECTS) |
| 99 } | 100 } |
| 100 | 101 |
| 101 // The WorkerThread is non-joinable, so it deletes itself. | 102 // The WorkerThread is non-joinable, so it deletes itself. |
| 102 delete this; | 103 delete this; |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace | 106 } // namespace |
| 106 | 107 |
| 107 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, | 108 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return PendingTask(FROM_HERE, base::Closure()); | 220 return PendingTask(FROM_HERE, base::Closure()); |
| 220 } | 221 } |
| 221 } | 222 } |
| 222 | 223 |
| 223 PendingTask pending_task = pending_tasks_.front(); | 224 PendingTask pending_task = pending_tasks_.front(); |
| 224 pending_tasks_.pop(); | 225 pending_tasks_.pop(); |
| 225 return pending_task; | 226 return pending_task; |
| 226 } | 227 } |
| 227 | 228 |
| 228 } // namespace base | 229 } // namespace base |
| OLD | NEW |