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/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 std::vector<Closure> delete_these_outside_lock; | 805 std::vector<Closure> delete_these_outside_lock; |
806 GetWorkStatus status = | 806 GetWorkStatus status = |
807 GetWork(&task, &wait_time, &delete_these_outside_lock); | 807 GetWork(&task, &wait_time, &delete_these_outside_lock); |
808 if (status == GET_WORK_FOUND) { | 808 if (status == GET_WORK_FOUND) { |
809 TRACE_EVENT_WITH_FLOW2(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), | 809 TRACE_EVENT_WITH_FLOW2(TRACE_DISABLED_BY_DEFAULT("toplevel.flow"), |
810 "SequencedWorkerPool::Inner::ThreadLoop", | 810 "SequencedWorkerPool::Inner::ThreadLoop", |
811 TRACE_ID_MANGLE(GetTaskTraceID(task, static_cast<void*>(this))), | 811 TRACE_ID_MANGLE(GetTaskTraceID(task, static_cast<void*>(this))), |
812 TRACE_EVENT_FLAG_FLOW_IN, | 812 TRACE_EVENT_FLAG_FLOW_IN, |
813 "src_file", task.posted_from.file_name(), | 813 "src_file", task.posted_from.file_name(), |
814 "src_func", task.posted_from.function_name()); | 814 "src_func", task.posted_from.function_name()); |
| 815 TRACE_TASK_EXECUTION("SequencedWorkerPool::Inner::ThreadLoop", task); |
815 int new_thread_id = WillRunWorkerTask(task); | 816 int new_thread_id = WillRunWorkerTask(task); |
816 { | 817 { |
817 AutoUnlock unlock(lock_); | 818 AutoUnlock unlock(lock_); |
818 // There may be more work available, so wake up another | 819 // There may be more work available, so wake up another |
819 // worker thread. (Technically not required, since we | 820 // worker thread. (Technically not required, since we |
820 // already get a signal for each new task, but it doesn't | 821 // already get a signal for each new task, but it doesn't |
821 // hurt.) | 822 // hurt.) |
822 SignalHasWork(); | 823 SignalHasWork(); |
823 delete_these_outside_lock.clear(); | 824 delete_these_outside_lock.clear(); |
824 | 825 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { | 1399 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { |
1399 DCHECK(constructor_task_runner_->BelongsToCurrentThread()); | 1400 DCHECK(constructor_task_runner_->BelongsToCurrentThread()); |
1400 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); | 1401 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); |
1401 } | 1402 } |
1402 | 1403 |
1403 bool SequencedWorkerPool::IsShutdownInProgress() { | 1404 bool SequencedWorkerPool::IsShutdownInProgress() { |
1404 return inner_->IsShutdownInProgress(); | 1405 return inner_->IsShutdownInProgress(); |
1405 } | 1406 } |
1406 | 1407 |
1407 } // namespace base | 1408 } // namespace base |
OLD | NEW |