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); | |
813 int new_thread_id = WillRunWorkerTask(task); | 812 int new_thread_id = WillRunWorkerTask(task); |
814 { | 813 { |
815 AutoUnlock unlock(lock_); | 814 AutoUnlock unlock(lock_); |
816 // There may be more work available, so wake up another | 815 // There may be more work available, so wake up another |
817 // worker thread. (Technically not required, since we | 816 // worker thread. (Technically not required, since we |
818 // already get a signal for each new task, but it doesn't | 817 // already get a signal for each new task, but it doesn't |
819 // hurt.) | 818 // hurt.) |
820 SignalHasWork(); | 819 SignalHasWork(); |
821 delete_these_outside_lock.clear(); | 820 delete_these_outside_lock.clear(); |
822 | 821 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { | 1395 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { |
1397 DCHECK(constructor_task_runner_->BelongsToCurrentThread()); | 1396 DCHECK(constructor_task_runner_->BelongsToCurrentThread()); |
1398 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); | 1397 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); |
1399 } | 1398 } |
1400 | 1399 |
1401 bool SequencedWorkerPool::IsShutdownInProgress() { | 1400 bool SequencedWorkerPool::IsShutdownInProgress() { |
1402 return inner_->IsShutdownInProgress(); | 1401 return inner_->IsShutdownInProgress(); |
1403 } | 1402 } |
1404 | 1403 |
1405 } // namespace base | 1404 } // namespace base |
OLD | NEW |