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

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: feedback 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..ed1af185810e395fe88cc903536d93fe2b707de8 100644
--- a/cc/raster/task_graph_work_queue.h
+++ b/cc/raster/task_graph_work_queue.h
@@ -60,11 +60,11 @@ class CC_EXPORT TaskGraphWorkQueue {
// category.
std::map<uint16_t, PrioritizedTask::Vector> ready_to_run_tasks;
+ // This set contains all currently running tasks.
+ std::map<uint16_t, Task::Vector> running_tasks;
+
// Completed tasks not yet collected by origin thread.
Task::Vector completed_tasks;
-
- // This set contains all currently running tasks.
- Task::Vector running_tasks;
};
TaskGraphWorkQueue();
@@ -112,7 +112,12 @@ class CC_EXPORT TaskGraphWorkQueue {
static bool HasFinishedRunningTasksInNamespace(
const TaskNamespace* task_namespace) {
- return task_namespace->running_tasks.empty() &&
+ return std::all_of(
+ task_namespace->running_tasks.cbegin(),
+ task_namespace->running_tasks.cend(),
+ [](const std::pair<uint16_t, Task::Vector>& tasks_entry) {
+ return tasks_entry.second.empty();
+ }) &&
!HasReadyToRunTasksInNamespace(task_namespace);
}
@@ -145,6 +150,18 @@ 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_) {
+ const auto& running_tasks = task_namespace_entry.second.running_tasks;
+ const auto& running_tasks_for_category = running_tasks.find(category);
+ if (running_tasks_for_category != running_tasks.cend()) {
+ count += running_tasks_for_category->second.size();
+ }
+ }
+ return count;
+ }
+
// Helper function which ensures that graph dependencies were correctly
// configured.
static bool DependencyMismatch(const TaskGraph* graph);
« 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