Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index c3ea50005021f8a1dd963afa3e169da0fa834971..61947b74459565d40632c74157518cbebd114355 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -2761,6 +2761,48 @@ void LayerTreeHostImpl::SetFullRootLayerDamage() { |
SetViewportDamage(gfx::Rect(DrawViewportSize())); |
} |
+void LayerTreeHostImpl::RunOnDemandRasterTask(Task* on_demand_raster_task) { |
+ scoped_ptr<TaskGraphRunner> temp_task_graph_runner_holder; |
+ TaskGraphRunner* task_graph_runner = NULL; |
+ NamespaceToken on_demand_task_namespace; |
+ |
+ // Use the TaskGraphRunner on correct thread and get unique namespace token. |
+ if (use_gpu_rasterization_) { |
reveman
2014/06/20 00:38:41
Can you remove these use_gpu_rasterization_ checks
boliu
2014/06/20 01:27:06
Another question. If we do this, do we have to wor
reveman
2014/06/20 01:29:21
I don't think we can generate picture-draw-quads w
|
+ temp_task_graph_runner_holder.reset(new TaskGraphRunner); |
+ task_graph_runner = temp_task_graph_runner_holder.get(); |
+ on_demand_task_namespace = task_graph_runner->GetNamespaceToken(); |
+ } else { |
+ task_graph_runner = RasterWorkerPool::GetTaskGraphRunner(); |
+ if (!on_demand_task_namespace_.IsValid()) |
+ on_demand_task_namespace_ = task_graph_runner->GetNamespaceToken(); |
+ on_demand_task_namespace = on_demand_task_namespace_; |
+ } |
+ DCHECK(task_graph_runner); |
+ |
+ // Construct a task graph that contains this single raster task. |
+ TaskGraph graph; |
+ graph.nodes.push_back( |
+ TaskGraph::Node(on_demand_raster_task, |
+ RasterWorkerPool::kOnDemandRasterTaskPriority, |
+ 0u)); |
+ |
+ // Schedule task and wait for task graph runner to finish running it. |
+ task_graph_runner->ScheduleTasks(on_demand_task_namespace, &graph); |
+ |
+ if (use_gpu_rasterization_) { |
boliu
2014/06/20 01:28:16
Also this branch can't move to CreateAndSetTileMan
reveman
2014/06/20 01:32:38
Could it instead be something like the following?
|
+ task_graph_runner->RunUntilIdle(); |
+ } else { |
+ task_graph_runner->WaitForTasksToFinishRunning(on_demand_task_namespace); |
+ } |
+ |
+ // Collect task now that it has finished running. |
+ Task::Vector completed_tasks; |
+ task_graph_runner->CollectCompletedTasks(on_demand_task_namespace, |
+ &completed_tasks); |
+ DCHECK_EQ(1u, completed_tasks.size()); |
+ DCHECK_EQ(completed_tasks[0], on_demand_raster_task); |
+} |
+ |
void LayerTreeHostImpl::ScrollViewportBy(gfx::Vector2dF scroll_delta) { |
DCHECK(InnerViewportScrollLayer()); |
LayerImpl* scroll_layer = OuterViewportScrollLayer() |