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