diff options
author | hendrikw <hendrikw@chromium.org> | 2015-03-25 11:16:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 18:16:43 +0000 |
commit | ae0c69314c5c0025e8e6144f3a7fe64384087c77 (patch) | |
tree | 995219d516d3a21e64eefc52bb254e6c9038119f /cc | |
parent | 053c464fe4b43cc3eab2ee41d1d4337d94e5591e (diff) | |
download | chromium_src-ae0c69314c5c0025e8e6144f3a7fe64384087c77.zip chromium_src-ae0c69314c5c0025e8e6144f3a7fe64384087c77.tar.gz chromium_src-ae0c69314c5c0025e8e6144f3a7fe64384087c77.tar.bz2 |
cc: Fix crash with blink layout tests and GPU rasterization
We were missing the single-threaded task graph runner, which was
required for blink's layout tests that checked for pixels.
BUG=468928
Review URL: https://codereview.chromium.org/1036693002
Cr-Commit-Position: refs/heads/master@{#322192}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 22 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_pixeltest_synchronous.cc | 30 |
2 files changed, 41 insertions, 11 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 2c13fcb..44c9eed 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -2035,12 +2035,21 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( return; } + // Pass the single-threaded synchronous task graph runner to the worker pool + // if we're in synchronous single-threaded mode. + TaskGraphRunner* task_graph_runner = task_graph_runner_; + if (IsSynchronousSingleThreaded()) { + DCHECK(!single_thread_synchronous_task_graph_runner_); + single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner); + task_graph_runner = single_thread_synchronous_task_graph_runner_.get(); + } + if (use_gpu_rasterization_) { *resource_pool = ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D); *tile_task_worker_pool = GpuTileTaskWorkerPool::Create( - task_runner, task_graph_runner_, + task_runner, task_graph_runner, static_cast<GpuRasterizer*>(rasterizer_.get())); return; } @@ -2058,15 +2067,6 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( *resource_pool = ResourcePool::Create(resource_provider_.get(), image_target); - TaskGraphRunner* task_graph_runner; - if (IsSynchronousSingleThreaded()) { - DCHECK(!single_thread_synchronous_task_graph_runner_); - single_thread_synchronous_task_graph_runner_.reset(new TaskGraphRunner); - task_graph_runner = single_thread_synchronous_task_graph_runner_.get(); - } else { - task_graph_runner = task_graph_runner_; - } - *tile_task_worker_pool = ZeroCopyTileTaskWorkerPool::Create( task_runner, task_graph_runner, resource_provider_.get()); return; @@ -2080,7 +2080,7 @@ void LayerTreeHostImpl::CreateResourceAndTileTaskWorkerPool( ResourcePool::Create(resource_provider_.get(), GL_TEXTURE_2D); *tile_task_worker_pool = OneCopyTileTaskWorkerPool::Create( - task_runner, task_graph_runner_, context_provider, + task_runner, task_graph_runner, context_provider, resource_provider_.get(), staging_resource_pool_.get()); return; } diff --git a/cc/trees/layer_tree_host_pixeltest_synchronous.cc b/cc/trees/layer_tree_host_pixeltest_synchronous.cc index c22075f..7dd6d7d 100644 --- a/cc/trees/layer_tree_host_pixeltest_synchronous.cc +++ b/cc/trees/layer_tree_host_pixeltest_synchronous.cc @@ -44,6 +44,36 @@ TEST_F(LayerTreeHostSynchronousPixelTest, OneContentLayer) { PIXEL_TEST_GL, root, base::FilePath(FILE_PATH_LITERAL("green.png"))); } +class LayerTreeHostSynchronousGPUPixelTest : public LayerTreePixelTest { + public: + void InitializeSettings(LayerTreeSettings* settings) override { + LayerTreePixelTest::InitializeSettings(settings); + settings->single_thread_proxy_scheduler = false; + settings->gpu_rasterization_enabled = true; + settings->gpu_rasterization_forced = true; + } + + void BeginTest() override { + LayerTreePixelTest::BeginTest(); + PostCompositeImmediatelyToMainThread(); + } +}; + +TEST_F(LayerTreeHostSynchronousGPUPixelTest, OneContentLayer) { + gfx::Size bounds(200, 200); + + FakeContentLayerClient client; + SkPaint green_paint; + green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); + client.add_draw_rect(gfx::RectF(bounds), green_paint); + scoped_refptr<PictureLayer> root = PictureLayer::Create(&client); + root->SetBounds(bounds); + root->SetIsDrawable(true); + + RunSingleThreadedPixelTest(PIXEL_TEST_GL, root, + base::FilePath(FILE_PATH_LITERAL("green.png"))); +} + } // namespace } // namespace cc |