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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 334133002: cc: Support on demand raster with ganesh (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review3 Created 6 years, 6 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/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..790613a28a3512b743057018ac49a67f2b5ddcbd 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -216,6 +216,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
: client_(client),
proxy_(proxy),
use_gpu_rasterization_(false),
+ on_demand_task_graph_runner_(NULL),
input_handler_client_(NULL),
did_lock_scrolling_layer_(false),
should_bubble_scrolls_(false),
@@ -1883,6 +1884,7 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
DirectRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(),
resource_provider_.get(),
context_provider);
+ on_demand_task_graph_runner_ = &synchronous_task_graph_runner_;
} else if (UseZeroCopyTextureUpload()) {
resource_pool_ =
ResourcePool::Create(resource_provider_.get(),
@@ -1893,6 +1895,7 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
ImageRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(),
RasterWorkerPool::GetTaskGraphRunner(),
resource_provider_.get());
+ on_demand_task_graph_runner_ = RasterWorkerPool::GetTaskGraphRunner();
} else if (UseOneCopyTextureUpload()) {
// We need to create a staging resource pool when using copy rasterizer.
staging_resource_pool_ =
@@ -1909,6 +1912,7 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
RasterWorkerPool::GetTaskGraphRunner(),
resource_provider_.get(),
staging_resource_pool_.get());
+ on_demand_task_graph_runner_ = RasterWorkerPool::GetTaskGraphRunner();
} else {
resource_pool_ = ResourcePool::Create(
resource_provider_.get(),
@@ -1920,6 +1924,7 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
RasterWorkerPool::GetTaskGraphRunner(),
resource_provider_.get(),
transfer_buffer_memory_limit_);
+ on_demand_task_graph_runner_ = RasterWorkerPool::GetTaskGraphRunner();
}
tile_manager_ =
@@ -1931,6 +1936,7 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
need_to_update_visible_tiles_before_draw_ = false;
+ on_demand_task_namespace_ = on_demand_task_graph_runner_->GetNamespaceToken();
}
void LayerTreeHostImpl::DestroyTileManager() {
@@ -2761,6 +2767,34 @@ void LayerTreeHostImpl::SetFullRootLayerDamage() {
SetViewportDamage(gfx::Rect(DrawViewportSize()));
}
+void LayerTreeHostImpl::RunOnDemandRasterTask(Task* on_demand_raster_task) {
+ DCHECK(on_demand_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.
+ on_demand_task_graph_runner_->ScheduleTasks(on_demand_task_namespace_,
+ &graph);
+
+ if (on_demand_task_graph_runner_ == &synchronous_task_graph_runner_)
+ on_demand_task_graph_runner_->RunUntilIdle();
+
+ on_demand_task_graph_runner_->WaitForTasksToFinishRunning(
+ on_demand_task_namespace_);
+
+ // Collect task now that it has finished running.
+ Task::Vector completed_tasks;
+ on_demand_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()
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698