Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2947)

Unified Diff: cc/raster/task_graph_work_queue.h

Issue 1666283002: Reland - Refactor signaling in RWP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/raster/task_graph_work_queue.cc » ('j') | content/renderer/raster_worker_pool.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « no previous file | cc/raster/task_graph_work_queue.cc » ('j') | content/renderer/raster_worker_pool.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698