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..fa69c3db6c182d54372fffe9f426e6eb06c5f670 100644 |
| --- a/cc/raster/task_graph_work_queue.h |
| +++ b/cc/raster/task_graph_work_queue.h |
| @@ -46,6 +46,8 @@ class CC_EXPORT TaskGraphWorkQueue { |
| uint16_t priority; |
| }; |
| + using CategorizedTask = std::pair<uint16_t, scoped_refptr<Task>>; |
| + |
| // Helper classes and static methods used by dependent classes. |
| struct TaskNamespace { |
| typedef std::vector<TaskNamespace*> Vector; |
| @@ -64,7 +66,7 @@ class CC_EXPORT TaskGraphWorkQueue { |
| Task::Vector completed_tasks; |
| // This set contains all currently running tasks. |
| - Task::Vector running_tasks; |
| + std::vector<CategorizedTask> running_tasks; |
| }; |
| TaskGraphWorkQueue(); |
| @@ -145,6 +147,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& categorized_task : |
| + task_namespace_entry.second.running_tasks) { |
| + if (categorized_task.first == category) { |
| + count++; |
|
reveman
2016/02/24 19:34:29
nit: ++count is typically preferred in chromium co
ericrk
2016/02/24 19:49:27
k
|
| + } |
| + } |
| + } |
| + return count; |
| + } |
| + |
| // Helper function which ensures that graph dependencies were correctly |
| // configured. |
| static bool DependencyMismatch(const TaskGraph* graph); |