Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: cc/tiles/picture_layer_tiling_unittest.cc

Issue 2651413004: cc: Fix tile priority inversion in picture layer tiling. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/tiles/picture_layer_tiling.h" 5 #include "cc/tiles/picture_layer_tiling.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return base::WrapUnique(new TestablePictureLayerTiling( 54 return base::WrapUnique(new TestablePictureLayerTiling(
55 tree, contents_scale, raster_source, client, 55 tree, contents_scale, raster_source, client,
56 settings.tiling_interest_area_padding, 56 settings.tiling_interest_area_padding,
57 settings.skewport_target_time_in_seconds, 57 settings.skewport_target_time_in_seconds,
58 settings.skewport_extrapolation_limit_in_screen_pixels, 58 settings.skewport_extrapolation_limit_in_screen_pixels,
59 312.f, /* min_preraster_distance */ 59 312.f, /* min_preraster_distance */
60 settings.max_preraster_distance_in_screen_pixels)); 60 settings.max_preraster_distance_in_screen_pixels));
61 } 61 }
62 62
63 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } 63 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; }
64 PriorityRectType visible_rect_type() const {
65 return PriorityRectType::VISIBLE_RECT;
66 }
64 67
65 using PictureLayerTiling::RemoveTileAt; 68 using PictureLayerTiling::RemoveTileAt;
66 using PictureLayerTiling::RemoveTilesInRegion; 69 using PictureLayerTiling::RemoveTilesInRegion;
70 using PictureLayerTiling::ComputePriorityRectTypeForTile;
67 71
68 protected: 72 protected:
69 TestablePictureLayerTiling(WhichTree tree, 73 TestablePictureLayerTiling(WhichTree tree,
70 float contents_scale, 74 float contents_scale,
71 scoped_refptr<RasterSource> raster_source, 75 scoped_refptr<RasterSource> raster_source,
72 PictureLayerTilingClient* client, 76 PictureLayerTilingClient* client,
73 size_t tiling_interest_area_padding, 77 size_t tiling_interest_area_padding,
74 float skewport_target_time, 78 float skewport_target_time,
75 int skewport_extrapolation_limit, 79 int skewport_extrapolation_limit,
76 float min_preraster_distance, 80 float min_preraster_distance,
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 952
949 EXPECT_TRUE(active_tiling->TileAt(0, 0)); 953 EXPECT_TRUE(active_tiling->TileAt(0, 0));
950 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); 954 EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
951 955
952 // Reset the active tiling. The recycle tiles should be released too. 956 // Reset the active tiling. The recycle tiles should be released too.
953 active_tiling->Reset(); 957 active_tiling->Reset();
954 EXPECT_FALSE(active_tiling->TileAt(0, 0)); 958 EXPECT_FALSE(active_tiling->TileAt(0, 0));
955 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); 959 EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
956 } 960 }
957 961
962 TEST(PictureLayerTilingTest, EdgeCaseTileNowAndRequired) {
963 FakePictureLayerTilingClient pending_client;
964 pending_client.SetTileSize(gfx::Size(100, 100));
965
966 scoped_refptr<FakeRasterSource> raster_source =
967 FakeRasterSource::CreateFilled(gfx::Size(500, 500));
968 std::unique_ptr<TestablePictureLayerTiling> pending_tiling =
969 TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source,
970 &pending_client, LayerTreeSettings());
971 pending_tiling->set_resolution(HIGH_RESOLUTION);
972 pending_tiling->set_can_require_tiles_for_activation(true);
973
974 gfx::Rect visible_rect = gfx::Rect(0, 0, 99, 99);
danakj 2017/01/30 16:55:18 Can you also test what happens when the tile is 1p
vmpstr 2017/01/30 19:38:20 Done.
975 gfx::Rect eventually_rect = gfx::Rect(0, 0, 500, 500);
976 pending_tiling->ComputeTilePriorityRects(visible_rect, visible_rect,
977 visible_rect, eventually_rect, 1.f,
978 Occlusion());
979
980 Tile* tile = pending_tiling->TileAt(1, 0);
danakj 2017/01/30 16:55:18 Can you do some expectations to prove that the til
vmpstr 2017/01/30 19:38:20 Done.
981 EXPECT_NE(pending_tiling->visible_rect_type(),
982 pending_tiling->ComputePriorityRectTypeForTile(tile));
983 EXPECT_FALSE(pending_tiling->IsTileRequiredForActivation(tile));
984 }
985
958 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { 986 TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) {
959 // The tiling has four rows and three columns. 987 // The tiling has four rows and three columns.
960 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150)); 988 Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150));
961 tiling_->CreateAllTilesForTesting(); 989 tiling_->CreateAllTilesForTesting();
962 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width()); 990 EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width());
963 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); 991 EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height());
964 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size()); 992 EXPECT_EQ(4u, tiling_->AllTilesForTesting().size());
965 993
966 client_.SetTileSize(gfx::Size(250, 200)); 994 client_.SetTileSize(gfx::Size(250, 200));
967 995
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1112
1085 active_tiling->TakeTilesAndPropertiesFrom(tiling_.get(), 1113 active_tiling->TakeTilesAndPropertiesFrom(tiling_.get(),
1086 Region(gfx::Rect(bounds))); 1114 Region(gfx::Rect(bounds)));
1087 for (const auto* tile : tiles) { 1115 for (const auto* tile : tiles) {
1088 EXPECT_EQ(tile->tiling(), active_tiling.get()); 1116 EXPECT_EQ(tile->tiling(), active_tiling.get());
1089 } 1117 }
1090 } 1118 }
1091 1119
1092 } // namespace 1120 } // namespace
1093 } // namespace cc 1121 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698