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/resources/worker_pool.h" | 5 #include "cc/resources/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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 // Finally add task to |completed_tasks_|. | 357 // Finally add task to |completed_tasks_|. |
358 completed_tasks_.push_back(task); | 358 completed_tasks_.push_back(task); |
359 } | 359 } |
360 | 360 |
361 // We noticed we should exit. Wake up the next worker so it knows it should | 361 // We noticed we should exit. Wake up the next worker so it knows it should |
362 // exit as well (because the Shutdown() code only signals once). | 362 // exit as well (because the Shutdown() code only signals once). |
363 has_ready_to_run_tasks_cv_.Signal(); | 363 has_ready_to_run_tasks_cv_.Signal(); |
364 } | 364 } |
365 | 365 |
366 WorkerPool::GraphNode::GraphNode() | 366 WorkerPool::GraphNode::GraphNode( |
367 : task_(NULL), | 367 internal::WorkerPoolTask* task, unsigned priority) |
368 priority_(0), | 368 : task_(task), |
| 369 priority_(priority), |
369 num_dependencies_(0) { | 370 num_dependencies_(0) { |
370 } | 371 } |
371 | 372 |
372 WorkerPool::GraphNode::~GraphNode() { | 373 WorkerPool::GraphNode::~GraphNode() { |
373 } | 374 } |
374 | 375 |
375 WorkerPool::WorkerPool(size_t num_threads, | 376 WorkerPool::WorkerPool(size_t num_threads, |
376 const std::string& thread_name_prefix) | 377 const std::string& thread_name_prefix) |
377 : in_dispatch_completion_callbacks_(false), | 378 : in_dispatch_completion_callbacks_(false), |
378 inner_(make_scoped_ptr(new Inner(num_threads, thread_name_prefix))) { | 379 inner_(make_scoped_ptr(new Inner(num_threads, thread_name_prefix))) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 void WorkerPool::SetTaskGraph(TaskGraph* graph) { | 423 void WorkerPool::SetTaskGraph(TaskGraph* graph) { |
423 TRACE_EVENT1("cc", "WorkerPool::SetTaskGraph", | 424 TRACE_EVENT1("cc", "WorkerPool::SetTaskGraph", |
424 "num_tasks", graph->size()); | 425 "num_tasks", graph->size()); |
425 | 426 |
426 DCHECK(!in_dispatch_completion_callbacks_); | 427 DCHECK(!in_dispatch_completion_callbacks_); |
427 | 428 |
428 inner_->SetTaskGraph(graph); | 429 inner_->SetTaskGraph(graph); |
429 } | 430 } |
430 | 431 |
431 } // namespace cc | 432 } // namespace cc |
OLD | NEW |