Chromium Code Reviews| Index: cc/raster/task_graph_work_queue.h |
| diff --git a/cc/raster/task_graph_work_queue.h b/cc/raster/task_graph_work_queue.h |
| index 95d3c772c24f22ea478757e2d1a81d40ab231b9e..3ea984a458491aeda084118c8a5211b621890292 100644 |
| --- a/cc/raster/task_graph_work_queue.h |
| +++ b/cc/raster/task_graph_work_queue.h |
| @@ -28,19 +28,16 @@ class CC_EXPORT TaskGraphWorkQueue { |
| public: |
| struct TaskNamespace; |
| - struct PrioritizedTask { |
| + struct CC_EXPORT PrioritizedTask { |
| typedef std::vector<PrioritizedTask> Vector; |
| PrioritizedTask(Task* task, |
| TaskNamespace* task_namespace, |
| uint16_t category, |
| - uint16_t priority) |
| - : task(task), |
| - task_namespace(task_namespace), |
| - category(category), |
| - priority(priority) {} |
| + uint16_t priority); |
| + ~PrioritizedTask(); |
| - Task* task; |
| + scoped_refptr<Task> task; |
|
reveman
2016/02/24 18:53:00
hm, not sure about this. I'm worried this will mak
ericrk
2016/02/24 19:30:43
Introduced a new type, CategorizedTask, which refc
|
| TaskNamespace* task_namespace; |
| uint16_t category; |
| uint16_t priority; |
| @@ -64,7 +61,7 @@ class CC_EXPORT TaskGraphWorkQueue { |
| Task::Vector completed_tasks; |
| // This set contains all currently running tasks. |
| - Task::Vector running_tasks; |
| + PrioritizedTask::Vector running_tasks; |
| }; |
| TaskGraphWorkQueue(); |
| @@ -145,6 +142,19 @@ class CC_EXPORT TaskGraphWorkQueue { |
| return ready_to_run_namespaces_; |
| } |
| + size_t NumRunningTasksForCategory(uint16_t category) const { |
| + size_t count = 0; |
| + for (const auto& task_namespace_entry : namespaces_) { |
| + for (const auto& prioritized_task : |
| + task_namespace_entry.second.running_tasks) { |
| + if (prioritized_task.category == category) { |
| + count++; |
| + } |
| + } |
| + } |
| + return count; |
| + } |
| + |
| // Helper function which ensures that graph dependencies were correctly |
| // configured. |
| static bool DependencyMismatch(const TaskGraph* graph); |