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

Unified Diff: cc/resources/image_raster_worker_pool.cc

Issue 154003006: cc: Switch to vector based TaskGraph implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 6 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 | « cc/resources/image_raster_worker_pool.h ('k') | cc/resources/pixel_buffer_raster_worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/image_raster_worker_pool.cc
diff --git a/cc/resources/image_raster_worker_pool.cc b/cc/resources/image_raster_worker_pool.cc
index 845ed1257e6abedb4f8449afef25035bbf426210..015a254b01f78cceb96dc53f192edca3fca0f924 100644
--- a/cc/resources/image_raster_worker_pool.cc
+++ b/cc/resources/image_raster_worker_pool.cc
@@ -34,23 +34,18 @@ void ImageRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
raster_tasks_pending_ = true;
raster_tasks_required_for_activation_pending_ = true;
- unsigned priority = 0u;
- TaskGraph graph;
+ unsigned priority = kRasterTaskPriorityBase;
+ internal::TaskGraph graph;
scoped_refptr<internal::WorkerPoolTask>
new_raster_required_for_activation_finished_task(
CreateRasterRequiredForActivationFinishedTask(
raster_tasks_required_for_activation().size()));
- internal::GraphNode* raster_required_for_activation_finished_node =
- CreateGraphNodeForTask(
- new_raster_required_for_activation_finished_task.get(),
- priority++,
- &graph);
-
scoped_refptr<internal::WorkerPoolTask> new_raster_finished_task(
CreateRasterFinishedTask());
- internal::GraphNode* raster_finished_node = CreateGraphNodeForTask(
- new_raster_finished_task.get(), priority++, &graph);
+
+ size_t raster_required_for_activation_finished_dependency_count = 0u;
+ size_t raster_finished_dependency_count = 0u;
RasterTaskVector gpu_raster_tasks;
@@ -65,16 +60,28 @@ void ImageRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
continue;
}
- CreateGraphNodeForImageRasterTask(
- task,
- task->dependencies(),
- priority++,
- IsRasterTaskRequiredForActivation(task),
- raster_required_for_activation_finished_node,
- raster_finished_node,
- &graph);
+ if (IsRasterTaskRequiredForActivation(task)) {
+ ++raster_required_for_activation_finished_dependency_count;
+ graph.edges.push_back(internal::TaskGraph::Edge(
+ task, new_raster_required_for_activation_finished_task.get()));
+ }
+
+ InsertNodeForRasterTask(&graph, task, task->dependencies(), priority++);
+
+ ++raster_finished_dependency_count;
+ graph.edges.push_back(
+ internal::TaskGraph::Edge(task, new_raster_finished_task.get()));
}
+ InsertNodeForTask(&graph,
+ new_raster_required_for_activation_finished_task.get(),
+ kRasterRequiredForActivationFinishedTaskPriority,
+ raster_required_for_activation_finished_dependency_count);
+ InsertNodeForTask(&graph,
+ new_raster_finished_task.get(),
+ kRasterFinishedTaskPriority,
+ raster_finished_dependency_count);
+
SetTaskGraph(&graph);
set_raster_finished_task(new_raster_finished_task);
@@ -170,25 +177,4 @@ scoped_ptr<base::Value> ImageRasterWorkerPool::StateAsValue() const {
return state.PassAs<base::Value>();
}
-// static
-void ImageRasterWorkerPool::CreateGraphNodeForImageRasterTask(
- internal::WorkerPoolTask* image_task,
- const internal::Task::Vector& decode_tasks,
- unsigned priority,
- bool is_required_for_activation,
- internal::GraphNode* raster_required_for_activation_finished_node,
- internal::GraphNode* raster_finished_node,
- TaskGraph* graph) {
- internal::GraphNode* image_node =
- CreateGraphNodeForRasterTask(image_task, decode_tasks, priority, graph);
-
- if (is_required_for_activation) {
- raster_required_for_activation_finished_node->add_dependency();
- image_node->add_dependent(raster_required_for_activation_finished_node);
- }
-
- raster_finished_node->add_dependency();
- image_node->add_dependent(raster_finished_node);
-}
-
} // namespace cc
« no previous file with comments | « cc/resources/image_raster_worker_pool.h ('k') | cc/resources/pixel_buffer_raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698