summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur <finnur@chromium.org>2014-08-25 02:59:07 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-25 10:00:16 +0000
commitbb1bd87a4fad403340fe8e3168552a933954a535 (patch)
tree019914c3d0564fc2661bd60efe1cc0951ddeeb97
parent6f93ff91cd3dba63a70f2b860a99c34503580fbb (diff)
downloadchromium_src-bb1bd87a4fad403340fe8e3168552a933954a535.zip
chromium_src-bb1bd87a4fad403340fe8e3168552a933954a535.tar.gz
chromium_src-bb1bd87a4fad403340fe8e3168552a933954a535.tar.bz2
Revert of cc: Don't consider tiles at the layers raster_contents_scale incomplete (patchset #3 of https://codereview.chromium.org/484363003/)
Reason for revert: Unit test added fails all the time. http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%283%29/builds/6770 Original issue's description: > cc: Don't consider tiles at the layers raster_contents_scale incomplete > > When PictureLayerImpl chooses a scale to raster at, we should accept > tiles at that scale as complete, and not try wait for tiles at some > other scale to be filled in. Such a tiling may not even exist. > > R=enne, vmpstr > BUG=406433 > > Committed: https://chromium.googlesource.com/chromium/src/+/60c7d86bb7685d8ca04ee53ae20fcdd6cd37eb5f TBR=enne@chromium.org,vmpstr@chromium.org,danakj@chromium.org NOTREECHECKS=true NOTRY=true BUG=406433 Review URL: https://codereview.chromium.org/505723002 Cr-Commit-Position: refs/heads/master@{#291653}
-rw-r--r--cc/layers/picture_layer_impl.cc9
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc151
-rw-r--r--cc/test/fake_picture_layer_impl.h3
3 files changed, 1 insertions, 162 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index fb8f701..7e12ac4 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -298,14 +298,7 @@ void PictureLayerImpl::AppendQuads(
gfx::Rect opaque_rect = iter->opaque_rect();
opaque_rect.Intersect(geometry_rect);
- // The raster_contents_scale_ is the best scale that the layer is
- // trying to produce, even though it may not be ideal. Since that's
- // the best the layer can promise in the future, consider those as
- // complete. But if a tile is ideal scale, we don't want to consider
- // it incomplete and trying to replace it with a tile at a worse
- // scale.
- if (iter->contents_scale() != raster_contents_scale_ &&
- iter->contents_scale() != ideal_contents_scale_ &&
+ if (iter->contents_scale() != ideal_contents_scale_ &&
geometry_rect.Intersects(scaled_viewport_for_tile_priority)) {
append_quads_data->num_incomplete_tiles++;
}
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 192617b..4e0172b 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -13,7 +13,6 @@
#include "cc/layers/append_quads_data.h"
#include "cc/layers/picture_layer.h"
#include "cc/quads/draw_quad.h"
-#include "cc/quads/tile_draw_quad.h"
#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_impl_proxy.h"
@@ -1551,156 +1550,6 @@ TEST_F(PictureLayerImplTest, TileOutsideOfViewportForTilePriorityNotRequired) {
EXPECT_EQ(0u, data.num_incomplete_tiles);
}
-TEST_F(PictureLayerImplTest, HighResTileIsComplete) {
- base::TimeTicks time_ticks;
- time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentBeginFrameArgs(
- CreateBeginFrameArgsForTesting(time_ticks));
-
- gfx::Size tile_size(100, 100);
- gfx::Size layer_bounds(200, 200);
-
- host_impl_.SetViewportSize(layer_bounds);
-
- scoped_refptr<FakePicturePileImpl> pending_pile =
- FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
- SetupPendingTree(pending_pile);
- ActivateTree();
-
- // All high res tiles have resources.
- active_layer_->set_fixed_tile_size(tile_size);
- host_impl_.active_tree()->UpdateDrawProperties();
- std::vector<Tile*> tiles =
- active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
- host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
-
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
- scoped_ptr<RenderPass> render_pass = RenderPass::Create();
- AppendQuadsData data;
- active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
- active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
- active_layer_->DidDraw(NULL);
-
- // All high res tiles drew, nothing was incomplete.
- EXPECT_EQ(9u, render_pass->quad_list.size());
- EXPECT_EQ(0u, data.num_missing_tiles);
- EXPECT_EQ(0u, data.num_incomplete_tiles);
-}
-
-TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) {
- base::TimeTicks time_ticks;
- time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentBeginFrameArgs(
- CreateBeginFrameArgsForTesting(time_ticks));
-
- gfx::Size tile_size(100, 100);
- gfx::Size layer_bounds(200, 200);
-
- host_impl_.SetViewportSize(layer_bounds);
-
- scoped_refptr<FakePicturePileImpl> pending_pile =
- FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
- SetupPendingTree(pending_pile);
- ActivateTree();
-
- // All high res tiles have resources except one.
- active_layer_->set_fixed_tile_size(tile_size);
- host_impl_.active_tree()->UpdateDrawProperties();
- std::vector<Tile*> high_tiles =
- active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
- high_tiles.erase(high_tiles.begin());
- host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles);
-
- // All low res tiles have resources.
- std::vector<Tile*> low_tiles =
- active_layer_->tilings()->tiling_at(1)->AllTilesForTesting();
- host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles);
-
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
- scoped_ptr<RenderPass> render_pass = RenderPass::Create();
- AppendQuadsData data;
- active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
- active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
- active_layer_->DidDraw(NULL);
-
- // The missing high res tile was replaced by a low res tile.
- EXPECT_EQ(9u, render_pass->quad_list.size());
- EXPECT_EQ(0u, data.num_missing_tiles);
- EXPECT_EQ(1u, data.num_incomplete_tiles);
-}
-
-TEST_F(PictureLayerImplTest,
- HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) {
- base::TimeTicks time_ticks;
- time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentBeginFrameArgs(
- CreateBeginFrameArgsForTesting(time_ticks));
-
- gfx::Size tile_size(100, 100);
- gfx::Size layer_bounds(200, 200);
-
- host_impl_.SetViewportSize(layer_bounds);
-
- 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);
-
- active_layer_->set_fixed_tile_size(tile_size);
-
- active_layer_->draw_properties().visible_content_rect =
- gfx::Rect(layer_bounds);
- SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.f, 1.f, 1.f, 1.f, false);
-
- // One ideal tile exists, this will get used when drawing.
- std::vector<Tile*> ideal_tiles =
- active_layer_->HighResTiling()->AllTilesForTesting();
- EXPECT_EQ(2.f, active_layer_->HighResTiling()->contents_scale());
- while (ideal_tiles.size() > 1)
- ideal_tiles.erase(ideal_tiles.begin() + 1);
- host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
- ideal_tiles);
-
- // Due to layer scale throttling, the raster contents scale is changed to 1,
- // while the ideal is still 2.
- SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, false);
- SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.f, 1.f, 1.f, 1.f, false);
-
- EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale());
- EXPECT_EQ(1.f, active_layer_->raster_contents_scale());
- EXPECT_EQ(2.f, active_layer_->ideal_contents_scale());
-
- // Both tilings still exist.
- EXPECT_EQ(2.f, active_layer_->tilings()->tiling_at(0)->contents_scale());
- EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale());
-
- // All high res tiles have resources.
- std::vector<Tile*> high_tiles =
- active_layer_->HighResTiling()->AllTilesForTesting();
- host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles);
-
- MockOcclusionTracker<LayerImpl> occlusion_tracker;
- scoped_ptr<RenderPass> render_pass = RenderPass::Create();
- AppendQuadsData data;
- active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
- active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
- active_layer_->DidDraw(NULL);
-
- // All high res tiles drew, and the one ideal res tile drew.
- ASSERT_GT(render_pass->quad_list.size(), 9u);
- EXPECT_EQ(gfx::SizeF(99.f, 99.f),
- TileDrawQuad::MaterialCast(render_pass->quad_list[0])
- ->tex_coord_rect.size());
- EXPECT_EQ(gfx::SizeF(49.5f, 49.5f),
- TileDrawQuad::MaterialCast(render_pass->quad_list[1])
- ->tex_coord_rect.size());
-
- // Neither the high res nor the ideal tiles were considered as incomplete.
- EXPECT_EQ(0u, data.num_missing_tiles);
- EXPECT_EQ(0u, data.num_incomplete_tiles);
-}
-
TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) {
gfx::Size layer_bounds(400, 400);
gfx::Size tile_size(100, 100);
diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h
index 1efb35c..4b68d7f 100644
--- a/cc/test/fake_picture_layer_impl.h
+++ b/cc/test/fake_picture_layer_impl.h
@@ -75,9 +75,6 @@ class FakePictureLayerImpl : public PictureLayerImpl {
float raster_page_scale() const { return raster_page_scale_; }
void set_raster_page_scale(float scale) { raster_page_scale_ = scale; }
- float ideal_contents_scale() const { return ideal_contents_scale_; }
- float raster_contents_scale() const { return raster_contents_scale_; }
-
PictureLayerTiling* HighResTiling() const;
PictureLayerTiling* LowResTiling() const;
size_t num_tilings() const { return tilings_->num_tilings(); }