summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 01:17:25 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 01:17:25 +0000
commit1a159657ca0febe50fcc5e4370faf6fb3244a543 (patch)
tree1a4e27498bb287c40359aefa5909d209e3a565db /cc
parentf113be51aa1065f70cdc888a673bf04d0f395acb (diff)
downloadchromium_src-1a159657ca0febe50fcc5e4370faf6fb3244a543.zip
chromium_src-1a159657ca0febe50fcc5e4370faf6fb3244a543.tar.gz
chromium_src-1a159657ca0febe50fcc5e4370faf6fb3244a543.tar.bz2
cc: Early out sooner in UpdateTilePriorities when !CanHaveTilings().
Also, when we cleanup tilings on the active twin, we use the pending twin's ideal contents scale. But when the twin !CanHavTilings() there is no need to use that ideal scale and save tilings. R=enne@chromium.org, enne Review URL: https://codereview.chromium.org/334953003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/picture_layer_impl.cc36
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc45
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc56
3 files changed, 64 insertions, 73 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 0ebd0e4..d74dfcd 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -390,14 +390,6 @@ void PictureLayerImpl::UpdateTilePriorities() {
TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
DoPostCommitInitializationIfNeeded();
- UpdateIdealScales();
- // TODO(sohanjg): Avoid needlessly update priorities when syncing to a
- // non-updated tree which will then be updated immediately afterwards.
- should_update_tile_priorities_ = true;
- if (CanHaveTilings()) {
- ManageTilings(draw_properties().screen_space_transform_is_animating,
- draw_properties().maximum_animation_contents_scale);
- }
if (layer_tree_impl()->device_viewport_valid_for_tile_management()) {
visible_rect_for_tile_priority_ = visible_content_rect();
@@ -405,6 +397,23 @@ void PictureLayerImpl::UpdateTilePriorities() {
screen_space_transform_for_tile_priority_ = screen_space_transform();
}
+ if (!CanHaveTilings()) {
+ ideal_page_scale_ = 0.f;
+ ideal_device_scale_ = 0.f;
+ ideal_contents_scale_ = 0.f;
+ ideal_source_scale_ = 0.f;
+ SanityCheckTilingState();
+ return;
+ }
+
+ // TODO(sohanjg): Avoid needlessly update priorities when syncing to a
+ // non-updated tree which will then be updated immediately afterwards.
+ should_update_tile_priorities_ = true;
+
+ UpdateIdealScales();
+ ManageTilings(draw_properties().screen_space_transform_is_animating,
+ draw_properties().maximum_animation_contents_scale);
+
if (!tilings_->num_tilings())
return;
@@ -1149,7 +1158,7 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
float twin_low_res_scale = 0.f;
PictureLayerImpl* twin = twin_layer_;
- if (twin) {
+ if (twin && twin->CanHaveTilings()) {
min_acceptable_high_res_scale = std::min(
min_acceptable_high_res_scale,
std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_));
@@ -1272,14 +1281,7 @@ float PictureLayerImpl::MaximumTilingContentsScale() const {
}
void PictureLayerImpl::UpdateIdealScales() {
- if (!CanHaveTilings()) {
- ideal_page_scale_ = draw_properties().page_scale_factor;
- ideal_device_scale_ = draw_properties().device_scale_factor;
- ideal_contents_scale_ = draw_properties().ideal_contents_scale;
- ideal_source_scale_ =
- ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_;
- return;
- }
+ DCHECK(CanHaveTilings());
float min_contents_scale = MinimumContentsScale();
DCHECK_GT(min_contents_scale, 0.f);
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index c26f74b..38e20e2 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2774,5 +2774,50 @@ TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) {
quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString());
}
+TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) {
+ gfx::Size tile_size(400, 400);
+ gfx::Size bounds(100000, 100);
+
+ host_impl_.CreatePendingTree();
+
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.pending_tree(), 1);
+
+ scoped_ptr<FakePictureLayerImpl> layer_with_mask =
+ FakePictureLayerImpl::Create(host_impl_.pending_tree(), 2);
+
+ layer_with_mask->SetBounds(bounds);
+ layer_with_mask->SetContentBounds(bounds);
+
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, bounds);
+ scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile(
+ host_impl_.pending_tree(), 3, pending_pile);
+
+ mask->SetIsMask(true);
+ mask->SetBounds(bounds);
+ mask->SetContentBounds(bounds);
+ mask->SetDrawsContent(true);
+
+ FakePictureLayerImpl* pending_mask_content = mask.get();
+ layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>());
+
+ scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
+ FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4);
+
+ child_of_layer_with_mask->SetBounds(bounds);
+ child_of_layer_with_mask->SetContentBounds(bounds);
+ child_of_layer_with_mask->SetDrawsContent(true);
+
+ layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>());
+
+ root->AddChild(layer_with_mask.PassAs<LayerImpl>());
+
+ host_impl_.pending_tree()->SetRootLayer(root.Pass());
+
+ EXPECT_FALSE(pending_mask_content->tilings());
+ host_impl_.pending_tree()->UpdateDrawProperties();
+ EXPECT_NE(0u, pending_mask_content->num_tilings());
+}
+
} // namespace
} // namespace cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 600ace7..29d285f 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -6574,61 +6574,5 @@ TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) {
150u * 1024u * 1024u);
}
-TEST_F(LayerTreeHostImplTest, UpdateTilesForMasksWithNoVisibleContent) {
- gfx::Size bounds(100000, 100);
-
- host_impl_->CreatePendingTree();
-
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->pending_tree(), 1);
-
- scoped_ptr<FakePictureLayerImpl> layer_with_mask =
- FakePictureLayerImpl::Create(host_impl_->pending_tree(), 2);
-
- layer_with_mask->SetBounds(bounds);
- layer_with_mask->SetContentBounds(bounds);
-
- scoped_ptr<FakePictureLayerImpl> mask =
- FakePictureLayerImpl::Create(host_impl_->pending_tree(), 3);
-
- mask->SetIsMask(true);
- mask->SetBounds(bounds);
- mask->SetContentBounds(bounds);
-
- FakePictureLayerImpl* pending_mask_content = mask.get();
- layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>());
-
- scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
- FakePictureLayerImpl::Create(host_impl_->pending_tree(), 4);
-
- child_of_layer_with_mask->SetBounds(bounds);
- child_of_layer_with_mask->SetContentBounds(bounds);
- child_of_layer_with_mask->SetDrawsContent(true);
-
- layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>());
-
- root->AddChild(layer_with_mask.PassAs<LayerImpl>());
-
- host_impl_->pending_tree()->SetRootLayer(root.Pass());
-
- gfx::Rect r1 = pending_mask_content->visible_rect_for_tile_priority();
- ASSERT_EQ(0, r1.x());
- ASSERT_EQ(0, r1.y());
- ASSERT_EQ(0, r1.width());
- ASSERT_EQ(0, r1.height());
-
- host_impl_->ActivatePendingTree();
-
- host_impl_->active_tree()->UpdateDrawProperties();
-
- ASSERT_EQ(2u, host_impl_->active_tree()->RenderSurfaceLayerList().size());
-
- FakePictureLayerImpl* active_mask_content =
- static_cast<FakePictureLayerImpl*>(
- host_impl_->active_tree()->root_layer()->children()[0]->mask_layer());
- gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority();
-
- ASSERT_TRUE(!r2.IsEmpty());
-}
-
} // namespace
} // namespace cc