| 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.h" | 5 #include "base/threading/worker_pool.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 UNSHIPPED_TRACE_EVENT2("task", "WorkItemCallback::Run", | 46 UNSHIPPED_TRACE_EVENT2("task", "WorkItemCallback::Run", |
| 47 "src_file", pending_task->posted_from.file_name(), | 47 "src_file", pending_task->posted_from.file_name(), |
| 48 "src_func", pending_task->posted_from.function_name()); | 48 "src_func", pending_task->posted_from.function_name()); |
| 49 | 49 |
| 50 #if defined(TRACK_ALL_TASK_OBJECTS) | 50 #if defined(TRACK_ALL_TASK_OBJECTS) |
| 51 TimeTicks start_of_run = tracked_objects::ThreadData::Now(); | 51 TimeTicks start_of_run = tracked_objects::ThreadData::Now(); |
| 52 #endif // defined(TRACK_ALL_TASK_OBJECTS) | 52 #endif // defined(TRACK_ALL_TASK_OBJECTS) |
| 53 pending_task->task.Run(); | 53 pending_task->task.Run(); |
| 54 #if defined(TRACK_ALL_TASK_OBJECTS) | 54 #if defined(TRACK_ALL_TASK_OBJECTS) |
| 55 tracked_objects::ThreadData::TallyADeathIfActive(pending_task->post_births, | 55 tracked_objects::ThreadData::TallyADeathIfActive(pending_task->post_births, |
| 56 pending_task->time_posted, TimeTicks::TimeTicks(), start_of_run); | 56 pending_task->time_posted, TimeTicks::TimeTicks(), start_of_run, |
| 57 tracked_objects::ThreadData::Now()); |
| 57 #endif // defined(TRACK_ALL_TASK_OBJECTS) | 58 #endif // defined(TRACK_ALL_TASK_OBJECTS) |
| 58 | 59 |
| 59 delete pending_task; | 60 delete pending_task; |
| 60 return 0; | 61 return 0; |
| 61 } | 62 } |
| 62 | 63 |
| 63 // Takes ownership of |pending_task| | 64 // Takes ownership of |pending_task| |
| 64 bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) { | 65 bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) { |
| 65 ULONG flags = 0; | 66 ULONG flags = 0; |
| 66 if (task_is_slow) | 67 if (task_is_slow) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 86 return PostTaskInternal(pending_task, task_is_slow); | 87 return PostTaskInternal(pending_task, task_is_slow); |
| 87 } | 88 } |
| 88 | 89 |
| 89 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, | 90 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, |
| 90 const base::Closure& task, bool task_is_slow) { | 91 const base::Closure& task, bool task_is_slow) { |
| 91 PendingTask* pending_task = new PendingTask(from_here, task); | 92 PendingTask* pending_task = new PendingTask(from_here, task); |
| 92 return PostTaskInternal(pending_task, task_is_slow); | 93 return PostTaskInternal(pending_task, task_is_slow); |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace base | 96 } // namespace base |
| OLD | NEW |