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 <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 return static_cast<int>(threads_.size() + 1); | 1084 return static_cast<int>(threads_.size() + 1); |
1085 } | 1085 } |
1086 } | 1086 } |
1087 } | 1087 } |
1088 return 0; | 1088 return 0; |
1089 } | 1089 } |
1090 | 1090 |
1091 void SequencedWorkerPool::Inner::FinishStartingAdditionalThread( | 1091 void SequencedWorkerPool::Inner::FinishStartingAdditionalThread( |
1092 int thread_number) { | 1092 int thread_number) { |
1093 // Called outside of the lock. | 1093 // Called outside of the lock. |
1094 DCHECK(thread_number > 0); | 1094 DCHECK_GT(thread_number, 0); |
1095 | 1095 |
1096 // The worker is assigned to the list when the thread actually starts, which | 1096 // The worker is assigned to the list when the thread actually starts, which |
1097 // will manage the memory of the pointer. | 1097 // will manage the memory of the pointer. |
1098 new Worker(worker_pool_, thread_number, thread_name_prefix_); | 1098 new Worker(worker_pool_, thread_number, thread_name_prefix_); |
1099 } | 1099 } |
1100 | 1100 |
1101 void SequencedWorkerPool::Inner::SignalHasWork() { | 1101 void SequencedWorkerPool::Inner::SignalHasWork() { |
1102 has_work_cv_.Signal(); | 1102 has_work_cv_.Signal(); |
1103 if (testing_observer_) { | 1103 if (testing_observer_) { |
1104 testing_observer_->OnHasWork(); | 1104 testing_observer_->OnHasWork(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { | 1275 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { |
1276 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); | 1276 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); |
1277 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); | 1277 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); |
1278 } | 1278 } |
1279 | 1279 |
1280 bool SequencedWorkerPool::IsShutdownInProgress() { | 1280 bool SequencedWorkerPool::IsShutdownInProgress() { |
1281 return inner_->IsShutdownInProgress(); | 1281 return inner_->IsShutdownInProgress(); |
1282 } | 1282 } |
1283 | 1283 |
1284 } // namespace base | 1284 } // namespace base |
OLD | NEW |