| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 DispatchCompletionCallbacks(&completed_tasks); | 486 DispatchCompletionCallbacks(&completed_tasks); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void WorkerPool::DispatchCompletionCallbacks(TaskDeque* completed_tasks) { | 489 void WorkerPool::DispatchCompletionCallbacks(TaskDeque* completed_tasks) { |
| 490 TRACE_EVENT0("cc", "WorkerPool::DispatchCompletionCallbacks"); | 490 TRACE_EVENT0("cc", "WorkerPool::DispatchCompletionCallbacks"); |
| 491 | 491 |
| 492 // Worker pool instance is not reentrant while processing completed tasks. | 492 // Worker pool instance is not reentrant while processing completed tasks. |
| 493 in_dispatch_completion_callbacks_ = true; | 493 in_dispatch_completion_callbacks_ = true; |
| 494 | 494 |
| 495 while (!completed_tasks->empty()) { | 495 while (!completed_tasks->empty()) { |
| 496 internal::WorkerPoolTask* task = completed_tasks->front(); | 496 internal::WorkerPoolTask* task = completed_tasks->front().get(); |
| 497 | 497 |
| 498 task->DidComplete(); | 498 task->DidComplete(); |
| 499 task->DispatchCompletionCallback(); | 499 task->DispatchCompletionCallback(); |
| 500 | 500 |
| 501 completed_tasks->pop_front(); | 501 completed_tasks->pop_front(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 in_dispatch_completion_callbacks_ = false; | 504 in_dispatch_completion_callbacks_ = false; |
| 505 } | 505 } |
| 506 | 506 |
| 507 void WorkerPool::ScheduleTasks(internal::WorkerPoolTask* root) { | 507 void WorkerPool::ScheduleTasks(internal::WorkerPoolTask* root) { |
| 508 TRACE_EVENT0("cc", "WorkerPool::ScheduleTasks"); | 508 TRACE_EVENT0("cc", "WorkerPool::ScheduleTasks"); |
| 509 | 509 |
| 510 DCHECK(!in_dispatch_completion_callbacks_); | 510 DCHECK(!in_dispatch_completion_callbacks_); |
| 511 | 511 |
| 512 inner_->ScheduleTasks(root); | 512 inner_->ScheduleTasks(root); |
| 513 } | 513 } |
| 514 | 514 |
| 515 } // namespace cc | 515 } // namespace cc |
| OLD | NEW |