OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/base/worker_pool.h" | 5 #include "cc/base/worker_pool.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/synchronization/condition_variable.h" | 10 #include "base/synchronization/condition_variable.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 next_thread_index_(0), | 176 next_thread_index_(0), |
177 running_task_count_(0), | 177 running_task_count_(0), |
178 shutdown_(false) { | 178 shutdown_(false) { |
179 base::AutoLock lock(lock_); | 179 base::AutoLock lock(lock_); |
180 | 180 |
181 while (workers_.size() < num_threads) { | 181 while (workers_.size() < num_threads) { |
182 scoped_ptr<base::DelegateSimpleThread> worker = make_scoped_ptr( | 182 scoped_ptr<base::DelegateSimpleThread> worker = make_scoped_ptr( |
183 new base::DelegateSimpleThread( | 183 new base::DelegateSimpleThread( |
184 this, | 184 this, |
185 thread_name_prefix + | 185 thread_name_prefix + |
186 StringPrintf("Worker%lu", workers_.size() + 1).c_str())); | 186 base::StringPrintf("Worker%lu", workers_.size() + 1).c_str())); |
187 worker->Start(); | 187 worker->Start(); |
188 workers_.push_back(worker.Pass()); | 188 workers_.push_back(worker.Pass()); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 WorkerPool::Inner::~Inner() { | 192 WorkerPool::Inner::~Inner() { |
193 base::AutoLock lock(lock_); | 193 base::AutoLock lock(lock_); |
194 | 194 |
195 DCHECK(shutdown_); | 195 DCHECK(shutdown_); |
196 | 196 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time"); | 611 TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time"); |
612 CancelCheckForCompletedTasks(); | 612 CancelCheckForCompletedTasks(); |
613 DispatchCompletionCallbacks(); | 613 DispatchCompletionCallbacks(); |
614 // Schedule another check for completed tasks if not idle. | 614 // Schedule another check for completed tasks if not idle. |
615 if (!is_idle) | 615 if (!is_idle) |
616 ScheduleCheckForCompletedTasks(); | 616 ScheduleCheckForCompletedTasks(); |
617 } | 617 } |
618 } | 618 } |
619 | 619 |
620 } // namespace cc | 620 } // namespace cc |
OLD | NEW |