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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 84 matching lines...) Loading... |
95 "src_file", pending_task.posted_from.file_name(), | 95 "src_file", pending_task.posted_from.file_name(), |
96 "src_func", pending_task.posted_from.function_name()); | 96 "src_func", pending_task.posted_from.function_name()); |
97 | 97 |
98 tracked_objects::ThreadData::PrepareForStartOfRun(pending_task.birth_tally); | 98 tracked_objects::ThreadData::PrepareForStartOfRun(pending_task.birth_tally); |
99 tracked_objects::TaskStopwatch stopwatch; | 99 tracked_objects::TaskStopwatch stopwatch; |
100 stopwatch.Start(); | 100 stopwatch.Start(); |
101 pending_task.task.Run(); | 101 pending_task.task.Run(); |
102 stopwatch.Stop(); | 102 stopwatch.Stop(); |
103 | 103 |
104 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( | 104 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( |
105 pending_task.birth_tally, TrackedTime(pending_task.time_posted), | 105 pending_task.birth_tally, pending_task.time_posted, stopwatch); |
106 stopwatch); | |
107 } | 106 } |
108 | 107 |
109 // The WorkerThread is non-joinable, so it deletes itself. | 108 // The WorkerThread is non-joinable, so it deletes itself. |
110 delete this; | 109 delete this; |
111 } | 110 } |
112 | 111 |
113 } // namespace | 112 } // namespace |
114 | 113 |
115 // static | 114 // static |
116 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, | 115 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, |
(...skipping 77 matching lines...) Loading... |
194 return PendingTask(FROM_HERE, base::Closure()); | 193 return PendingTask(FROM_HERE, base::Closure()); |
195 } | 194 } |
196 } | 195 } |
197 | 196 |
198 PendingTask pending_task = pending_tasks_.front(); | 197 PendingTask pending_task = pending_tasks_.front(); |
199 pending_tasks_.pop(); | 198 pending_tasks_.pop(); |
200 return pending_task; | 199 return pending_task; |
201 } | 200 } |
202 | 201 |
203 } // namespace base | 202 } // namespace base |
OLD | NEW |