| 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 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
| 8 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) | 8 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) |
| 9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
| 10 #endif | 10 #endif |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 WorkerPool::~WorkerPool() { | 310 WorkerPool::~WorkerPool() { |
| 311 // Cancel all pending callbacks. | 311 // Cancel all pending callbacks. |
| 312 weak_ptr_factory_.InvalidateWeakPtrs(); | 312 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 313 | 313 |
| 314 DCHECK_EQ(0u, completed_tasks_.size()); | 314 DCHECK_EQ(0u, completed_tasks_.size()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void WorkerPool::Shutdown() { | 317 void WorkerPool::Shutdown() { |
| 318 inner_->Shutdown(); | 318 inner_->Shutdown(); |
| 319 inner_->CollectCompletedTasks(); |
| 319 DispatchCompletionCallbacks(); | 320 DispatchCompletionCallbacks(); |
| 320 } | 321 } |
| 321 | 322 |
| 322 void WorkerPool::PostTaskAndReply( | 323 void WorkerPool::PostTaskAndReply( |
| 323 const Callback& task, const base::Closure& reply) { | 324 const Callback& task, const base::Closure& reply) { |
| 324 PostTask(make_scoped_ptr(new WorkerPoolTaskImpl( | 325 PostTask(make_scoped_ptr(new WorkerPoolTaskImpl( |
| 325 task, | 326 task, |
| 326 reply)).PassAs<internal::WorkerPoolTask>()); | 327 reply)).PassAs<internal::WorkerPoolTask>()); |
| 327 } | 328 } |
| 328 | 329 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 371 } |
| 371 | 372 |
| 372 void WorkerPool::PostTask(scoped_ptr<internal::WorkerPoolTask> task) { | 373 void WorkerPool::PostTask(scoped_ptr<internal::WorkerPoolTask> task) { |
| 373 // Schedule check for completed tasks if not pending. | 374 // Schedule check for completed tasks if not pending. |
| 374 ScheduleCheckForCompletedTasks(); | 375 ScheduleCheckForCompletedTasks(); |
| 375 | 376 |
| 376 inner_->PostTask(task.Pass()); | 377 inner_->PostTask(task.Pass()); |
| 377 } | 378 } |
| 378 | 379 |
| 379 } // namespace cc | 380 } // namespace cc |
| OLD | NEW |