summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorhush <hush@chromium.org>2014-08-29 16:56:01 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-30 00:02:16 +0000
commit367d7dd63fb48978cf28918397a8269f368e6f27 (patch)
tree19bbd28741211adb7bdad85b9bc534830b164e74 /cc
parent00f180a54e0ebf53bcadebc9983ee406818f232b (diff)
downloadchromium_src-367d7dd63fb48978cf28918397a8269f368e6f27.zip
chromium_src-367d7dd63fb48978cf28918397a8269f368e6f27.tar.gz
chromium_src-367d7dd63fb48978cf28918397a8269f368e6f27.tar.bz2
Remove resourceless_software_draw() and related unit tests.
WebView passes the correct viewport and transform for tile priority in both hardware and resourceless software draws. As a result, PictureLayerImpl does not need to treat resourceless software draws differently. BUG=398587 Review URL: https://codereview.chromium.org/517893002 Cr-Commit-Position: refs/heads/master@{#292723}
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/picture_layer_impl.cc12
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc139
-rw-r--r--cc/trees/layer_tree_impl.cc9
-rw-r--r--cc/trees/layer_tree_impl.h1
4 files changed, 28 insertions, 133 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index cb6aab3..1f8e5a8 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -433,14 +433,10 @@ void PictureLayerImpl::UpdateTiles(
DCHECK(!occlusion_tracker ||
layer_tree_impl()->settings().use_occlusion_for_tile_prioritization);
- // Transforms and viewport are invalid for tile management inside a
- // resourceless software draw, so don't update them.
- if (!layer_tree_impl()->resourceless_software_draw()) {
- visible_rect_for_tile_priority_ = visible_content_rect();
- viewport_rect_for_tile_priority_ =
- layer_tree_impl()->ViewportRectForTilePriority();
- screen_space_transform_for_tile_priority_ = screen_space_transform();
- }
+ visible_rect_for_tile_priority_ = visible_content_rect();
+ viewport_rect_for_tile_priority_ =
+ layer_tree_impl()->ViewportRectForTilePriority();
+ screen_space_transform_for_tile_priority_ = screen_space_transform();
if (!CanHaveTilings()) {
ideal_page_scale_ = 0.f;
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 9e80f92..249dcf0 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -415,7 +415,8 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
}
}
-TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
+TEST_F(PictureLayerImplTest,
+ ResourcelessSoftwareDrawHasValidViewportForTilePriority) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
host_impl_.SetCurrentBeginFrameArgs(
@@ -436,8 +437,6 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, false);
// UpdateTiles with valid viewport. Should update tile viewport.
- // Note viewport is considered invalid if and only if in resourceless
- // software draw.
bool resourceless_software_draw = false;
gfx::Rect viewport = gfx::Rect(layer_bounds);
gfx::Transform transform;
@@ -460,8 +459,9 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
gfx::Transform screen_space_transform_for_tile_priority =
active_layer_->screen_space_transform_for_tile_priority();
- // Expand viewport and set it as invalid for prioritizing tiles.
- // Should not update tile viewport.
+ // PictureLayerImpl does not make a special case for
+ // resource_less_software_draw, so the tile viewport and matrix should be
+ // respected.
time_ticks += base::TimeDelta::FromMilliseconds(200);
host_impl_.SetCurrentBeginFrameArgs(
CreateBeginFrameArgsForTesting(time_ticks));
@@ -478,6 +478,11 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
resourceless_software_draw);
active_layer_->UpdateTiles(NULL);
+ visible_rect_for_tile_priority =
+ gfx::ScaleToEnclosingRect(visible_rect_for_tile_priority, 2);
+ viewport_rect_for_tile_priority =
+ gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority, 2);
+ screen_space_transform_for_tile_priority = transform;
EXPECT_RECT_EQ(visible_rect_for_tile_priority,
active_layer_->visible_rect_for_tile_priority());
EXPECT_RECT_EQ(viewport_rect_for_tile_priority,
@@ -485,60 +490,6 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
EXPECT_TRANSFORMATION_MATRIX_EQ(
screen_space_transform_for_tile_priority,
active_layer_->screen_space_transform_for_tile_priority());
-
- // Keep expanded viewport but mark it valid. Should update tile viewport.
- time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentBeginFrameArgs(
- CreateBeginFrameArgsForTesting(time_ticks));
- resourceless_software_draw = false;
- host_impl_.SetExternalDrawConstraints(transform,
- viewport,
- viewport,
- viewport,
- transform,
- resourceless_software_draw);
- active_layer_->UpdateTiles(NULL);
-
- EXPECT_FALSE(visible_rect_for_tile_priority ==
- active_layer_->visible_rect_for_tile_priority());
- EXPECT_FALSE(viewport_rect_for_tile_priority ==
- active_layer_->viewport_rect_for_tile_priority());
- EXPECT_FALSE(screen_space_transform_for_tile_priority ==
- active_layer_->screen_space_transform_for_tile_priority());
-}
-
-TEST_F(PictureLayerImplTest, InvalidViewportAfterReleaseResources) {
- gfx::Size tile_size(100, 100);
- gfx::Size layer_bounds(400, 400);
-
- scoped_refptr<FakePicturePileImpl> pending_pile =
- FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
- scoped_refptr<FakePicturePileImpl> active_pile =
- FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
-
- SetupTrees(pending_pile, active_pile);
-
- Region invalidation;
- AddDefaultTilingsWithInvalidation(invalidation);
-
- bool resourceless_software_draw = true;
- gfx::Rect viewport = gfx::Rect(layer_bounds);
- gfx::Transform identity = gfx::Transform();
- host_impl_.SetExternalDrawConstraints(identity,
- viewport,
- viewport,
- viewport,
- identity,
- resourceless_software_draw);
- ResetTilingsAndRasterScales();
- host_impl_.pending_tree()->UpdateDrawProperties();
- host_impl_.active_tree()->UpdateDrawProperties();
- EXPECT_TRUE(active_layer_->HighResTiling());
-
- size_t num_tilings = active_layer_->num_tilings();
- active_layer_->UpdateTiles(NULL);
- pending_layer_->AddTiling(0.5f);
- EXPECT_EQ(num_tilings + 1, active_layer_->num_tilings());
}
TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
@@ -3043,7 +2994,8 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
AssertNoTilesRequired(pending_layer_->LowResTiling());
}
-TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
+TEST_F(NoLowResPictureLayerImplTest,
+ ResourcelessSoftwareDrawHasValidViewportForTilePriority) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
host_impl_.SetCurrentBeginFrameArgs(
@@ -3064,8 +3016,6 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, false);
// UpdateTiles with valid viewport. Should update tile viewport.
- // Note viewport is considered invalid if and only if in resourceless
- // software draw.
bool resourceless_software_draw = false;
gfx::Rect viewport = gfx::Rect(layer_bounds);
gfx::Transform transform;
@@ -3088,8 +3038,9 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
gfx::Transform screen_space_transform_for_tile_priority =
active_layer_->screen_space_transform_for_tile_priority();
- // Expand viewport and set it as invalid for prioritizing tiles.
- // Should not update tile viewport.
+ // PictureLayerImpl does not make a special case for
+ // resource_less_software_draw, so the tile viewport and matrix should be
+ // respected.
time_ticks += base::TimeDelta::FromMilliseconds(200);
host_impl_.SetCurrentBeginFrameArgs(
CreateBeginFrameArgsForTesting(time_ticks));
@@ -3106,6 +3057,12 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
resourceless_software_draw);
active_layer_->UpdateTiles(NULL);
+ visible_rect_for_tile_priority =
+ gfx::ScaleToEnclosingRect(visible_rect_for_tile_priority, 2);
+ viewport_rect_for_tile_priority =
+ gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority, 2);
+ screen_space_transform_for_tile_priority = transform;
+
EXPECT_RECT_EQ(visible_rect_for_tile_priority,
active_layer_->visible_rect_for_tile_priority());
EXPECT_RECT_EQ(viewport_rect_for_tile_priority,
@@ -3113,60 +3070,6 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
EXPECT_TRANSFORMATION_MATRIX_EQ(
screen_space_transform_for_tile_priority,
active_layer_->screen_space_transform_for_tile_priority());
-
- // Keep expanded viewport but mark it valid. Should update tile viewport.
- time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentBeginFrameArgs(
- CreateBeginFrameArgsForTesting(time_ticks));
- resourceless_software_draw = false;
- host_impl_.SetExternalDrawConstraints(transform,
- viewport,
- viewport,
- viewport,
- transform,
- resourceless_software_draw);
- active_layer_->UpdateTiles(NULL);
-
- EXPECT_FALSE(visible_rect_for_tile_priority ==
- active_layer_->visible_rect_for_tile_priority());
- EXPECT_FALSE(viewport_rect_for_tile_priority ==
- active_layer_->viewport_rect_for_tile_priority());
- EXPECT_FALSE(screen_space_transform_for_tile_priority ==
- active_layer_->screen_space_transform_for_tile_priority());
-}
-
-TEST_F(NoLowResPictureLayerImplTest, InvalidViewportAfterReleaseResources) {
- gfx::Size tile_size(100, 100);
- gfx::Size layer_bounds(400, 400);
-
- scoped_refptr<FakePicturePileImpl> pending_pile =
- FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
- scoped_refptr<FakePicturePileImpl> active_pile =
- FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
-
- SetupTrees(pending_pile, active_pile);
-
- Region invalidation;
- AddDefaultTilingsWithInvalidation(invalidation);
-
- bool resourceless_software_draw = true;
- gfx::Rect viewport = gfx::Rect(layer_bounds);
- gfx::Transform identity = gfx::Transform();
- host_impl_.SetExternalDrawConstraints(identity,
- viewport,
- viewport,
- viewport,
- identity,
- resourceless_software_draw);
- ResetTilingsAndRasterScales();
- host_impl_.pending_tree()->UpdateDrawProperties();
- host_impl_.active_tree()->UpdateDrawProperties();
- EXPECT_TRUE(active_layer_->HighResTiling());
-
- size_t num_tilings = active_layer_->num_tilings();
- active_layer_->UpdateTiles(NULL);
- pending_layer_->AddTiling(0.5f);
- EXPECT_EQ(num_tilings + 1, active_layer_->num_tilings());
}
TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index c9526f9..0a4dc8b 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -456,7 +456,9 @@ bool LayerTreeImpl::UpdateDrawProperties() {
source_frame_number_);
LayerImpl* page_scale_layer =
page_scale_layer_ ? page_scale_layer_ : InnerViewportContainerLayer();
- bool can_render_to_separate_surface = !resourceless_software_draw();
+ bool can_render_to_separate_surface =
+ (layer_tree_host_impl_->GetDrawMode() !=
+ DRAW_MODE_RESOURCELESS_SOFTWARE);
++render_surface_layer_list_id_;
LayerTreeHostCommon::CalcDrawPropsImplInputs inputs(
@@ -685,11 +687,6 @@ MemoryHistory* LayerTreeImpl::memory_history() const {
return layer_tree_host_impl_->memory_history();
}
-bool LayerTreeImpl::resourceless_software_draw() const {
- return layer_tree_host_impl_->GetDrawMode() ==
- DRAW_MODE_RESOURCELESS_SOFTWARE;
-}
-
gfx::Size LayerTreeImpl::device_viewport_size() const {
return layer_tree_host_impl_->device_viewport_size();
}
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index eb05ee5..9b68f1b 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -81,7 +81,6 @@ class CC_EXPORT LayerTreeImpl {
FrameRateCounter* frame_rate_counter() const;
PaintTimeCounter* paint_time_counter() const;
MemoryHistory* memory_history() const;
- bool resourceless_software_draw() const;
gfx::Size device_viewport_size() const;
bool IsActiveTree() const;
bool IsPendingTree() const;