diff options
-rw-r--r-- | cc/layers/layer_impl.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.cc | 12 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_picture.cc | 64 |
4 files changed, 72 insertions, 10 deletions
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 066d26c..6793d12 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -1268,8 +1268,6 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer, DCHECK(this != page_scale_layer); DCHECK(scrollbar_clip_layer); - DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || - IsContainerForFixedPositionLayers()); gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->BoundsForScrolling()); diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 861ce4f..d192a9a 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -293,12 +293,6 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( root_layer(), sync_tree->DetachLayerTree(), sync_tree)); } - - { - TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); - TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); - } - sync_tree->set_needs_full_tree_sync(needs_full_tree_sync_); needs_full_tree_sync_ = false; @@ -320,6 +314,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { page_scale_layer_->id(), inner_viewport_scroll_layer_->id(), outer_viewport_scroll_layer_.get() ? outer_viewport_scroll_layer_->id() : Layer::INVALID_ID); + DCHECK(inner_viewport_scroll_layer_->IsContainerForFixedPositionLayers()); } else { sync_tree->ClearViewportLayers(); } @@ -380,6 +375,11 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { sync_tree->set_has_ever_been_drawn(false); + { + TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); + TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); + } + micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); } diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index d394c3f..a343466 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -5125,7 +5125,7 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); class LayerTreeHostTestGpuRasterizationForced : public LayerTreeHostTest { protected: void InitializeSettings(LayerTreeSettings* settings) override { - settings->impl_side_painting = true; + ASSERT_TRUE(settings->impl_side_painting); EXPECT_FALSE(settings->gpu_rasterization_forced); settings->gpu_rasterization_forced = true; @@ -5186,7 +5186,7 @@ class LayerTreeHostTestGpuRasterizationForced : public LayerTreeHostTest { FakeContentLayerClient layer_client_; }; -MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationForced); +SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestGpuRasterizationForced); class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { public: diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc index 2d485b4..c82eb76 100644 --- a/cc/trees/layer_tree_host_unittest_picture.cc +++ b/cc/trees/layer_tree_host_unittest_picture.cc @@ -123,5 +123,69 @@ class LayerTreeHostPictureTestTwinLayer MULTI_THREAD_TEST_F(LayerTreeHostPictureTestTwinLayer); +class LayerTreeHostPictureTestResizeViewportWithGpuRaster + : public LayerTreeHostPictureTest { + void InitializeSettings(LayerTreeSettings* settings) override { + settings->gpu_rasterization_forced = true; + } + + void SetupTree() override { + scoped_refptr<Layer> root = Layer::Create(); + root->SetBounds(gfx::Size(768, 960)); + + client_.set_fill_with_nonsolid_color(true); + picture_ = FakePictureLayer::Create(&client_); + picture_->SetBounds(gfx::Size(768, 960)); + root->AddChild(picture_); + + layer_tree_host()->SetRootLayer(root); + LayerTreeHostPictureTest::SetupTree(); + } + + void BeginTest() override { PostSetNeedsCommitToMainThread(); } + + void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { + LayerImpl* child = impl->sync_tree()->root_layer()->children()[0]; + FakePictureLayerImpl* picture_impl = + static_cast<FakePictureLayerImpl*>(child); + gfx::Size tile_size = + picture_impl->HighResTiling()->TileAt(0, 0)->content_rect().size(); + + switch (impl->sync_tree()->source_frame_number()) { + case 0: + tile_size_ = tile_size; + // GPU Raster picks a tile size based on the viewport size. + EXPECT_EQ(gfx::Size(768, 256), tile_size); + break; + case 1: + // When the viewport changed size, the new frame's tiles should change + // along with it. + EXPECT_NE(gfx::Size(768, 256), tile_size); + } + } + + void DidCommit() override { + switch (layer_tree_host()->source_frame_number()) { + case 1: + // Change the picture layer's size along with the viewport, so it will + // consider picking a new tile size. + picture_->SetBounds(gfx::Size(768, 1056)); + layer_tree_host()->SetViewportSize(gfx::Size(768, 1056)); + break; + case 2: + EndTest(); + } + } + + void AfterTest() override {} + + gfx::Size tile_size_; + FakeContentLayerClient client_; + scoped_refptr<FakePictureLayer> picture_; +}; + +SINGLE_AND_MULTI_THREAD_IMPL_TEST_F( + LayerTreeHostPictureTestResizeViewportWithGpuRaster); + } // namespace } // namespace cc |