| Index: cc/layers/picture_layer_impl_unittest.cc
|
| diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
|
| index 1628c0c5c76f384b3554af4c6afd3f333ee047fb..4238e56e8cab2180ed5b632d32b19afa19287785 100644
|
| --- a/cc/layers/picture_layer_impl_unittest.cc
|
| +++ b/cc/layers/picture_layer_impl_unittest.cc
|
| @@ -18,11 +18,12 @@
|
| #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_display_list_raster_source.h"
|
| +#include "cc/test/fake_display_list_recording_source.h"
|
| #include "cc/test/fake_impl_proxy.h"
|
| #include "cc/test/fake_layer_tree_host_impl.h"
|
| #include "cc/test/fake_output_surface.h"
|
| #include "cc/test/fake_picture_layer_impl.h"
|
| -#include "cc/test/fake_picture_pile_impl.h"
|
| #include "cc/test/geometry_test_utils.h"
|
| #include "cc/test/gpu_rasterization_enabled_settings.h"
|
| #include "cc/test/layer_test_common.h"
|
| @@ -125,26 +126,23 @@ class PictureLayerImplTest : public testing::Test {
|
| }
|
|
|
| void SetupDefaultTrees(const gfx::Size& layer_bounds) {
|
| - gfx::Size tile_size(100, 100);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(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);
|
| + SetupTrees(pending_raster_source, active_raster_source);
|
| }
|
|
|
| void SetupDefaultTreesWithInvalidation(const gfx::Size& layer_bounds,
|
| const Region& invalidation) {
|
| - gfx::Size tile_size(100, 100);
|
| -
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, invalidation);
|
| + SetupTreesWithInvalidation(pending_raster_source, active_raster_source,
|
| + invalidation);
|
| }
|
|
|
| void ActivateTree() {
|
| @@ -163,40 +161,41 @@ class PictureLayerImplTest : public testing::Test {
|
| void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds,
|
| const gfx::Size& tile_size,
|
| const Region& invalidation) {
|
| - gfx::Size pile_tile_size(100, 100);
|
| -
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(pile_tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(pile_tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size,
|
| - invalidation);
|
| + SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
|
| + tile_size, invalidation);
|
| }
|
|
|
| - void SetupTrees(
|
| - scoped_refptr<PicturePileImpl> pending_pile,
|
| - scoped_refptr<PicturePileImpl> active_pile) {
|
| - SetupPendingTree(active_pile);
|
| + void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
|
| + scoped_refptr<RasterSource> active_raster_source) {
|
| + SetupPendingTree(active_raster_source);
|
| ActivateTree();
|
| - SetupPendingTreeInternal(pending_pile, gfx::Size(), Region());
|
| + SetupPendingTreeInternal(pending_raster_source, gfx::Size(), Region());
|
| }
|
|
|
| - void SetupTreesWithInvalidation(scoped_refptr<PicturePileImpl> pending_pile,
|
| - scoped_refptr<PicturePileImpl> active_pile,
|
| - const Region& pending_invalidation) {
|
| - SetupPendingTreeInternal(active_pile, gfx::Size(), Region());
|
| + void SetupTreesWithInvalidation(
|
| + scoped_refptr<RasterSource> pending_raster_source,
|
| + scoped_refptr<RasterSource> active_raster_source,
|
| + const Region& pending_invalidation) {
|
| + SetupPendingTreeInternal(active_raster_source, gfx::Size(), Region());
|
| ActivateTree();
|
| - SetupPendingTreeInternal(pending_pile, gfx::Size(), pending_invalidation);
|
| + SetupPendingTreeInternal(pending_raster_source, gfx::Size(),
|
| + pending_invalidation);
|
| }
|
|
|
| - void SetupTreesWithFixedTileSize(scoped_refptr<PicturePileImpl> pending_pile,
|
| - scoped_refptr<PicturePileImpl> active_pile,
|
| - const gfx::Size& tile_size,
|
| - const Region& pending_invalidation) {
|
| - SetupPendingTreeInternal(active_pile, tile_size, Region());
|
| + void SetupTreesWithFixedTileSize(
|
| + scoped_refptr<RasterSource> pending_raster_source,
|
| + scoped_refptr<RasterSource> active_raster_source,
|
| + const gfx::Size& tile_size,
|
| + const Region& pending_invalidation) {
|
| + SetupPendingTreeInternal(active_raster_source, tile_size, Region());
|
| ActivateTree();
|
| - SetupPendingTreeInternal(pending_pile, tile_size, pending_invalidation);
|
| + SetupPendingTreeInternal(pending_raster_source, tile_size,
|
| + pending_invalidation);
|
| }
|
|
|
| void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
|
| @@ -241,7 +240,7 @@ class PictureLayerImplTest : public testing::Test {
|
| pending_layer->set_fixed_tile_size(tile_size);
|
| }
|
| pending_root->SetHasRenderSurface(true);
|
| - // The bounds() just mirror the pile size.
|
| + // The bounds() just mirror the raster source size.
|
| pending_layer->SetBounds(raster_source->GetSize());
|
| pending_layer->SetRasterSourceOnPending(raster_source, invalidation);
|
|
|
| @@ -280,9 +279,9 @@ class PictureLayerImplTest : public testing::Test {
|
| bool resourceless_software_draw = false;
|
| layer->UpdateTiles(resourceless_software_draw);
|
| }
|
| - static void VerifyAllPrioritizedTilesExistAndHavePile(
|
| + static void VerifyAllPrioritizedTilesExistAndHaveRasterSource(
|
| const PictureLayerTiling* tiling,
|
| - PicturePileImpl* pile) {
|
| + RasterSource* raster_source) {
|
| auto prioritized_tiles =
|
| tiling->UpdateAndGetAllPrioritizedTilesForTesting();
|
| for (PictureLayerTiling::CoverageIterator iter(
|
| @@ -292,7 +291,7 @@ class PictureLayerImplTest : public testing::Test {
|
| iter;
|
| ++iter) {
|
| EXPECT_TRUE(*iter);
|
| - EXPECT_EQ(pile, prioritized_tiles[*iter].raster_source());
|
| + EXPECT_EQ(raster_source, prioritized_tiles[*iter].raster_source());
|
| }
|
| }
|
|
|
| @@ -383,41 +382,49 @@ TEST_F(PictureLayerImplTest, TileGridAlignment) {
|
| gfx::Size layer_size(settings.default_tile_size.width() * 7 / 2,
|
| settings.default_tile_size.height() * 7 / 2);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(layer_size, layer_size);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_size);
|
|
|
| - scoped_ptr<FakePicturePile> active_recording =
|
| - FakePicturePile::CreateFilledPile(layer_size, layer_size);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFromPile(active_recording.get(), nullptr);
|
| + // Create an active recording source, but make sure it's not solid.
|
| + scoped_ptr<FakeDisplayListRecordingSource> active_recording_source =
|
| + FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_size);
|
| + active_recording_source->add_draw_rect(gfx::Rect(layer_size));
|
| + active_recording_source->add_draw_rect(
|
| + gfx::Rect(0, 0, layer_size.width() - 1, layer_size.height() - 1));
|
| + active_recording_source->Rerecord();
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFromRecordingSource(
|
| + active_recording_source.get(), false);
|
|
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupTrees(pending_raster_source, active_raster_source);
|
|
|
| - // Add 1x1 rects at the centers of each tile, then re-record pile contents
|
| + // Add 1x1 rects at the centers of each tile, then re-record recording source
|
| + // contents.
|
| active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
|
| std::vector<Tile*> tiles =
|
| active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
|
| EXPECT_EQ(16u, tiles.size());
|
| std::vector<SkRect> rects;
|
| std::vector<Tile*>::const_iterator tile_iter;
|
| + active_recording_source->reset_draws();
|
| for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
|
| gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint();
|
| gfx::Rect rect(tile_center.x(), tile_center.y(), 1, 1);
|
| - active_recording->add_draw_rect(rect);
|
| + active_recording_source->add_draw_rect(rect);
|
| rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1));
|
| }
|
|
|
| // Force re-raster with newly injected content
|
| - active_recording->RemoveRecordingAt(0, 0);
|
| - active_recording->AddRecordingAt(0, 0);
|
| + active_recording_source->Rerecord();
|
|
|
| - scoped_refptr<FakePicturePileImpl> updated_active_pile =
|
| - FakePicturePileImpl::CreateFromPile(active_recording.get(), nullptr);
|
| + scoped_refptr<FakeDisplayListRasterSource> updated_active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFromRecordingSource(
|
| + active_recording_source.get(), false);
|
|
|
| std::vector<SkRect>::const_iterator rect_iter = rects.begin();
|
| for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
|
| MockCanvas mock_canvas(1000, 1000);
|
| - updated_active_pile->PlaybackToSharedCanvas(
|
| + updated_active_raster_source->PlaybackToSharedCanvas(
|
| &mock_canvas, (*tile_iter)->content_rect(), 1.0f);
|
|
|
| // This test verifies that when drawing the contents of a specific tile
|
| @@ -431,15 +438,8 @@ TEST_F(PictureLayerImplTest, TileGridAlignment) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, CloneNoInvalidation) {
|
| - 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);
|
| -
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, Region());
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| EXPECT_EQ(pending_layer_->tilings()->num_tilings(),
|
| active_layer_->tilings()->num_tilings());
|
| @@ -452,15 +452,8 @@ TEST_F(PictureLayerImplTest, CloneNoInvalidation) {
|
|
|
| TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
| - 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);
|
| -
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, Region());
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
|
| false);
|
| @@ -541,16 +534,8 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
|
|
|
| TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
| -
|
| - 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);
|
| -
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, Region());
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
|
| false);
|
| @@ -618,15 +603,8 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
|
|
|
| TEST_F(PictureLayerImplTest, ViewportRectForTilePriorityIsCached) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
| - 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);
|
| -
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, Region());
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
|
| false);
|
| @@ -667,18 +645,18 @@ TEST_F(PictureLayerImplTest, ViewportRectForTilePriorityIsCached) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(400, 400);
|
| gfx::Rect layer_invalidation(150, 200, 30, 180);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> lost_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> lost_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTreeWithFixedTileSize(lost_pile, gfx::Size(50, 50), Region());
|
| + SetupPendingTreeWithFixedTileSize(lost_raster_source, gfx::Size(50, 50),
|
| + Region());
|
| ActivateTree();
|
| // Add a unique tiling on the active tree.
|
| PictureLayerTiling* tiling = active_layer_->AddTiling(3.f);
|
| @@ -689,8 +667,8 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
|
| active_layer_->MarkAllTilingsUsed();
|
|
|
| // Then setup a new pending tree and activate it.
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50),
|
| - layer_invalidation);
|
| + SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
|
| + gfx::Size(50, 50), layer_invalidation);
|
|
|
| EXPECT_EQ(1u, pending_layer_->num_tilings());
|
| EXPECT_EQ(3u, active_layer_->num_tilings());
|
| @@ -714,7 +692,8 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
|
| // invalidated and it has the latest raster source.
|
| if (*iter) {
|
| EXPECT_FALSE(iter.geometry_rect().IsEmpty());
|
| - EXPECT_EQ(pending_pile.get(), prioritized_tiles[*iter].raster_source());
|
| + EXPECT_EQ(pending_raster_source.get(),
|
| + prioritized_tiles[*iter].raster_source());
|
| EXPECT_TRUE(iter.geometry_rect().Intersects(content_invalidation));
|
| } else {
|
| // We don't create tiles in non-invalidated regions.
|
| @@ -739,22 +718,22 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
|
| ++iter) {
|
| EXPECT_TRUE(*iter);
|
| EXPECT_FALSE(iter.geometry_rect().IsEmpty());
|
| - // Pile will be updated upon activation.
|
| - EXPECT_EQ(active_pile.get(), prioritized_tiles[*iter].raster_source());
|
| + // Raster source will be updated upon activation.
|
| + EXPECT_EQ(active_raster_source.get(),
|
| + prioritized_tiles[*iter].raster_source());
|
| }
|
| }
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, CloneFullInvalidation) {
|
| - gfx::Size tile_size(90, 80);
|
| gfx::Size layer_bounds(300, 500);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupTreesWithInvalidation(pending_pile, active_pile,
|
| + SetupTreesWithInvalidation(pending_raster_source, active_raster_source,
|
| gfx::Rect(layer_bounds));
|
|
|
| EXPECT_EQ(pending_layer_->tilings()->num_tilings(),
|
| @@ -762,21 +741,15 @@ TEST_F(PictureLayerImplTest, CloneFullInvalidation) {
|
|
|
| const PictureLayerTilingSet* tilings = pending_layer_->tilings();
|
| EXPECT_GT(tilings->num_tilings(), 0u);
|
| - for (size_t i = 0; i < tilings->num_tilings(); ++i)
|
| - VerifyAllPrioritizedTilesExistAndHavePile(tilings->tiling_at(i),
|
| - pending_pile.get());
|
| + for (size_t i = 0; i < tilings->num_tilings(); ++i) {
|
| + VerifyAllPrioritizedTilesExistAndHaveRasterSource(
|
| + tilings->tiling_at(i), pending_raster_source.get());
|
| + }
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| EXPECT_LT(low_res_factor, 1.f);
|
| @@ -844,15 +817,8 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| EXPECT_LT(low_res_factor, 1.f);
|
| @@ -915,19 +881,18 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
|
| // This test makes sure that if a layer can have tilings, then a commit makes
|
| // it not able to have tilings (empty size), and then a future commit that
|
| // makes it valid again should be able to create tilings.
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| - scoped_refptr<FakePicturePileImpl> empty_pile =
|
| - FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> valid_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> empty_raster_source =
|
| + FakeDisplayListRasterSource::CreateEmpty(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTree(valid_pile);
|
| + SetupPendingTree(valid_raster_source);
|
| ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
|
|
| ActivateTree();
|
| - SetupPendingTree(empty_pile);
|
| + SetupPendingTree(empty_raster_source);
|
| EXPECT_FALSE(pending_layer_->CanHaveTilings());
|
| ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
|
| ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings());
|
| @@ -936,25 +901,24 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
|
| EXPECT_FALSE(active_layer_->CanHaveTilings());
|
| ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
|
|
|
| - SetupPendingTree(valid_pile);
|
| + SetupPendingTree(valid_raster_source);
|
| ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, LowResTilingStaysOnActiveTree) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| - scoped_refptr<FakePicturePileImpl> valid_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> other_valid_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> other_valid_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTree(valid_pile);
|
| + SetupPendingTree(valid_raster_source);
|
| ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
|
|
| ActivateTree();
|
| - SetupPendingTree(other_valid_pile);
|
| + SetupPendingTree(other_valid_raster_source);
|
| ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
|
| ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| auto* low_res_tiling =
|
| @@ -970,16 +934,10 @@ TEST_F(PictureLayerImplTest, LowResTilingStaysOnActiveTree) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ZoomOutCrash) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| // Set up the high and low res tilings before pinch zoom.
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
| ResetTilingsAndRasterScales();
|
| EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
|
| SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, 1.0f, 0.f, false);
|
| @@ -991,18 +949,11 @@ TEST_F(PictureLayerImplTest, ZoomOutCrash) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, PinchGestureTilings) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| -
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| -
|
| // Set up the high and low res tilings before pinch zoom.
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupDefaultTrees(layer_bounds);
|
| ResetTilingsAndRasterScales();
|
|
|
| SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, 0.f, false);
|
| @@ -1080,15 +1031,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
|
| - gfx::Size tile_size(300, 300);
|
| gfx::Size layer_bounds(2600, 3800);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| ResetTilingsAndRasterScales();
|
| EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
|
| @@ -1140,14 +1084,8 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, CleanUpTilings) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| -
|
| std::vector<PictureLayerTiling*> used_tilings;
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| @@ -1156,7 +1094,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
|
| float scale = 1.f;
|
| float page_scale = 1.f;
|
|
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupDefaultTrees(layer_bounds);
|
| EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
|
| EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale());
|
|
|
| @@ -1323,14 +1261,13 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
|
|
|
| TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
|
| gfx::Size layer_bounds(host_impl_.settings().default_tile_size);
|
| - gfx::Size tile_size(100, 100);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupTrees(pending_raster_source, active_raster_source);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| float device_scale = 1.f;
|
| @@ -1375,7 +1312,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
|
| // Mask layers dont create low res since they always fit on one tile.
|
| scoped_ptr<FakePictureLayerImpl> mask =
|
| FakePictureLayerImpl::CreateMaskWithRasterSource(
|
| - host_impl_.pending_tree(), 3, pending_pile);
|
| + host_impl_.pending_tree(), 3, pending_raster_source);
|
| mask->SetBounds(layer_bounds);
|
| mask->SetDrawsContent(true);
|
|
|
| @@ -1389,16 +1326,15 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
|
| TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
|
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| - scoped_refptr<FakePicturePileImpl> valid_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(valid_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTree(valid_raster_source);
|
|
|
| scoped_ptr<FakePictureLayerImpl> mask_ptr =
|
| FakePictureLayerImpl::CreateMaskWithRasterSource(
|
| - host_impl_.pending_tree(), 3, valid_pile);
|
| + host_impl_.pending_tree(), 3, valid_raster_source);
|
| mask_ptr->SetBounds(layer_bounds);
|
| mask_ptr->SetDrawsContent(true);
|
| pending_layer_->SetMaskLayer(mask_ptr.Pass());
|
| @@ -1447,12 +1383,12 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
|
| // Resize larger than the max texture size.
|
| int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size;
|
| gfx::Size huge_bounds(max_texture_size + 1, 10);
|
| - scoped_refptr<FakePicturePileImpl> huge_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, huge_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> huge_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(huge_bounds);
|
|
|
| - SetupPendingTree(huge_pile);
|
| + SetupPendingTree(huge_raster_source);
|
| pending_mask->SetBounds(huge_bounds);
|
| - pending_mask->SetRasterSourceOnPending(huge_pile, Region());
|
| + pending_mask->SetRasterSourceOnPending(huge_raster_source, Region());
|
|
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
| host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
|
| @@ -1488,7 +1424,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
|
| EXPECT_EQ(expected_size, mask_texture_size);
|
|
|
| // Do another activate, the same holds.
|
| - SetupPendingTree(huge_pile);
|
| + SetupPendingTree(huge_raster_source);
|
| ActivateTree();
|
| EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size());
|
| active_layer_->GetContentsResourceId(&mask_resource_id, &mask_texture_size);
|
| @@ -1499,12 +1435,12 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
|
| // contents scale. Then the layer should no longer have any tiling.
|
| float min_contents_scale = host_impl_.settings().minimum_contents_scale;
|
| gfx::Size extra_huge_bounds(max_texture_size / min_contents_scale + 1, 10);
|
| - scoped_refptr<FakePicturePileImpl> extra_huge_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, extra_huge_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> extra_huge_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(extra_huge_bounds);
|
|
|
| - SetupPendingTree(extra_huge_pile);
|
| + SetupPendingTree(extra_huge_raster_source);
|
| pending_mask->SetBounds(extra_huge_bounds);
|
| - pending_mask->SetRasterSourceOnPending(extra_huge_pile, Region());
|
| + pending_mask->SetRasterSourceOnPending(extra_huge_raster_source, Region());
|
|
|
| EXPECT_FALSE(pending_mask->CanHaveTilings());
|
|
|
| @@ -1517,18 +1453,17 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
|
| TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
|
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| host_impl_.SetDeviceScaleFactor(1.3f);
|
|
|
| - scoped_refptr<FakePicturePileImpl> valid_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(valid_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTree(valid_raster_source);
|
|
|
| scoped_ptr<FakePictureLayerImpl> mask_ptr =
|
| FakePictureLayerImpl::CreateMaskWithRasterSource(
|
| - host_impl_.pending_tree(), 3, valid_pile);
|
| + host_impl_.pending_tree(), 3, valid_raster_source);
|
| mask_ptr->SetBounds(layer_bounds);
|
| mask_ptr->SetDrawsContent(true);
|
| pending_layer_->SetMaskLayer(mask_ptr.Pass());
|
| @@ -1567,15 +1502,8 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ReleaseResources) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
| EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
|
|
| // All tilings should be removed when losing output surface.
|
| @@ -1600,14 +1528,12 @@ TEST_F(PictureLayerImplTest, ReleaseResources) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ClampTilesToMaxTileSize) {
|
| - // The default max tile size is larger than 400x400.
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(5000, 5000);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
| EXPECT_GE(pending_layer_->tilings()->num_tilings(), 1u);
|
|
|
| pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
|
| @@ -1643,16 +1569,8 @@ TEST_F(PictureLayerImplTest, ClampTilesToMaxTileSize) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) {
|
| - // The default max tile size is larger than 400x400.
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(500, 500);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
| EXPECT_GE(active_layer_->tilings()->num_tilings(), 1u);
|
|
|
| active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
|
| @@ -1695,17 +1613,11 @@ TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) {
|
| TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) {
|
| scoped_ptr<RenderPass> render_pass = RenderPass::Create();
|
|
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| gfx::Rect layer_rect(layer_bounds);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| -
|
| gfx::Rect layer_invalidation(150, 200, 30, 180);
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, layer_invalidation);
|
| + SetupDefaultTreesWithInvalidation(layer_bounds, layer_invalidation);
|
|
|
| active_layer_->SetContentsOpaque(true);
|
| active_layer_->draw_properties().visible_layer_rect = gfx::Rect(layer_bounds);
|
| @@ -1715,7 +1627,7 @@ TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) {
|
| active_layer_->AppendQuads(render_pass.get(), &data);
|
| active_layer_->DidDraw(nullptr);
|
|
|
| - ASSERT_EQ(1U, render_pass->quad_list.size());
|
| + ASSERT_EQ(1u, render_pass->quad_list.size());
|
| EXPECT_EQ(DrawQuad::PICTURE_CONTENT,
|
| render_pass->quad_list.front()->material);
|
| EXPECT_EQ(render_pass->quad_list.front()->rect, layer_rect);
|
| @@ -1732,11 +1644,11 @@ TEST_F(PictureLayerImplTest, ResourcelessPartialRecording) {
|
| host_impl_.SetDeviceScaleFactor(2.f);
|
|
|
| gfx::Rect recorded_viewport(20, 30, 40, 50);
|
| - bool is_filled = true;
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreatePile(tile_size, layer_bounds,
|
| - recorded_viewport, is_filled);
|
| - SetupPendingTree(active_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
|
| + recorded_viewport);
|
| +
|
| + SetupPendingTree(active_raster_source);
|
| ActivateTree();
|
|
|
| active_layer_->SetContentsOpaque(true);
|
| @@ -1764,12 +1676,11 @@ TEST_F(PictureLayerImplTest, ResourcelessPartialRecording) {
|
| TEST_F(PictureLayerImplTest, ResourcelessEmptyRecording) {
|
| scoped_ptr<RenderPass> render_pass = RenderPass::Create();
|
|
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(700, 650);
|
| -
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
|
| - SetupPendingTree(active_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
|
| + gfx::Rect());
|
| + SetupPendingTree(active_raster_source);
|
| ActivateTree();
|
|
|
| active_layer_->SetContentsOpaque(true);
|
| @@ -1786,20 +1697,15 @@ TEST_F(PictureLayerImplTest, ResourcelessEmptyRecording) {
|
| TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) {
|
| scoped_ptr<RenderPass> render_pass = RenderPass::Create();
|
|
|
| - gfx::Size tile_size(1000, 1000);
|
| gfx::Size layer_bounds(1500, 1500);
|
| gfx::Rect visible_rect(250, 250, 1000, 1000);
|
|
|
| - scoped_ptr<FakePicturePile> empty_recording =
|
| - FakePicturePile::CreateEmptyPile(tile_size, layer_bounds);
|
| - empty_recording->SetIsSolidColor(true);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFromPile(empty_recording.get(), nullptr);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFromPile(empty_recording.get(), nullptr);
|
| -
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupTrees(pending_raster_source, active_raster_source);
|
|
|
| active_layer_->draw_properties().visible_layer_rect = visible_rect;
|
|
|
| @@ -1818,29 +1724,26 @@ TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) {
|
| EXPECT_TRUE(remaining.IsEmpty());
|
| }
|
|
|
| -TEST_F(PictureLayerImplTest, TileScalesWithSolidColorPile) {
|
| +TEST_F(PictureLayerImplTest, TileScalesWithSolidColorRasterSource) {
|
| gfx::Size layer_bounds(200, 200);
|
| - gfx::Size tile_size(host_impl_.settings().default_tile_size);
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
|
| - tile_size, layer_bounds, false);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
|
| - tile_size, layer_bounds, true);
|
| -
|
| - SetupTrees(pending_pile, active_pile);
|
| - // Solid color pile should not allow tilings at any scale.
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds);
|
| +
|
| + SetupTrees(pending_raster_source, active_raster_source);
|
| + // Solid color raster source should not allow tilings at any scale.
|
| EXPECT_FALSE(active_layer_->CanHaveTilings());
|
| EXPECT_EQ(0.f, active_layer_->ideal_contents_scale());
|
|
|
| - // Activate non-solid-color pending pile makes active layer can have tilings.
|
| + // Activate non-solid-color pending raster source makes active layer can have
|
| + // tilings.
|
| ActivateTree();
|
| EXPECT_TRUE(active_layer_->CanHaveTilings());
|
| EXPECT_GT(active_layer_->ideal_contents_scale(), 0.f);
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) {
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(200, 200);
|
|
|
| gfx::Transform transform;
|
| @@ -1854,9 +1757,10 @@ TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) {
|
| transform,
|
| resourceless_software_draw);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, gfx::Size(100, 100),
|
| + Region());
|
|
|
| EXPECT_EQ(1u, pending_layer_->num_tilings());
|
| EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority());
|
| @@ -1895,11 +1799,7 @@ TEST_F(NoLowResPictureLayerImplTest,
|
| gfx::Rect external_viewport_for_tile_priority(400, 200);
|
| gfx::Rect visible_layer_rect(200, 400);
|
|
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
|
| + SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
|
|
|
| ASSERT_EQ(1u, pending_layer_->num_tilings());
|
| ASSERT_EQ(1.f, pending_layer_->HighResTiling()->contents_scale());
|
| @@ -1978,10 +1878,10 @@ TEST_F(PictureLayerImplTest, HighResTileIsComplete) {
|
| gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(200, 200);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
| ActivateTree();
|
|
|
| // All high res tiles have resources.
|
| @@ -2008,9 +1908,9 @@ TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) {
|
| gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(200, 200);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
| ActivateTree();
|
|
|
| scoped_ptr<RenderPass> render_pass = RenderPass::Create();
|
| @@ -2031,9 +1931,9 @@ TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) {
|
| gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(200, 200);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
| ActivateTree();
|
|
|
| std::vector<Tile*> low_tiles =
|
| @@ -2058,9 +1958,9 @@ TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) {
|
| gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(200, 200);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
| ActivateTree();
|
|
|
| // All high res tiles have resources except one.
|
| @@ -2098,11 +1998,7 @@ TEST_F(PictureLayerImplTest,
|
| host_impl_.SetViewportSize(viewport_size);
|
| host_impl_.SetDeviceScaleFactor(2.f);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
|
| + SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
|
|
|
| // One ideal tile exists, this will get used when drawing.
|
| std::vector<Tile*> ideal_tiles;
|
| @@ -2244,18 +2140,18 @@ TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
|
| gfx::Size layer_bounds(400, 400);
|
| gfx::Size tile_size(100, 100);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - // This pile will create tilings, but has no recordings so will not create any
|
| - // tiles. This is attempting to simulate scrolling past the end of recorded
|
| - // content on the active layer, where the recordings are so far away that
|
| - // no tiles are created.
|
| - bool is_solid_color = false;
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
|
| - tile_size, layer_bounds, is_solid_color);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + // This raster source will create tilings, but has no recordings so will not
|
| + // create any tiles. This is attempting to simulate scrolling past the end of
|
| + // recorded content on the active layer, where the recordings are so far away
|
| + // that no tiles are created.
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
|
| + gfx::Rect());
|
|
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
|
| + SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
|
| + tile_size, Region());
|
|
|
| // Active layer has tilings, but no tiles due to missing recordings.
|
| EXPECT_TRUE(active_layer_->CanHaveTilings());
|
| @@ -2274,11 +2170,12 @@ TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) {
|
| gfx::Size layer_bounds(400, 400);
|
| gfx::Size tile_size(100, 100);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateEmpty(layer_bounds);
|
| + SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
|
| + tile_size, Region());
|
|
|
| // Active layer can't have tiles.
|
| EXPECT_FALSE(active_layer_->CanHaveTilings());
|
| @@ -2298,12 +2195,13 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) {
|
| gfx::Size active_layer_bounds(200, 200);
|
| gfx::Size tile_size(100, 100);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, pending_layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, active_layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(pending_layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(active_layer_bounds);
|
|
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
|
| + SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
|
| + tile_size, Region());
|
|
|
| // Since the active layer has different bounds, the pending layer needs all
|
| // high res tiles in order to activate.
|
| @@ -2318,17 +2216,16 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) {
|
| - 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<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| host_impl_.CreatePendingTree();
|
| LayerTreeImpl* pending_tree = host_impl_.pending_tree();
|
|
|
| scoped_ptr<FakePictureLayerImpl> pending_layer =
|
| FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_,
|
| - pending_pile);
|
| + pending_raster_source);
|
| pending_layer->SetDrawsContent(true);
|
| pending_tree->SetRootLayer(pending_layer.Pass());
|
|
|
| @@ -2353,12 +2250,11 @@ TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) {
|
|
|
| TEST_F(PictureLayerImplTest, ShareTilesOnNextFrame) {
|
| gfx::Size layer_bounds(1500, 1500);
|
| - gfx::Size tile_size(100, 100);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
|
|
| PictureLayerTiling* tiling = pending_layer_->HighResTiling();
|
| gfx::Rect first_invalidate = tiling->TilingDataForTesting().TileBounds(0, 0);
|
| @@ -2371,18 +2267,16 @@ TEST_F(PictureLayerImplTest, ShareTilesOnNextFrame) {
|
| ActivateTree();
|
|
|
| // Make a pending tree with an invalidated raster tile 0,0.
|
| - SetupPendingTreeWithInvalidation(pending_pile, first_invalidate);
|
| + SetupPendingTreeWithInvalidation(pending_raster_source, first_invalidate);
|
|
|
| // Activate and make a pending tree with an invalidated raster tile 1,1.
|
| ActivateTree();
|
|
|
| - SetupPendingTreeWithInvalidation(pending_pile, second_invalidate);
|
| + SetupPendingTreeWithInvalidation(pending_raster_source, second_invalidate);
|
|
|
| PictureLayerTiling* pending_tiling = pending_layer_->tilings()->tiling_at(0);
|
| PictureLayerTiling* active_tiling = active_layer_->tilings()->tiling_at(0);
|
|
|
| - // pending_tiling->CreateAllTilesForTesting();
|
| -
|
| // Tile 0,0 not exist on pending, but tile 1,1 should.
|
| EXPECT_TRUE(active_tiling->TileAt(0, 0));
|
| EXPECT_TRUE(active_tiling->TileAt(1, 0));
|
| @@ -2435,20 +2329,20 @@ TEST_F(PictureLayerImplTest, PendingHasNoTilesWithNoInvalidation) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, ShareInvalidActiveTreeTiles) {
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(1500, 1500);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, gfx::Rect(1, 1));
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupTreesWithInvalidation(pending_raster_source, active_raster_source,
|
| + gfx::Rect(1, 1));
|
| // Activate the invalidation.
|
| ActivateTree();
|
| // Make another pending tree without any invalidation in it.
|
| - scoped_refptr<FakePicturePileImpl> pending_pile2 =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(pending_pile2);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source2 =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTree(pending_raster_source2);
|
|
|
| EXPECT_GE(active_layer_->num_tilings(), 1u);
|
| EXPECT_GE(pending_layer_->num_tilings(), 1u);
|
| @@ -2500,15 +2394,14 @@ TEST_F(PictureLayerImplTest, RecreateInvalidPendingTreeTiles) {
|
| TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
|
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(10, 10);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupTrees(pending_raster_source, active_raster_source);
|
|
|
| EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f));
|
| EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f));
|
| @@ -2532,7 +2425,7 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) {
|
| ActivateTree();
|
| EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f));
|
|
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
| EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f));
|
|
|
| // Toggling the gpu rasterization clears all tilings on both trees.
|
| @@ -2551,14 +2444,12 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) {
|
| - gfx::Size tile_size(100, 100);
|
| -
|
| // Put 0.5 as high res.
|
| host_impl_.SetDeviceScaleFactor(0.5f);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(10, 10));
|
| - SetupPendingTree(pending_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10));
|
| + SetupPendingTree(pending_raster_source);
|
|
|
| // Sanity checks.
|
| EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| @@ -2567,9 +2458,9 @@ TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) {
|
| ActivateTree();
|
|
|
| // Now, set the bounds to be 1x1, so that minimum contents scale becomes 1.
|
| - pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(1, 1));
|
| - SetupPendingTree(pending_pile);
|
| + pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1));
|
| + SetupPendingTree(pending_raster_source);
|
|
|
| // Another sanity check.
|
| EXPECT_EQ(1.f, pending_layer_->MinimumContentsScale());
|
| @@ -2982,13 +2873,12 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueue) {
|
|
|
| host_impl_.SetViewportSize(gfx::Size(500, 500));
|
|
|
| - gfx::Size recording_tile_size(100, 100);
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(recording_tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
| EXPECT_EQ(1u, pending_layer_->num_tilings());
|
|
|
| std::set<Tile*> unique_tiles;
|
| @@ -3116,13 +3006,12 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) {
|
|
|
| host_impl_.SetViewportSize(gfx::Size(500, 500));
|
|
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
| ActivateTree();
|
| EXPECT_EQ(2u, active_layer_->num_tilings());
|
|
|
| @@ -3145,15 +3034,11 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, TilingSetRasterQueueRequiredNoHighRes) {
|
| - scoped_ptr<FakePicturePile> empty_recording =
|
| - FakePicturePile::CreateEmptyPile(gfx::Size(256, 256),
|
| - gfx::Size(1024, 1024));
|
| - empty_recording->SetIsSolidColor(true);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilledSolidColor(
|
| + gfx::Size(1024, 1024));
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFromPile(empty_recording.get(), nullptr);
|
| -
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
| EXPECT_FALSE(
|
| pending_layer_->picture_layer_tiling_set()->FindTilingWithResolution(
|
| HIGH_RESOLUTION));
|
| @@ -3166,18 +3051,17 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueueRequiredNoHighRes) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) {
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(1000, 1000);
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
|
|
| host_impl_.SetViewportSize(gfx::Size(500, 500));
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| // TODO(vmpstr): Add a test with tilings other than high res on the active
|
| // tree (crbug.com/519607).
|
| - SetupPendingTree(pending_pile);
|
| + SetupPendingTree(pending_raster_source);
|
| EXPECT_EQ(1u, pending_layer_->num_tilings());
|
|
|
| std::vector<Tile*> all_tiles;
|
| @@ -3317,9 +3201,9 @@ TEST_F(PictureLayerImplTest, Occlusion) {
|
| LayerTestCommon::LayerImplTest impl;
|
| host_impl_.SetViewportSize(viewport_size);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(layer_bounds, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
| ActivateTree();
|
|
|
| std::vector<Tile*> tiles =
|
| @@ -3460,15 +3344,8 @@ TEST_F(PictureLayerImplTest, ActiveHighResReadyNotEnoughToActivate) {
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| EXPECT_LT(low_res_factor, 1.f);
|
| @@ -3525,15 +3402,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| EXPECT_LT(low_res_factor, 1.f);
|
| @@ -3617,18 +3487,18 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
|
| gfx::Size layer_bounds(400, 400);
|
| gfx::Size tile_size(100, 100);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - // This pile will create tilings, but has no recordings so will not create any
|
| - // tiles. This is attempting to simulate scrolling past the end of recorded
|
| - // content on the active layer, where the recordings are so far away that
|
| - // no tiles are created.
|
| - bool is_solid_color = false;
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
|
| - tile_size, layer_bounds, is_solid_color);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + // This raster source will create tilings, but has no recordings so will not
|
| + // create any tiles. This is attempting to simulate scrolling past the end of
|
| + // recorded content on the active layer, where the recordings are so far away
|
| + // that no tiles are created.
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
|
| + gfx::Rect());
|
|
|
| - SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
|
| + SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
|
| + tile_size, Region());
|
|
|
| // Active layer has tilings, but no tiles due to missing recordings.
|
| EXPECT_TRUE(active_layer_->CanHaveTilings());
|
| @@ -3649,16 +3519,8 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
| -
|
| - 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);
|
| -
|
| - SetupTreesWithInvalidation(pending_pile, active_pile, Region());
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
|
| false);
|
| @@ -3725,17 +3587,9 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| -
|
| std::vector<PictureLayerTiling*> used_tilings;
|
| -
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| EXPECT_LT(low_res_factor, 1.f);
|
| @@ -3842,15 +3696,8 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
| EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
|
| EXPECT_EQ(1u, active_layer_->tilings()->num_tilings());
|
|
|
| @@ -3878,17 +3725,9 @@ TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) {
|
| TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) {
|
| scoped_ptr<RenderPass> render_pass = RenderPass::Create();
|
|
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1000, 2000);
|
| -
|
| host_impl_.SetViewportSize(gfx::Size(10000, 20000));
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| ResetTilingsAndRasterScales();
|
| SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.5f, 1.f, 1.f, 1.f, 0.f,
|
| @@ -3936,13 +3775,12 @@ TEST_F(PictureLayerImplTestWithDelegatingRenderer,
|
| DelegatingRendererWithTileOOM) {
|
| // This test is added for crbug.com/402321, where quad should be produced when
|
| // raster on demand is not allowed and tile is OOM.
|
| - gfx::Size tile_size = host_impl_.settings().default_tile_size;
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| // Create tiles.
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(pending_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTree(pending_raster_source);
|
| pending_layer_->SetBounds(layer_bounds);
|
| ActivateTree();
|
| bool update_lcd_text = false;
|
| @@ -3957,6 +3795,7 @@ TEST_F(PictureLayerImplTestWithDelegatingRenderer,
|
| // state. We also need to update tree priority separately.
|
| GlobalStateThatImpactsTilePriority state;
|
| size_t max_tiles = 1;
|
| + gfx::Size tile_size(host_impl_.settings().default_tile_size);
|
| size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height();
|
| size_t resource_limit = max_tiles;
|
| ManagedMemoryPolicy policy(memory_limit,
|
| @@ -4046,9 +3885,9 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
|
|
|
| host_impl_.SetViewportSize(viewport_size);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
|
|
| // No occlusion.
|
| int unoccluded_tile_count = 0;
|
| @@ -4135,9 +3974,9 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
|
|
|
| host_impl_.SetViewportSize(viewport_size);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
|
|
| // No occlusion.
|
| int occluded_tile_count = 0;
|
| @@ -4250,12 +4089,12 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) {
|
| gfx::Size viewport_size(500, 500);
|
| gfx::Point occluding_layer_position(310, 0);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| host_impl_.SetViewportSize(viewport_size);
|
|
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
| ASSERT_TRUE(pending_layer_->CanHaveTilings());
|
|
|
| pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1));
|
| @@ -4318,19 +4157,18 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) {
|
| }
|
|
|
| TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
|
| - gfx::Size tile_size(102, 102);
|
| gfx::Size layer_bounds(1000, 1000);
|
| gfx::Size viewport_size(1000, 1000);
|
| gfx::Point occluding_layer_position(310, 0);
|
| gfx::Rect invalidation_rect(230, 230, 102, 102);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| host_impl_.SetViewportSize(viewport_size);
|
| - SetupPendingTree(active_pile);
|
| + SetupPendingTree(active_raster_source);
|
|
|
| // Partially occlude the active layer.
|
| pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2));
|
| @@ -4364,7 +4202,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
|
| }
|
|
|
| // Partially invalidate the pending layer.
|
| - SetupPendingTreeWithInvalidation(pending_pile, invalidation_rect);
|
| + SetupPendingTreeWithInvalidation(pending_raster_source, invalidation_rect);
|
|
|
| for (size_t i = 0; i < active_layer_->num_tilings(); ++i) {
|
| PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i);
|
| @@ -4418,12 +4256,12 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
|
| host_impl_.SetViewportSize(viewport_size);
|
| host_impl_.SetDeviceScaleFactor(2.f);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTreeWithFixedTileSize(active_pile, tile_size, Region());
|
| + SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region());
|
|
|
| // Partially occlude the active layer.
|
| pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2));
|
| @@ -4437,7 +4275,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
|
|
|
| // Partially invalidate the pending layer. Tiles inside the invalidation rect
|
| // are created.
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, invalidation_rect);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size,
|
| + invalidation_rect);
|
|
|
| // Partially occlude the pending layer in a different way.
|
| pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 3));
|
| @@ -4553,18 +4392,17 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) {
|
| - gfx::Size tile_size(102, 102);
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTree(raster_source);
|
| EXPECT_FALSE(pending_layer_->GetPendingOrActiveTwinLayer());
|
|
|
| ActivateTree();
|
| EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
|
|
|
| - SetupPendingTree(pile);
|
| + SetupPendingTree(raster_source);
|
| EXPECT_TRUE(pending_layer_->GetPendingOrActiveTwinLayer());
|
| EXPECT_TRUE(active_layer_->GetPendingOrActiveTwinLayer());
|
| EXPECT_EQ(pending_layer_, active_layer_->GetPendingOrActiveTwinLayer());
|
| @@ -4701,15 +4539,8 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
|
| TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
|
|
| - gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(400, 4000);
|
| -
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| Region invalidation;
|
| gfx::Rect viewport = gfx::Rect(0, 0, 100, 100);
|
| @@ -4767,19 +4598,14 @@ TEST_F(PictureLayerImplTest, CloneMissingRecordings) {
|
| gfx::Size tile_size(100, 100);
|
| gfx::Size layer_bounds(400, 400);
|
|
|
| - scoped_refptr<FakePicturePileImpl> filled_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> filled_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - scoped_ptr<FakePicturePile> partial_recording =
|
| - FakePicturePile::CreateEmptyPile(tile_size, layer_bounds);
|
| - for (int i = 1; i < partial_recording->tiling().num_tiles_x(); ++i) {
|
| - for (int j = 1; j < partial_recording->tiling().num_tiles_y(); ++j)
|
| - partial_recording->AddRecordingAt(i, j);
|
| - }
|
| - scoped_refptr<FakePicturePileImpl> partial_pile =
|
| - FakePicturePileImpl::CreateFromPile(partial_recording.get(), nullptr);
|
| + scoped_refptr<FakeDisplayListRasterSource> partial_raster_source =
|
| + FakeDisplayListRasterSource::CreatePartiallyFilled(
|
| + layer_bounds, gfx::Rect(100, 100, 300, 300));
|
|
|
| - SetupPendingTreeWithFixedTileSize(filled_pile, tile_size, Region());
|
| + SetupPendingTreeWithFixedTileSize(filled_raster_source, tile_size, Region());
|
| ActivateTree();
|
|
|
| PictureLayerTiling* pending_tiling = old_pending_layer_->HighResTiling();
|
| @@ -4789,10 +4615,10 @@ TEST_F(PictureLayerImplTest, CloneMissingRecordings) {
|
| EXPECT_EQ(0u, pending_tiling->AllTilesForTesting().size());
|
| EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
|
|
|
| - // Now put a partially-recorded pile on the pending tree (and invalidate
|
| - // everything, since the main thread PicturePile will invalidate dropped
|
| - // recordings). This will cause us to be missing some tiles.
|
| - SetupPendingTreeWithFixedTileSize(partial_pile, tile_size,
|
| + // Now put a partially-recorded raster source on the pending tree (and
|
| + // invalidate everything, since the main thread recording will invalidate
|
| + // dropped recordings). This will cause us to be missing some tiles.
|
| + SetupPendingTreeWithFixedTileSize(partial_raster_source, tile_size,
|
| Region(gfx::Rect(layer_bounds)));
|
| EXPECT_EQ(3u * 3u, pending_tiling->AllTilesForTesting().size());
|
| EXPECT_FALSE(pending_tiling->TileAt(0, 0));
|
| @@ -4811,7 +4637,7 @@ TEST_F(PictureLayerImplTest, CloneMissingRecordings) {
|
|
|
| // Now put a full recording on the pending tree again. We'll get all our tiles
|
| // back.
|
| - SetupPendingTreeWithFixedTileSize(filled_pile, tile_size,
|
| + SetupPendingTreeWithFixedTileSize(filled_raster_source, tile_size,
|
| Region(gfx::Rect(layer_bounds)));
|
| EXPECT_EQ(5u * 5u, pending_tiling->AllTilesForTesting().size());
|
| Tile* tile00 = pending_tiling->TileAt(0, 0);
|
| @@ -4839,12 +4665,12 @@ TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) {
|
| host_impl_.SetViewportSize(viewport_size);
|
| host_impl_.SetDeviceScaleFactor(1.f);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
|
|
| - SetupPendingTreeWithFixedTileSize(active_pile, tile_size, Region());
|
| + SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region());
|
|
|
| ActivateTree();
|
| EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles());
|
| @@ -4857,7 +4683,8 @@ TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) {
|
| gfx::Transform(), // transform_for_tile_priority
|
| false);
|
|
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, gfx::Rect());
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size,
|
| + gfx::Rect());
|
|
|
| EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles());
|
| EXPECT_TRUE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
|
| @@ -4873,7 +4700,8 @@ TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) {
|
| gfx::Transform(), // transform_for_tile_priority
|
| false);
|
|
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, gfx::Rect());
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size,
|
| + gfx::Rect());
|
|
|
| EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles());
|
| EXPECT_FALSE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
|
| @@ -4885,19 +4713,13 @@ TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) {
|
| TEST_F(PictureLayerImplTest, ScrollPropagatesToPending) {
|
| host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
|
|
|
| - gfx::Size tile_size(102, 102);
|
| gfx::Size layer_bounds(1000, 1000);
|
| gfx::Size viewport_size(100, 100);
|
|
|
| host_impl_.SetViewportSize(viewport_size);
|
| host_impl_.SetDeviceScaleFactor(1.f);
|
|
|
| - 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);
|
| + SetupDefaultTrees(layer_bounds);
|
|
|
| active_layer_->SetCurrentScrollOffset(gfx::ScrollOffset(0.0, 50.0));
|
| host_impl_.active_tree()->UpdateDrawProperties(false);
|
| @@ -4924,9 +4746,9 @@ TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) {
|
| host_impl_.SetViewportSize(viewport_size);
|
| host_impl_.SetDeviceScaleFactor(1.f);
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region());
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilledLCD(layer_bounds);
|
| + SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
|
|
|
| EXPECT_TRUE(pending_layer_->RasterSourceUsesLCDText());
|
| EXPECT_TRUE(pending_layer_->HighResTiling()->has_tiles());
|
| @@ -4943,7 +4765,7 @@ TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) {
|
| pending_layer_->UpdateCanUseLCDTextAfterCommit();
|
|
|
| EXPECT_FALSE(pending_layer_->RasterSourceUsesLCDText());
|
| - EXPECT_NE(pending_pile.get(), pending_layer_->raster_source());
|
| + EXPECT_NE(pending_raster_source.get(), pending_layer_->raster_source());
|
| EXPECT_TRUE(pending_layer_->HighResTiling()->has_tiles());
|
| tiles = pending_layer_->HighResTiling()->AllTilesForTesting();
|
| prioritized_tiles = pending_layer_->HighResTiling()
|
| @@ -4959,9 +4781,9 @@ TEST_F(PictureLayerImplTest, TilingAllTilesDone) {
|
| gfx::Size layer_bounds(1000, 1000);
|
|
|
| // Create tiles.
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(pending_pile);
|
| + scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
|
| + FakeDisplayListRasterSource::CreateFilled(layer_bounds);
|
| + SetupPendingTree(pending_raster_source);
|
| pending_layer_->SetBounds(layer_bounds);
|
| ActivateTree();
|
| host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
|
| @@ -5070,18 +4892,10 @@ TEST_F(TileSizeTest, TileSizes) {
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
| -
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| -
|
| - // Set up the high and low res tilings before pinch zoom.
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupDefaultTrees(layer_bounds);
|
| ResetTilingsAndRasterScales();
|
|
|
| float page_scale = 2.f;
|
| @@ -5100,18 +4914,11 @@ TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) {
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
|
| - gfx::Size tile_size(400, 400);
|
| gfx::Size layer_bounds(1300, 1900);
|
|
|
| float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
|
|
|
| - scoped_refptr<FakePicturePileImpl> pending_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - scoped_refptr<FakePicturePileImpl> active_pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| -
|
| - // Set up the high and low res tilings before pinch zoom.
|
| - SetupTrees(pending_pile, active_pile);
|
| + SetupDefaultTrees(layer_bounds);
|
| ResetTilingsAndRasterScales();
|
|
|
| float page_scale = 4.f;
|
|
|