| 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.h" | 5 #include "base/threading/worker_pool.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/pending_task.h" | 10 #include "base/pending_task.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 g_worker_pool_running_on_this_thread.Get().Set(true); | 30 g_worker_pool_running_on_this_thread.Get().Set(true); |
| 31 | 31 |
| 32 tracked_objects::TaskStopwatch stopwatch; | 32 tracked_objects::TaskStopwatch stopwatch; |
| 33 stopwatch.Start(); | 33 stopwatch.Start(); |
| 34 pending_task->task.Run(); | 34 pending_task->task.Run(); |
| 35 stopwatch.Stop(); | 35 stopwatch.Stop(); |
| 36 | 36 |
| 37 g_worker_pool_running_on_this_thread.Get().Set(false); | 37 g_worker_pool_running_on_this_thread.Get().Set(false); |
| 38 | 38 |
| 39 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( | 39 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( |
| 40 pending_task->birth_tally, pending_task->time_posted, stopwatch); | 40 pending_task->time_posted, stopwatch, pending_task->birth_tally); |
| 41 | 41 |
| 42 delete pending_task; | 42 delete pending_task; |
| 43 return 0; | 43 return 0; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Takes ownership of |pending_task| | 46 // Takes ownership of |pending_task| |
| 47 bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) { | 47 bool PostTaskInternal(PendingTask* pending_task, bool task_is_slow) { |
| 48 ULONG flags = 0; | 48 ULONG flags = 0; |
| 49 if (task_is_slow) | 49 if (task_is_slow) |
| 50 flags |= WT_EXECUTELONGFUNCTION; | 50 flags |= WT_EXECUTELONGFUNCTION; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 PendingTask* pending_task = new PendingTask(from_here, task); | 66 PendingTask* pending_task = new PendingTask(from_here, task); |
| 67 return PostTaskInternal(pending_task, task_is_slow); | 67 return PostTaskInternal(pending_task, task_is_slow); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 bool WorkerPool::RunsTasksOnCurrentThread() { | 71 bool WorkerPool::RunsTasksOnCurrentThread() { |
| 72 return g_worker_pool_running_on_this_thread.Get().Get(); | 72 return g_worker_pool_running_on_this_thread.Get().Get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace base | 75 } // namespace base |
| OLD | NEW |