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..4089d152bd381ff5ee4eed224258339243a2de17 100644 |
| --- a/cc/raster/task_graph_work_queue.h |
| +++ b/cc/raster/task_graph_work_queue.h |
| @@ -145,6 +145,22 @@ class CC_EXPORT TaskGraphWorkQueue { |
| return ready_to_run_namespaces_; |
| } |
| + uint32_t NumRunningTasks() const { |
|
reveman
2016/02/08 19:10:21
Do we need both of these functions or is the one b
ericrk
2016/02/10 18:44:49
Not really - we can drop this one for now.
|
| + uint32_t count = 0; |
| + for (const auto& running_task_count_entry : running_task_count_) { |
| + count += running_task_count_entry.second; |
| + } |
| + return count; |
| + } |
| + |
| + uint32_t NumRunningTasksForCategory(uint16_t category) const { |
| + auto found = running_task_count_.find(category); |
| + if (found != running_task_count_.end()) { |
| + return found->second; |
| + } |
| + return 0; |
| + } |
| + |
| // Helper function which ensures that graph dependencies were correctly |
| // configured. |
| static bool DependencyMismatch(const TaskGraph* graph); |
| @@ -167,6 +183,11 @@ class CC_EXPORT TaskGraphWorkQueue { |
| // Map from category to a vector of ready to run namespaces for that category. |
| std::map<uint16_t, TaskNamespace::Vector> ready_to_run_namespaces_; |
| + // Helper variable tracking the number of running tasks in each category. We |
| + // could calculate this from data in namespaces_, but it would be less |
| + // efficient. |
| + std::map<uint16_t, uint32_t> running_task_count_; |
|
reveman
2016/02/08 19:10:21
I'd prefer if we minimized state and looped over a
ericrk
2016/02/10 18:44:49
Sure, went back and forth on this - can make this
|
| + |
| // Provides a unique id to each NamespaceToken. |
| int next_namespace_id_; |
| }; |