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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 1362663002: cc: Remove PicturePile and PicturePileImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and update Created 5 years, 2 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
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "cc/base/math_util.h" 14 #include "cc/base/math_util.h"
15 #include "cc/layers/append_quads_data.h" 15 #include "cc/layers/append_quads_data.h"
16 #include "cc/layers/picture_layer.h" 16 #include "cc/layers/picture_layer.h"
17 #include "cc/quads/draw_quad.h" 17 #include "cc/quads/draw_quad.h"
18 #include "cc/quads/tile_draw_quad.h" 18 #include "cc/quads/tile_draw_quad.h"
19 #include "cc/test/begin_frame_args_test.h" 19 #include "cc/test/begin_frame_args_test.h"
20 #include "cc/test/fake_content_layer_client.h" 20 #include "cc/test/fake_content_layer_client.h"
21 #include "cc/test/fake_display_list_raster_source.h"
22 #include "cc/test/fake_display_list_recording_source.h"
21 #include "cc/test/fake_impl_proxy.h" 23 #include "cc/test/fake_impl_proxy.h"
22 #include "cc/test/fake_layer_tree_host_impl.h" 24 #include "cc/test/fake_layer_tree_host_impl.h"
23 #include "cc/test/fake_output_surface.h" 25 #include "cc/test/fake_output_surface.h"
24 #include "cc/test/fake_picture_layer_impl.h" 26 #include "cc/test/fake_picture_layer_impl.h"
25 #include "cc/test/fake_picture_pile_impl.h"
26 #include "cc/test/geometry_test_utils.h" 27 #include "cc/test/geometry_test_utils.h"
27 #include "cc/test/gpu_rasterization_enabled_settings.h" 28 #include "cc/test/gpu_rasterization_enabled_settings.h"
28 #include "cc/test/layer_test_common.h" 29 #include "cc/test/layer_test_common.h"
29 #include "cc/test/test_shared_bitmap_manager.h" 30 #include "cc/test/test_shared_bitmap_manager.h"
30 #include "cc/test/test_task_graph_runner.h" 31 #include "cc/test/test_task_graph_runner.h"
31 #include "cc/test/test_web_graphics_context_3d.h" 32 #include "cc/test/test_web_graphics_context_3d.h"
32 #include "cc/tiles/tiling_set_raster_queue_all.h" 33 #include "cc/tiles/tiling_set_raster_queue_all.h"
33 #include "cc/tiles/tiling_set_raster_queue_required.h" 34 #include "cc/tiles/tiling_set_raster_queue_required.h"
34 #include "cc/trees/layer_tree_impl.h" 35 #include "cc/trees/layer_tree_impl.h"
35 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 ~PictureLayerImplTest() override {} 120 ~PictureLayerImplTest() override {}
120 121
121 void SetUp() override { InitializeRenderer(); } 122 void SetUp() override { InitializeRenderer(); }
122 123
123 virtual void InitializeRenderer() { 124 virtual void InitializeRenderer() {
124 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); 125 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
125 } 126 }
126 127
127 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 128 void SetupDefaultTrees(const gfx::Size& layer_bounds) {
128 gfx::Size tile_size(100, 100); 129 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
130 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
131 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
132 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
129 133
130 scoped_refptr<FakePicturePileImpl> pending_pile = 134 SetupTrees(pending_raster_source, active_raster_source);
131 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
132 scoped_refptr<FakePicturePileImpl> active_pile =
133 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
134
135 SetupTrees(pending_pile, active_pile);
136 } 135 }
137 136
138 void SetupDefaultTreesWithInvalidation(const gfx::Size& layer_bounds, 137 void SetupDefaultTreesWithInvalidation(const gfx::Size& layer_bounds,
139 const Region& invalidation) { 138 const Region& invalidation) {
140 gfx::Size tile_size(100, 100); 139 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
140 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
141 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
142 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
141 143
142 scoped_refptr<FakePicturePileImpl> pending_pile = 144 SetupTreesWithInvalidation(pending_raster_source, active_raster_source,
143 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 145 invalidation);
144 scoped_refptr<FakePicturePileImpl> active_pile =
145 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
146
147 SetupTreesWithInvalidation(pending_pile, active_pile, invalidation);
148 } 146 }
149 147
150 void ActivateTree() { 148 void ActivateTree() {
151 host_impl_.ActivateSyncTree(); 149 host_impl_.ActivateSyncTree();
152 CHECK(!host_impl_.pending_tree()); 150 CHECK(!host_impl_.pending_tree());
153 CHECK(host_impl_.recycle_tree()); 151 CHECK(host_impl_.recycle_tree());
154 old_pending_layer_ = pending_layer_; 152 old_pending_layer_ = pending_layer_;
155 pending_layer_ = nullptr; 153 pending_layer_ = nullptr;
156 active_layer_ = static_cast<FakePictureLayerImpl*>( 154 active_layer_ = static_cast<FakePictureLayerImpl*>(
157 host_impl_.active_tree()->LayerById(id_)); 155 host_impl_.active_tree()->LayerById(id_));
158 156
159 bool update_lcd_text = false; 157 bool update_lcd_text = false;
160 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); 158 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text);
161 } 159 }
162 160
163 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, 161 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds,
164 const gfx::Size& tile_size, 162 const gfx::Size& tile_size,
165 const Region& invalidation) { 163 const Region& invalidation) {
166 gfx::Size pile_tile_size(100, 100); 164 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
165 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
166 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
167 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
167 168
168 scoped_refptr<FakePicturePileImpl> pending_pile = 169 SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
169 FakePicturePileImpl::CreateFilledPile(pile_tile_size, layer_bounds); 170 tile_size, invalidation);
170 scoped_refptr<FakePicturePileImpl> active_pile =
171 FakePicturePileImpl::CreateFilledPile(pile_tile_size, layer_bounds);
172
173 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size,
174 invalidation);
175 } 171 }
176 172
177 void SetupTrees( 173 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
178 scoped_refptr<PicturePileImpl> pending_pile, 174 scoped_refptr<RasterSource> active_raster_source) {
179 scoped_refptr<PicturePileImpl> active_pile) { 175 SetupPendingTree(active_raster_source);
180 SetupPendingTree(active_pile);
181 ActivateTree(); 176 ActivateTree();
182 SetupPendingTreeInternal(pending_pile, gfx::Size(), Region()); 177 SetupPendingTreeInternal(pending_raster_source, gfx::Size(), Region());
183 } 178 }
184 179
185 void SetupTreesWithInvalidation(scoped_refptr<PicturePileImpl> pending_pile, 180 void SetupTreesWithInvalidation(
186 scoped_refptr<PicturePileImpl> active_pile, 181 scoped_refptr<RasterSource> pending_raster_source,
187 const Region& pending_invalidation) { 182 scoped_refptr<RasterSource> active_raster_source,
188 SetupPendingTreeInternal(active_pile, gfx::Size(), Region()); 183 const Region& pending_invalidation) {
184 SetupPendingTreeInternal(active_raster_source, gfx::Size(), Region());
189 ActivateTree(); 185 ActivateTree();
190 SetupPendingTreeInternal(pending_pile, gfx::Size(), pending_invalidation); 186 SetupPendingTreeInternal(pending_raster_source, gfx::Size(),
187 pending_invalidation);
191 } 188 }
192 189
193 void SetupTreesWithFixedTileSize(scoped_refptr<PicturePileImpl> pending_pile, 190 void SetupTreesWithFixedTileSize(
194 scoped_refptr<PicturePileImpl> active_pile, 191 scoped_refptr<RasterSource> pending_raster_source,
195 const gfx::Size& tile_size, 192 scoped_refptr<RasterSource> active_raster_source,
196 const Region& pending_invalidation) { 193 const gfx::Size& tile_size,
197 SetupPendingTreeInternal(active_pile, tile_size, Region()); 194 const Region& pending_invalidation) {
195 SetupPendingTreeInternal(active_raster_source, tile_size, Region());
198 ActivateTree(); 196 ActivateTree();
199 SetupPendingTreeInternal(pending_pile, tile_size, pending_invalidation); 197 SetupPendingTreeInternal(pending_raster_source, tile_size,
198 pending_invalidation);
200 } 199 }
201 200
202 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) { 201 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
203 SetupPendingTreeInternal(raster_source, gfx::Size(), Region()); 202 SetupPendingTreeInternal(raster_source, gfx::Size(), Region());
204 } 203 }
205 204
206 void SetupPendingTreeWithInvalidation( 205 void SetupPendingTreeWithInvalidation(
207 scoped_refptr<RasterSource> raster_source, 206 scoped_refptr<RasterSource> raster_source,
208 const Region& invalidation) { 207 const Region& invalidation) {
209 SetupPendingTreeInternal(raster_source, gfx::Size(), invalidation); 208 SetupPendingTreeInternal(raster_source, gfx::Size(), invalidation);
(...skipping 24 matching lines...) Expand all
234 if (!tile_size.IsEmpty()) 233 if (!tile_size.IsEmpty())
235 pending_layer->set_fixed_tile_size(tile_size); 234 pending_layer->set_fixed_tile_size(tile_size);
236 pending_layer->SetDrawsContent(true); 235 pending_layer->SetDrawsContent(true);
237 } else { 236 } else {
238 pending_layer.reset(static_cast<FakePictureLayerImpl*>( 237 pending_layer.reset(static_cast<FakePictureLayerImpl*>(
239 pending_root->RemoveChild(pending_root->children()[0]).release())); 238 pending_root->RemoveChild(pending_root->children()[0]).release()));
240 if (!tile_size.IsEmpty()) 239 if (!tile_size.IsEmpty())
241 pending_layer->set_fixed_tile_size(tile_size); 240 pending_layer->set_fixed_tile_size(tile_size);
242 } 241 }
243 pending_root->SetHasRenderSurface(true); 242 pending_root->SetHasRenderSurface(true);
244 // The bounds() just mirror the pile size. 243 // The bounds() just mirror the raster source size.
245 pending_layer->SetBounds(raster_source->GetSize()); 244 pending_layer->SetBounds(raster_source->GetSize());
246 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); 245 pending_layer->SetRasterSourceOnPending(raster_source, invalidation);
247 246
248 pending_root->AddChild(pending_layer.Pass()); 247 pending_root->AddChild(pending_layer.Pass());
249 pending_tree->SetRootLayer(pending_root.Pass()); 248 pending_tree->SetRootLayer(pending_root.Pass());
250 249
251 pending_layer_ = static_cast<FakePictureLayerImpl*>( 250 pending_layer_ = static_cast<FakePictureLayerImpl*>(
252 host_impl_.pending_tree()->LayerById(id_)); 251 host_impl_.pending_tree()->LayerById(id_));
253 252
254 // Add tilings/tiles for the layer. 253 // Add tilings/tiles for the layer.
(...skipping 18 matching lines...) Expand all
273 DCHECK_EQ(layer->GetIdealContentsScale(), ideal_contents_scale); 272 DCHECK_EQ(layer->GetIdealContentsScale(), ideal_contents_scale);
274 layer->draw_properties().maximum_animation_contents_scale = 273 layer->draw_properties().maximum_animation_contents_scale =
275 maximum_animation_contents_scale; 274 maximum_animation_contents_scale;
276 layer->draw_properties().starting_animation_contents_scale = 275 layer->draw_properties().starting_animation_contents_scale =
277 starting_animation_contents_scale; 276 starting_animation_contents_scale;
278 layer->draw_properties().screen_space_transform_is_animating = 277 layer->draw_properties().screen_space_transform_is_animating =
279 animating_transform_to_screen; 278 animating_transform_to_screen;
280 bool resourceless_software_draw = false; 279 bool resourceless_software_draw = false;
281 layer->UpdateTiles(resourceless_software_draw); 280 layer->UpdateTiles(resourceless_software_draw);
282 } 281 }
283 static void VerifyAllPrioritizedTilesExistAndHavePile( 282 static void VerifyAllPrioritizedTilesExistAndHaveRasterSource(
284 const PictureLayerTiling* tiling, 283 const PictureLayerTiling* tiling,
285 PicturePileImpl* pile) { 284 RasterSource* raster_source) {
286 auto prioritized_tiles = 285 auto prioritized_tiles =
287 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 286 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
288 for (PictureLayerTiling::CoverageIterator iter( 287 for (PictureLayerTiling::CoverageIterator iter(
289 tiling, 288 tiling,
290 tiling->contents_scale(), 289 tiling->contents_scale(),
291 gfx::Rect(tiling->tiling_size())); 290 gfx::Rect(tiling->tiling_size()));
292 iter; 291 iter;
293 ++iter) { 292 ++iter) {
294 EXPECT_TRUE(*iter); 293 EXPECT_TRUE(*iter);
295 EXPECT_EQ(pile, prioritized_tiles[*iter].raster_source()); 294 EXPECT_EQ(raster_source, prioritized_tiles[*iter].raster_source());
296 } 295 }
297 } 296 }
298 297
299 void SetContentsScaleOnBothLayers(float contents_scale, 298 void SetContentsScaleOnBothLayers(float contents_scale,
300 float device_scale_factor, 299 float device_scale_factor,
301 float page_scale_factor, 300 float page_scale_factor,
302 float maximum_animation_contents_scale, 301 float maximum_animation_contents_scale,
303 float starting_animation_contents_scale, 302 float starting_animation_contents_scale,
304 bool animating_transform) { 303 bool animating_transform) {
305 SetupDrawPropertiesAndUpdateTiles( 304 SetupDrawPropertiesAndUpdateTiles(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 NoLowResPictureLayerImplTest() 375 NoLowResPictureLayerImplTest()
377 : PictureLayerImplTest(NoLowResTilingsSettings()) {} 376 : PictureLayerImplTest(NoLowResTilingsSettings()) {}
378 }; 377 };
379 378
380 TEST_F(PictureLayerImplTest, TileGridAlignment) { 379 TEST_F(PictureLayerImplTest, TileGridAlignment) {
381 // Layer to span 4 raster tiles in x and in y 380 // Layer to span 4 raster tiles in x and in y
382 LayerTreeSettings settings; 381 LayerTreeSettings settings;
383 gfx::Size layer_size(settings.default_tile_size.width() * 7 / 2, 382 gfx::Size layer_size(settings.default_tile_size.width() * 7 / 2,
384 settings.default_tile_size.height() * 7 / 2); 383 settings.default_tile_size.height() * 7 / 2);
385 384
386 scoped_refptr<FakePicturePileImpl> pending_pile = 385 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
387 FakePicturePileImpl::CreateFilledPile(layer_size, layer_size); 386 FakeDisplayListRasterSource::CreateFilled(layer_size);
388 387
389 scoped_ptr<FakePicturePile> active_recording = 388 // Create an active recording source, but make sure it's not solid.
390 FakePicturePile::CreateFilledPile(layer_size, layer_size); 389 scoped_ptr<FakeDisplayListRecordingSource> active_recording_source =
391 scoped_refptr<FakePicturePileImpl> active_pile = 390 FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_size);
392 FakePicturePileImpl::CreateFromPile(active_recording.get(), nullptr); 391 active_recording_source->add_draw_rect(gfx::Rect(layer_size));
392 active_recording_source->add_draw_rect(
393 gfx::Rect(0, 0, layer_size.width() - 1, layer_size.height() - 1));
394 active_recording_source->Rerecord();
395 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
396 FakeDisplayListRasterSource::CreateFromRecordingSource(
397 active_recording_source.get(), false);
393 398
394 SetupTrees(pending_pile, active_pile); 399 SetupTrees(pending_raster_source, active_raster_source);
395 400
396 // Add 1x1 rects at the centers of each tile, then re-record pile contents 401 // Add 1x1 rects at the centers of each tile, then re-record recording source
402 // contents.
397 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 403 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
398 std::vector<Tile*> tiles = 404 std::vector<Tile*> tiles =
399 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); 405 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
400 EXPECT_EQ(16u, tiles.size()); 406 EXPECT_EQ(16u, tiles.size());
401 std::vector<SkRect> rects; 407 std::vector<SkRect> rects;
402 std::vector<Tile*>::const_iterator tile_iter; 408 std::vector<Tile*>::const_iterator tile_iter;
409 active_recording_source->reset_draws();
403 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { 410 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
404 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint(); 411 gfx::Point tile_center = (*tile_iter)->content_rect().CenterPoint();
405 gfx::Rect rect(tile_center.x(), tile_center.y(), 1, 1); 412 gfx::Rect rect(tile_center.x(), tile_center.y(), 1, 1);
406 active_recording->add_draw_rect(rect); 413 active_recording_source->add_draw_rect(rect);
407 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1)); 414 rects.push_back(SkRect::MakeXYWH(rect.x(), rect.y(), 1, 1));
408 } 415 }
409 416
410 // Force re-raster with newly injected content 417 // Force re-raster with newly injected content
411 active_recording->RemoveRecordingAt(0, 0); 418 active_recording_source->Rerecord();
412 active_recording->AddRecordingAt(0, 0);
413 419
414 scoped_refptr<FakePicturePileImpl> updated_active_pile = 420 scoped_refptr<FakeDisplayListRasterSource> updated_active_raster_source =
415 FakePicturePileImpl::CreateFromPile(active_recording.get(), nullptr); 421 FakeDisplayListRasterSource::CreateFromRecordingSource(
422 active_recording_source.get(), false);
416 423
417 std::vector<SkRect>::const_iterator rect_iter = rects.begin(); 424 std::vector<SkRect>::const_iterator rect_iter = rects.begin();
418 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { 425 for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) {
419 MockCanvas mock_canvas(1000, 1000); 426 MockCanvas mock_canvas(1000, 1000);
420 updated_active_pile->PlaybackToSharedCanvas( 427 updated_active_raster_source->PlaybackToSharedCanvas(
421 &mock_canvas, (*tile_iter)->content_rect(), 1.0f); 428 &mock_canvas, (*tile_iter)->content_rect(), 1.0f);
422 429
423 // This test verifies that when drawing the contents of a specific tile 430 // This test verifies that when drawing the contents of a specific tile
424 // at content scale 1.0, the playback canvas never receives content from 431 // at content scale 1.0, the playback canvas never receives content from
425 // neighboring tiles which indicates that the tile grid embedded in 432 // neighboring tiles which indicates that the tile grid embedded in
426 // SkPicture is perfectly aligned with the compositor's tiles. 433 // SkPicture is perfectly aligned with the compositor's tiles.
427 EXPECT_EQ(1u, mock_canvas.rects_.size()); 434 EXPECT_EQ(1u, mock_canvas.rects_.size());
428 EXPECT_EQ(*rect_iter, mock_canvas.rects_[0]); 435 EXPECT_EQ(*rect_iter, mock_canvas.rects_[0]);
429 rect_iter++; 436 rect_iter++;
430 } 437 }
431 } 438 }
432 439
433 TEST_F(PictureLayerImplTest, CloneNoInvalidation) { 440 TEST_F(PictureLayerImplTest, CloneNoInvalidation) {
434 gfx::Size tile_size(100, 100);
435 gfx::Size layer_bounds(400, 400); 441 gfx::Size layer_bounds(400, 400);
436 442 SetupDefaultTrees(layer_bounds);
437 scoped_refptr<FakePicturePileImpl> pending_pile =
438 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
439 scoped_refptr<FakePicturePileImpl> active_pile =
440 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
441
442 SetupTreesWithInvalidation(pending_pile, active_pile, Region());
443 443
444 EXPECT_EQ(pending_layer_->tilings()->num_tilings(), 444 EXPECT_EQ(pending_layer_->tilings()->num_tilings(),
445 active_layer_->tilings()->num_tilings()); 445 active_layer_->tilings()->num_tilings());
446 446
447 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); 447 const PictureLayerTilingSet* tilings = pending_layer_->tilings();
448 EXPECT_GT(tilings->num_tilings(), 0u); 448 EXPECT_GT(tilings->num_tilings(), 0u);
449 for (size_t i = 0; i < tilings->num_tilings(); ++i) 449 for (size_t i = 0; i < tilings->num_tilings(); ++i)
450 EXPECT_TRUE(tilings->tiling_at(i)->AllTilesForTesting().empty()); 450 EXPECT_TRUE(tilings->tiling_at(i)->AllTilesForTesting().empty());
451 } 451 }
452 452
453 TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { 453 TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
454 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 454 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
455 gfx::Size tile_size(100, 100);
456 gfx::Size layer_bounds(400, 400); 455 gfx::Size layer_bounds(400, 400);
457 456 SetupDefaultTrees(layer_bounds);
458 scoped_refptr<FakePicturePileImpl> pending_pile =
459 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
460 scoped_refptr<FakePicturePileImpl> active_pile =
461 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
462
463 SetupTreesWithInvalidation(pending_pile, active_pile, Region());
464 457
465 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 458 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
466 false); 459 false);
467 460
468 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); 461 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
469 462
470 // Update tiles with viewport for tile priority as (0, 0, 100, 100) and the 463 // Update tiles with viewport for tile priority as (0, 0, 100, 100) and the
471 // identify transform for tile priority. 464 // identify transform for tile priority.
472 bool resourceless_software_draw = false; 465 bool resourceless_software_draw = false;
473 gfx::Rect viewport = gfx::Rect(layer_bounds), 466 gfx::Rect viewport = gfx::Rect(layer_bounds),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 PictureLayerTiling* tiling = tilings->tiling_at(i); 527 PictureLayerTiling* tiling = tilings->tiling_at(i);
535 EXPECT_EQ( 528 EXPECT_EQ(
536 tiling->GetCurrentVisibleRectForTesting(), 529 tiling->GetCurrentVisibleRectForTesting(),
537 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, 530 gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space,
538 tiling->contents_scale())); 531 tiling->contents_scale()));
539 } 532 }
540 } 533 }
541 534
542 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) { 535 TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
543 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 536 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
544
545 gfx::Size tile_size(100, 100);
546 gfx::Size layer_bounds(400, 400); 537 gfx::Size layer_bounds(400, 400);
547 538 SetupDefaultTrees(layer_bounds);
548 scoped_refptr<FakePicturePileImpl> pending_pile =
549 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
550 scoped_refptr<FakePicturePileImpl> active_pile =
551 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
552
553 SetupTreesWithInvalidation(pending_pile, active_pile, Region());
554 539
555 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 540 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
556 false); 541 false);
557 542
558 // UpdateTiles with valid viewport. Should update tile viewport. 543 // UpdateTiles with valid viewport. Should update tile viewport.
559 // Note viewport is considered invalid if and only if in resourceless 544 // Note viewport is considered invalid if and only if in resourceless
560 // software draw. 545 // software draw.
561 bool resourceless_software_draw = false; 546 bool resourceless_software_draw = false;
562 gfx::Rect viewport = gfx::Rect(layer_bounds); 547 gfx::Rect viewport = gfx::Rect(layer_bounds);
563 gfx::Transform transform; 548 gfx::Transform transform;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 resourceless_software_draw); 596 resourceless_software_draw);
612 active_layer_->UpdateTiles(resourceless_software_draw); 597 active_layer_->UpdateTiles(resourceless_software_draw);
613 598
614 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, 599 EXPECT_TRANSFORMATION_MATRIX_EQ(transform,
615 active_layer_->screen_space_transform()); 600 active_layer_->screen_space_transform());
616 EXPECT_EQ(viewport, active_layer_->visible_rect_for_tile_priority()); 601 EXPECT_EQ(viewport, active_layer_->visible_rect_for_tile_priority());
617 } 602 }
618 603
619 TEST_F(PictureLayerImplTest, ViewportRectForTilePriorityIsCached) { 604 TEST_F(PictureLayerImplTest, ViewportRectForTilePriorityIsCached) {
620 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 605 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
621 gfx::Size tile_size(100, 100);
622 gfx::Size layer_bounds(400, 400); 606 gfx::Size layer_bounds(400, 400);
623 607 SetupDefaultTrees(layer_bounds);
624 scoped_refptr<FakePicturePileImpl> pending_pile =
625 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
626 scoped_refptr<FakePicturePileImpl> active_pile =
627 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
628
629 SetupTreesWithInvalidation(pending_pile, active_pile, Region());
630 608
631 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 609 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
632 false); 610 false);
633 611
634 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); 612 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
635 613
636 bool resourceless_software_draw = false; 614 bool resourceless_software_draw = false;
637 gfx::Rect viewport = gfx::Rect(layer_bounds); 615 gfx::Rect viewport = gfx::Rect(layer_bounds);
638 gfx::Rect viewport_rect_for_tile_priority(0, 0, 100, 100); 616 gfx::Rect viewport_rect_for_tile_priority(0, 0, 100, 100);
639 gfx::Transform transform, transform_for_tile_priority; 617 gfx::Transform transform, transform_for_tile_priority;
(...skipping 20 matching lines...) Expand all
660 active_layer_->viewport_rect_for_tile_priority_in_content_space()); 638 active_layer_->viewport_rect_for_tile_priority_in_content_space());
661 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); 639 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text);
662 640
663 // Now the UpdateDrawProperties is called. The viewport rect for tile 641 // Now the UpdateDrawProperties is called. The viewport rect for tile
664 // priority should be the latest value. 642 // priority should be the latest value.
665 EXPECT_EQ(another_viewport_rect_for_tile_priority, 643 EXPECT_EQ(another_viewport_rect_for_tile_priority,
666 active_layer_->viewport_rect_for_tile_priority_in_content_space()); 644 active_layer_->viewport_rect_for_tile_priority_in_content_space());
667 } 645 }
668 646
669 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { 647 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
670 gfx::Size tile_size(100, 100);
671 gfx::Size layer_bounds(400, 400); 648 gfx::Size layer_bounds(400, 400);
672 gfx::Rect layer_invalidation(150, 200, 30, 180); 649 gfx::Rect layer_invalidation(150, 200, 30, 180);
673 650
674 scoped_refptr<FakePicturePileImpl> pending_pile = 651 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
675 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 652 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
676 scoped_refptr<FakePicturePileImpl> active_pile = 653 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
677 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 654 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
678 scoped_refptr<FakePicturePileImpl> lost_pile = 655 scoped_refptr<FakeDisplayListRasterSource> lost_raster_source =
679 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 656 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
680 657
681 SetupPendingTreeWithFixedTileSize(lost_pile, gfx::Size(50, 50), Region()); 658 SetupPendingTreeWithFixedTileSize(lost_raster_source, gfx::Size(50, 50),
659 Region());
682 ActivateTree(); 660 ActivateTree();
683 // Add a unique tiling on the active tree. 661 // Add a unique tiling on the active tree.
684 PictureLayerTiling* tiling = active_layer_->AddTiling(3.f); 662 PictureLayerTiling* tiling = active_layer_->AddTiling(3.f);
685 tiling->set_resolution(HIGH_RESOLUTION); 663 tiling->set_resolution(HIGH_RESOLUTION);
686 tiling->CreateAllTilesForTesting(); 664 tiling->CreateAllTilesForTesting();
687 665
688 // Ensure UpdateTiles won't remove any tilings. 666 // Ensure UpdateTiles won't remove any tilings.
689 active_layer_->MarkAllTilingsUsed(); 667 active_layer_->MarkAllTilingsUsed();
690 668
691 // Then setup a new pending tree and activate it. 669 // Then setup a new pending tree and activate it.
692 SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50), 670 SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
693 layer_invalidation); 671 gfx::Size(50, 50), layer_invalidation);
694 672
695 EXPECT_EQ(1u, pending_layer_->num_tilings()); 673 EXPECT_EQ(1u, pending_layer_->num_tilings());
696 EXPECT_EQ(3u, active_layer_->num_tilings()); 674 EXPECT_EQ(3u, active_layer_->num_tilings());
697 675
698 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); 676 const PictureLayerTilingSet* tilings = pending_layer_->tilings();
699 EXPECT_GT(tilings->num_tilings(), 0u); 677 EXPECT_GT(tilings->num_tilings(), 0u);
700 for (size_t i = 0; i < tilings->num_tilings(); ++i) { 678 for (size_t i = 0; i < tilings->num_tilings(); ++i) {
701 const PictureLayerTiling* tiling = tilings->tiling_at(i); 679 const PictureLayerTiling* tiling = tilings->tiling_at(i);
702 gfx::Rect content_invalidation = gfx::ScaleToEnclosingRect( 680 gfx::Rect content_invalidation = gfx::ScaleToEnclosingRect(
703 layer_invalidation, 681 layer_invalidation,
704 tiling->contents_scale()); 682 tiling->contents_scale());
705 auto prioritized_tiles = 683 auto prioritized_tiles =
706 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 684 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
707 for (PictureLayerTiling::CoverageIterator iter( 685 for (PictureLayerTiling::CoverageIterator iter(
708 tiling, 686 tiling,
709 tiling->contents_scale(), 687 tiling->contents_scale(),
710 gfx::Rect(tiling->tiling_size())); 688 gfx::Rect(tiling->tiling_size()));
711 iter; 689 iter;
712 ++iter) { 690 ++iter) {
713 // We don't always have a tile, but when we do it's because it was 691 // We don't always have a tile, but when we do it's because it was
714 // invalidated and it has the latest raster source. 692 // invalidated and it has the latest raster source.
715 if (*iter) { 693 if (*iter) {
716 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); 694 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
717 EXPECT_EQ(pending_pile.get(), prioritized_tiles[*iter].raster_source()); 695 EXPECT_EQ(pending_raster_source.get(),
696 prioritized_tiles[*iter].raster_source());
718 EXPECT_TRUE(iter.geometry_rect().Intersects(content_invalidation)); 697 EXPECT_TRUE(iter.geometry_rect().Intersects(content_invalidation));
719 } else { 698 } else {
720 // We don't create tiles in non-invalidated regions. 699 // We don't create tiles in non-invalidated regions.
721 EXPECT_FALSE(iter.geometry_rect().Intersects(content_invalidation)); 700 EXPECT_FALSE(iter.geometry_rect().Intersects(content_invalidation));
722 } 701 }
723 } 702 }
724 } 703 }
725 704
726 tilings = active_layer_->tilings(); 705 tilings = active_layer_->tilings();
727 EXPECT_GT(tilings->num_tilings(), 0u); 706 EXPECT_GT(tilings->num_tilings(), 0u);
728 for (size_t i = 0; i < tilings->num_tilings(); ++i) { 707 for (size_t i = 0; i < tilings->num_tilings(); ++i) {
729 const PictureLayerTiling* tiling = tilings->tiling_at(i); 708 const PictureLayerTiling* tiling = tilings->tiling_at(i);
730 gfx::Rect content_invalidation = 709 gfx::Rect content_invalidation =
731 gfx::ScaleToEnclosingRect(layer_invalidation, tiling->contents_scale()); 710 gfx::ScaleToEnclosingRect(layer_invalidation, tiling->contents_scale());
732 auto prioritized_tiles = 711 auto prioritized_tiles =
733 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 712 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
734 for (PictureLayerTiling::CoverageIterator iter( 713 for (PictureLayerTiling::CoverageIterator iter(
735 tiling, 714 tiling,
736 tiling->contents_scale(), 715 tiling->contents_scale(),
737 gfx::Rect(tiling->tiling_size())); 716 gfx::Rect(tiling->tiling_size()));
738 iter; 717 iter;
739 ++iter) { 718 ++iter) {
740 EXPECT_TRUE(*iter); 719 EXPECT_TRUE(*iter);
741 EXPECT_FALSE(iter.geometry_rect().IsEmpty()); 720 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
742 // Pile will be updated upon activation. 721 // Raster source will be updated upon activation.
743 EXPECT_EQ(active_pile.get(), prioritized_tiles[*iter].raster_source()); 722 EXPECT_EQ(active_raster_source.get(),
723 prioritized_tiles[*iter].raster_source());
744 } 724 }
745 } 725 }
746 } 726 }
747 727
748 TEST_F(PictureLayerImplTest, CloneFullInvalidation) { 728 TEST_F(PictureLayerImplTest, CloneFullInvalidation) {
749 gfx::Size tile_size(90, 80);
750 gfx::Size layer_bounds(300, 500); 729 gfx::Size layer_bounds(300, 500);
751 730
752 scoped_refptr<FakePicturePileImpl> pending_pile = 731 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
753 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 732 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
754 scoped_refptr<FakePicturePileImpl> active_pile = 733 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
755 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 734 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
756 735
757 SetupTreesWithInvalidation(pending_pile, active_pile, 736 SetupTreesWithInvalidation(pending_raster_source, active_raster_source,
758 gfx::Rect(layer_bounds)); 737 gfx::Rect(layer_bounds));
759 738
760 EXPECT_EQ(pending_layer_->tilings()->num_tilings(), 739 EXPECT_EQ(pending_layer_->tilings()->num_tilings(),
761 active_layer_->tilings()->num_tilings()); 740 active_layer_->tilings()->num_tilings());
762 741
763 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); 742 const PictureLayerTilingSet* tilings = pending_layer_->tilings();
764 EXPECT_GT(tilings->num_tilings(), 0u); 743 EXPECT_GT(tilings->num_tilings(), 0u);
765 for (size_t i = 0; i < tilings->num_tilings(); ++i) 744 for (size_t i = 0; i < tilings->num_tilings(); ++i) {
766 VerifyAllPrioritizedTilesExistAndHavePile(tilings->tiling_at(i), 745 VerifyAllPrioritizedTilesExistAndHaveRasterSource(
767 pending_pile.get()); 746 tilings->tiling_at(i), pending_raster_source.get());
747 }
768 } 748 }
769 749
770 TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) { 750 TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) {
771 gfx::Size tile_size(400, 400);
772 gfx::Size layer_bounds(1300, 1900); 751 gfx::Size layer_bounds(1300, 1900);
773 752 SetupDefaultTrees(layer_bounds);
774 scoped_refptr<FakePicturePileImpl> pending_pile =
775 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
776 scoped_refptr<FakePicturePileImpl> active_pile =
777 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
778
779 SetupTrees(pending_pile, active_pile);
780 753
781 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 754 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
782 EXPECT_LT(low_res_factor, 1.f); 755 EXPECT_LT(low_res_factor, 1.f);
783 756
784 active_layer_->ReleaseResources(); 757 active_layer_->ReleaseResources();
785 EXPECT_FALSE(active_layer_->tilings()); 758 EXPECT_FALSE(active_layer_->tilings());
786 active_layer_->RecreateResources(); 759 active_layer_->RecreateResources();
787 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 760 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
788 761
789 SetupDrawPropertiesAndUpdateTiles(active_layer_, 762 SetupDrawPropertiesAndUpdateTiles(active_layer_,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 0.f, // starting animation scale 810 0.f, // starting animation scale
838 false); 811 false);
839 ASSERT_EQ(6u, active_layer_->tilings()->num_tilings()); 812 ASSERT_EQ(6u, active_layer_->tilings()->num_tilings());
840 EXPECT_FLOAT_EQ(7.26f, 813 EXPECT_FLOAT_EQ(7.26f,
841 active_layer_->tilings()->tiling_at(0)->contents_scale()); 814 active_layer_->tilings()->tiling_at(0)->contents_scale());
842 EXPECT_FLOAT_EQ(7.26f * low_res_factor, 815 EXPECT_FLOAT_EQ(7.26f * low_res_factor,
843 active_layer_->tilings()->tiling_at(3)->contents_scale()); 816 active_layer_->tilings()->tiling_at(3)->contents_scale());
844 } 817 }
845 818
846 TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { 819 TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
847 gfx::Size tile_size(400, 400);
848 gfx::Size layer_bounds(1300, 1900); 820 gfx::Size layer_bounds(1300, 1900);
849 821 SetupDefaultTrees(layer_bounds);
850 scoped_refptr<FakePicturePileImpl> pending_pile =
851 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
852 scoped_refptr<FakePicturePileImpl> active_pile =
853 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
854
855 SetupTrees(pending_pile, active_pile);
856 822
857 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 823 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
858 EXPECT_LT(low_res_factor, 1.f); 824 EXPECT_LT(low_res_factor, 1.f);
859 825
860 pending_layer_->ReleaseResources(); 826 pending_layer_->ReleaseResources();
861 EXPECT_FALSE(pending_layer_->tilings()); 827 EXPECT_FALSE(pending_layer_->tilings());
862 pending_layer_->RecreateResources(); 828 pending_layer_->RecreateResources();
863 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 829 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
864 830
865 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 831 SetupDrawPropertiesAndUpdateTiles(pending_layer_,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 false); 874 false);
909 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 875 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
910 EXPECT_FLOAT_EQ(7.26f, 876 EXPECT_FLOAT_EQ(7.26f,
911 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 877 pending_layer_->tilings()->tiling_at(0)->contents_scale());
912 } 878 }
913 879
914 TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { 880 TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) {
915 // This test makes sure that if a layer can have tilings, then a commit makes 881 // This test makes sure that if a layer can have tilings, then a commit makes
916 // it not able to have tilings (empty size), and then a future commit that 882 // it not able to have tilings (empty size), and then a future commit that
917 // makes it valid again should be able to create tilings. 883 // makes it valid again should be able to create tilings.
918 gfx::Size tile_size(400, 400);
919 gfx::Size layer_bounds(1300, 1900); 884 gfx::Size layer_bounds(1300, 1900);
920 885
921 scoped_refptr<FakePicturePileImpl> empty_pile = 886 scoped_refptr<FakeDisplayListRasterSource> empty_raster_source =
922 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 887 FakeDisplayListRasterSource::CreateEmpty(layer_bounds);
923 scoped_refptr<FakePicturePileImpl> valid_pile = 888 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
924 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 889 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
925 890
926 SetupPendingTree(valid_pile); 891 SetupPendingTree(valid_raster_source);
927 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 892 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
928 893
929 ActivateTree(); 894 ActivateTree();
930 SetupPendingTree(empty_pile); 895 SetupPendingTree(empty_raster_source);
931 EXPECT_FALSE(pending_layer_->CanHaveTilings()); 896 EXPECT_FALSE(pending_layer_->CanHaveTilings());
932 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 897 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
933 ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings()); 898 ASSERT_EQ(0u, pending_layer_->tilings()->num_tilings());
934 899
935 ActivateTree(); 900 ActivateTree();
936 EXPECT_FALSE(active_layer_->CanHaveTilings()); 901 EXPECT_FALSE(active_layer_->CanHaveTilings());
937 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); 902 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
938 903
939 SetupPendingTree(valid_pile); 904 SetupPendingTree(valid_raster_source);
940 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 905 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
941 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings()); 906 ASSERT_EQ(0u, active_layer_->tilings()->num_tilings());
942 } 907 }
943 908
944 TEST_F(PictureLayerImplTest, LowResTilingStaysOnActiveTree) { 909 TEST_F(PictureLayerImplTest, LowResTilingStaysOnActiveTree) {
945 gfx::Size tile_size(400, 400);
946 gfx::Size layer_bounds(1300, 1900); 910 gfx::Size layer_bounds(1300, 1900);
947 911
948 scoped_refptr<FakePicturePileImpl> valid_pile = 912 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
949 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 913 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
950 scoped_refptr<FakePicturePileImpl> other_valid_pile = 914 scoped_refptr<FakeDisplayListRasterSource> other_valid_raster_source =
951 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 915 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
952 916
953 SetupPendingTree(valid_pile); 917 SetupPendingTree(valid_raster_source);
954 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 918 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
955 919
956 ActivateTree(); 920 ActivateTree();
957 SetupPendingTree(other_valid_pile); 921 SetupPendingTree(other_valid_raster_source);
958 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 922 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
959 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 923 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
960 auto* low_res_tiling = 924 auto* low_res_tiling =
961 active_layer_->tilings()->FindTilingWithResolution(LOW_RESOLUTION); 925 active_layer_->tilings()->FindTilingWithResolution(LOW_RESOLUTION);
962 EXPECT_TRUE(low_res_tiling); 926 EXPECT_TRUE(low_res_tiling);
963 927
964 ActivateTree(); 928 ActivateTree();
965 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 929 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
966 auto* other_low_res_tiling = 930 auto* other_low_res_tiling =
967 active_layer_->tilings()->FindTilingWithResolution(LOW_RESOLUTION); 931 active_layer_->tilings()->FindTilingWithResolution(LOW_RESOLUTION);
968 EXPECT_TRUE(other_low_res_tiling); 932 EXPECT_TRUE(other_low_res_tiling);
969 EXPECT_EQ(low_res_tiling, other_low_res_tiling); 933 EXPECT_EQ(low_res_tiling, other_low_res_tiling);
970 } 934 }
971 935
972 TEST_F(PictureLayerImplTest, ZoomOutCrash) { 936 TEST_F(PictureLayerImplTest, ZoomOutCrash) {
973 gfx::Size tile_size(400, 400);
974 gfx::Size layer_bounds(1300, 1900); 937 gfx::Size layer_bounds(1300, 1900);
975 938
976 // Set up the high and low res tilings before pinch zoom. 939 // Set up the high and low res tilings before pinch zoom.
977 scoped_refptr<FakePicturePileImpl> pending_pile = 940 SetupDefaultTrees(layer_bounds);
978 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
979 scoped_refptr<FakePicturePileImpl> active_pile =
980 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
981
982 SetupTrees(pending_pile, active_pile);
983 ResetTilingsAndRasterScales(); 941 ResetTilingsAndRasterScales();
984 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 942 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
985 SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, 1.0f, 0.f, false); 943 SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, 1.0f, 0.f, false);
986 EXPECT_EQ(32.f, active_layer_->HighResTiling()->contents_scale()); 944 EXPECT_EQ(32.f, active_layer_->HighResTiling()->contents_scale());
987 host_impl_.PinchGestureBegin(); 945 host_impl_.PinchGestureBegin();
988 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false); 946 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false);
989 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false); 947 SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false);
990 EXPECT_EQ(active_layer_->tilings()->NumHighResTilings(), 1); 948 EXPECT_EQ(active_layer_->tilings()->NumHighResTilings(), 1);
991 } 949 }
992 950
993 TEST_F(PictureLayerImplTest, PinchGestureTilings) { 951 TEST_F(PictureLayerImplTest, PinchGestureTilings) {
994 gfx::Size tile_size(400, 400);
995 gfx::Size layer_bounds(1300, 1900); 952 gfx::Size layer_bounds(1300, 1900);
996 953
997 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 954 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
998
999 scoped_refptr<FakePicturePileImpl> pending_pile =
1000 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1001 scoped_refptr<FakePicturePileImpl> active_pile =
1002 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1003
1004 // Set up the high and low res tilings before pinch zoom. 955 // Set up the high and low res tilings before pinch zoom.
1005 SetupTrees(pending_pile, active_pile); 956 SetupDefaultTrees(layer_bounds);
1006 ResetTilingsAndRasterScales(); 957 ResetTilingsAndRasterScales();
1007 958
1008 SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, 0.f, false); 959 SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, 0.f, false);
1009 EXPECT_EQ(active_layer_->num_tilings(), 2u); 960 EXPECT_EQ(active_layer_->num_tilings(), 2u);
1010 EXPECT_EQ(pending_layer_->num_tilings(), 1u); 961 EXPECT_EQ(pending_layer_->num_tilings(), 1u);
1011 EXPECT_EQ(active_layer_->tilings()->tiling_at(0)->contents_scale(), 2.f); 962 EXPECT_EQ(active_layer_->tilings()->tiling_at(0)->contents_scale(), 2.f);
1012 EXPECT_EQ(active_layer_->tilings()->tiling_at(1)->contents_scale(), 963 EXPECT_EQ(active_layer_->tilings()->tiling_at(1)->contents_scale(),
1013 2.f * low_res_factor); 964 2.f * low_res_factor);
1014 // One of the tilings has to be a low resolution one. 965 // One of the tilings has to be a low resolution one.
1015 EXPECT_EQ(LOW_RESOLUTION, 966 EXPECT_EQ(LOW_RESOLUTION,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 active_layer_->tilings()->tiling_at(0)->contents_scale()); 1024 active_layer_->tilings()->tiling_at(0)->contents_scale());
1074 // Now that we stopped pinching, the low resolution tiling that existed should 1025 // Now that we stopped pinching, the low resolution tiling that existed should
1075 // now be marked as low resolution. 1026 // now be marked as low resolution.
1076 low_res_tiling = 1027 low_res_tiling =
1077 active_layer_->tilings()->FindTilingWithScale(4.f * low_res_factor); 1028 active_layer_->tilings()->FindTilingWithScale(4.f * low_res_factor);
1078 EXPECT_TRUE(low_res_tiling); 1029 EXPECT_TRUE(low_res_tiling);
1079 EXPECT_EQ(LOW_RESOLUTION, low_res_tiling->resolution()); 1030 EXPECT_EQ(LOW_RESOLUTION, low_res_tiling->resolution());
1080 } 1031 }
1081 1032
1082 TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) { 1033 TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
1083 gfx::Size tile_size(300, 300);
1084 gfx::Size layer_bounds(2600, 3800); 1034 gfx::Size layer_bounds(2600, 3800);
1085 1035 SetupDefaultTrees(layer_bounds);
1086 scoped_refptr<FakePicturePileImpl> pending_pile =
1087 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1088 scoped_refptr<FakePicturePileImpl> active_pile =
1089 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1090
1091 SetupTrees(pending_pile, active_pile);
1092 1036
1093 ResetTilingsAndRasterScales(); 1037 ResetTilingsAndRasterScales();
1094 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 1038 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
1095 1039
1096 // Set up the high and low res tilings before pinch zoom. 1040 // Set up the high and low res tilings before pinch zoom.
1097 SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, 0.f, false); 1041 SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, 0.f, false);
1098 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); 1042 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
1099 EXPECT_FLOAT_EQ(0.24f, 1043 EXPECT_FLOAT_EQ(0.24f,
1100 active_layer_->tilings()->tiling_at(0)->contents_scale()); 1044 active_layer_->tilings()->tiling_at(0)->contents_scale());
1101 EXPECT_FLOAT_EQ(0.0625f, 1045 EXPECT_FLOAT_EQ(0.0625f,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 1077
1134 // Zoom in a lot. Since we move in factors of two, we should get a scale that 1078 // Zoom in a lot. Since we move in factors of two, we should get a scale that
1135 // is a power of 2 times 0.24. 1079 // is a power of 2 times 0.24.
1136 SetContentsScaleOnBothLayers(1.f, 1.0f, 1.f, 1.0f, 0.f, false); 1080 SetContentsScaleOnBothLayers(1.f, 1.0f, 1.f, 1.0f, 0.f, false);
1137 EXPECT_EQ(4u, active_layer_->tilings()->num_tilings()); 1081 EXPECT_EQ(4u, active_layer_->tilings()->num_tilings());
1138 EXPECT_FLOAT_EQ(1.92f, 1082 EXPECT_FLOAT_EQ(1.92f,
1139 active_layer_->tilings()->tiling_at(0)->contents_scale()); 1083 active_layer_->tilings()->tiling_at(0)->contents_scale());
1140 } 1084 }
1141 1085
1142 TEST_F(PictureLayerImplTest, CleanUpTilings) { 1086 TEST_F(PictureLayerImplTest, CleanUpTilings) {
1143 gfx::Size tile_size(400, 400);
1144 gfx::Size layer_bounds(1300, 1900); 1087 gfx::Size layer_bounds(1300, 1900);
1145 1088
1146 scoped_refptr<FakePicturePileImpl> pending_pile =
1147 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1148 scoped_refptr<FakePicturePileImpl> active_pile =
1149 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1150
1151 std::vector<PictureLayerTiling*> used_tilings; 1089 std::vector<PictureLayerTiling*> used_tilings;
1152 1090
1153 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 1091 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
1154 EXPECT_LT(low_res_factor, 1.f); 1092 EXPECT_LT(low_res_factor, 1.f);
1155 1093
1156 float scale = 1.f; 1094 float scale = 1.f;
1157 float page_scale = 1.f; 1095 float page_scale = 1.f;
1158 1096
1159 SetupTrees(pending_pile, active_pile); 1097 SetupDefaultTrees(layer_bounds);
1160 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); 1098 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
1161 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); 1099 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale());
1162 1100
1163 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to 1101 // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to
1164 // |used_tilings| variable, and it's here only to ensure that active_layer_ 1102 // |used_tilings| variable, and it's here only to ensure that active_layer_
1165 // won't remove tilings before the test has a chance to verify behavior. 1103 // won't remove tilings before the test has a chance to verify behavior.
1166 active_layer_->MarkAllTilingsUsed(); 1104 active_layer_->MarkAllTilingsUsed();
1167 1105
1168 // We only have ideal tilings, so they aren't removed. 1106 // We only have ideal tilings, so they aren't removed.
1169 used_tilings.clear(); 1107 used_tilings.clear();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 starting_animation_scale, animating_transform); 1254 starting_animation_scale, animating_transform);
1317 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); 1255 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
1318 EXPECT_EQ(active_layer_->LowResTiling()->contents_scale(), 1256 EXPECT_EQ(active_layer_->LowResTiling()->contents_scale(),
1319 2.f * low_res_factor); 1257 2.f * low_res_factor);
1320 EXPECT_EQ(4u, active_layer_->num_tilings()); 1258 EXPECT_EQ(4u, active_layer_->num_tilings());
1321 EXPECT_EQ(1u, pending_layer_->num_tilings()); 1259 EXPECT_EQ(1u, pending_layer_->num_tilings());
1322 } 1260 }
1323 1261
1324 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { 1262 TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) {
1325 gfx::Size layer_bounds(host_impl_.settings().default_tile_size); 1263 gfx::Size layer_bounds(host_impl_.settings().default_tile_size);
1326 gfx::Size tile_size(100, 100);
1327 1264
1328 scoped_refptr<FakePicturePileImpl> pending_pile = 1265 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
1329 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1266 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1330 scoped_refptr<FakePicturePileImpl> active_pile = 1267 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
1331 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1268 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1332 1269
1333 SetupTrees(pending_pile, active_pile); 1270 SetupTrees(pending_raster_source, active_raster_source);
1334 1271
1335 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 1272 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
1336 float device_scale = 1.f; 1273 float device_scale = 1.f;
1337 float page_scale = 1.f; 1274 float page_scale = 1.f;
1338 float maximum_animation_scale = 1.f; 1275 float maximum_animation_scale = 1.f;
1339 float starting_animation_scale = 0.f; 1276 float starting_animation_scale = 0.f;
1340 bool animating_transform = false; 1277 bool animating_transform = false;
1341 1278
1342 // Contents exactly fit on one tile at scale 1, no low res. 1279 // Contents exactly fit on one tile at scale 1, no low res.
1343 float contents_scale = 1.f; 1280 float contents_scale = 1.f;
(...skipping 24 matching lines...) Expand all
1368 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); 1305 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale);
1369 EXPECT_EQ(active_layer_->LowResTiling()->contents_scale(), 1306 EXPECT_EQ(active_layer_->LowResTiling()->contents_scale(),
1370 contents_scale * low_res_factor); 1307 contents_scale * low_res_factor);
1371 EXPECT_FALSE(pending_layer_->LowResTiling()); 1308 EXPECT_FALSE(pending_layer_->LowResTiling());
1372 EXPECT_EQ(active_layer_->num_tilings(), 2u); 1309 EXPECT_EQ(active_layer_->num_tilings(), 2u);
1373 EXPECT_EQ(pending_layer_->num_tilings(), 1u); 1310 EXPECT_EQ(pending_layer_->num_tilings(), 1u);
1374 1311
1375 // Mask layers dont create low res since they always fit on one tile. 1312 // Mask layers dont create low res since they always fit on one tile.
1376 scoped_ptr<FakePictureLayerImpl> mask = 1313 scoped_ptr<FakePictureLayerImpl> mask =
1377 FakePictureLayerImpl::CreateMaskWithRasterSource( 1314 FakePictureLayerImpl::CreateMaskWithRasterSource(
1378 host_impl_.pending_tree(), 3, pending_pile); 1315 host_impl_.pending_tree(), 3, pending_raster_source);
1379 mask->SetBounds(layer_bounds); 1316 mask->SetBounds(layer_bounds);
1380 mask->SetDrawsContent(true); 1317 mask->SetDrawsContent(true);
1381 1318
1382 SetupDrawPropertiesAndUpdateTiles( 1319 SetupDrawPropertiesAndUpdateTiles(
1383 mask.get(), contents_scale, device_scale, page_scale, 1320 mask.get(), contents_scale, device_scale, page_scale,
1384 maximum_animation_scale, starting_animation_scale, animating_transform); 1321 maximum_animation_scale, starting_animation_scale, animating_transform);
1385 EXPECT_EQ(mask->HighResTiling()->contents_scale(), contents_scale); 1322 EXPECT_EQ(mask->HighResTiling()->contents_scale(), contents_scale);
1386 EXPECT_EQ(mask->num_tilings(), 1u); 1323 EXPECT_EQ(mask->num_tilings(), 1u);
1387 } 1324 }
1388 1325
1389 TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { 1326 TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
1390 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1327 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1391 1328
1392 gfx::Size tile_size(100, 100);
1393 gfx::Size layer_bounds(1000, 1000); 1329 gfx::Size layer_bounds(1000, 1000);
1394 1330
1395 scoped_refptr<FakePicturePileImpl> valid_pile = 1331 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
1396 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1332 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1397 SetupPendingTree(valid_pile); 1333 SetupPendingTree(valid_raster_source);
1398 1334
1399 scoped_ptr<FakePictureLayerImpl> mask_ptr = 1335 scoped_ptr<FakePictureLayerImpl> mask_ptr =
1400 FakePictureLayerImpl::CreateMaskWithRasterSource( 1336 FakePictureLayerImpl::CreateMaskWithRasterSource(
1401 host_impl_.pending_tree(), 3, valid_pile); 1337 host_impl_.pending_tree(), 3, valid_raster_source);
1402 mask_ptr->SetBounds(layer_bounds); 1338 mask_ptr->SetBounds(layer_bounds);
1403 mask_ptr->SetDrawsContent(true); 1339 mask_ptr->SetDrawsContent(true);
1404 pending_layer_->SetMaskLayer(mask_ptr.Pass()); 1340 pending_layer_->SetMaskLayer(mask_ptr.Pass());
1405 pending_layer_->SetHasRenderSurface(true); 1341 pending_layer_->SetHasRenderSurface(true);
1406 1342
1407 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); 1343 host_impl_.pending_tree()->BuildPropertyTreesForTesting();
1408 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1344 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1409 bool update_lcd_text = false; 1345 bool update_lcd_text = false;
1410 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1346 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1411 1347
(...skipping 28 matching lines...) Expand all
1440 SetupDrawPropertiesAndUpdateTiles(active_mask, 1.f, 1.f, 1.f, 1.f, 0.f, 1376 SetupDrawPropertiesAndUpdateTiles(active_mask, 1.f, 1.f, 1.f, 1.f, 0.f,
1441 false); 1377 false);
1442 active_mask->HighResTiling()->CreateAllTilesForTesting(); 1378 active_mask->HighResTiling()->CreateAllTilesForTesting();
1443 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); 1379 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size());
1444 EXPECT_NE(0u, mask_resource_id); 1380 EXPECT_NE(0u, mask_resource_id);
1445 EXPECT_EQ(active_mask->bounds(), mask_texture_size); 1381 EXPECT_EQ(active_mask->bounds(), mask_texture_size);
1446 1382
1447 // Resize larger than the max texture size. 1383 // Resize larger than the max texture size.
1448 int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size; 1384 int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size;
1449 gfx::Size huge_bounds(max_texture_size + 1, 10); 1385 gfx::Size huge_bounds(max_texture_size + 1, 10);
1450 scoped_refptr<FakePicturePileImpl> huge_pile = 1386 scoped_refptr<FakeDisplayListRasterSource> huge_raster_source =
1451 FakePicturePileImpl::CreateFilledPile(tile_size, huge_bounds); 1387 FakeDisplayListRasterSource::CreateFilled(huge_bounds);
1452 1388
1453 SetupPendingTree(huge_pile); 1389 SetupPendingTree(huge_raster_source);
1454 pending_mask->SetBounds(huge_bounds); 1390 pending_mask->SetBounds(huge_bounds);
1455 pending_mask->SetRasterSourceOnPending(huge_pile, Region()); 1391 pending_mask->SetRasterSourceOnPending(huge_raster_source, Region());
1456 1392
1457 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1393 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1458 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1394 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1459 1395
1460 // The mask tiling gets scaled down. 1396 // The mask tiling gets scaled down.
1461 EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f); 1397 EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f);
1462 EXPECT_EQ(1u, pending_mask->num_tilings()); 1398 EXPECT_EQ(1u, pending_mask->num_tilings());
1463 1399
1464 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 1400 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
1465 pending_mask->HighResTiling()->AllTilesForTesting()); 1401 pending_mask->HighResTiling()->AllTilesForTesting());
(...skipping 15 matching lines...) Expand all
1481 pending_mask->RecreateResources(); 1417 pending_mask->RecreateResources();
1482 active_mask->RecreateResources(); 1418 active_mask->RecreateResources();
1483 SetupDrawPropertiesAndUpdateTiles(active_mask, 1.f, 1.f, 1.f, 1.f, 0.f, 1419 SetupDrawPropertiesAndUpdateTiles(active_mask, 1.f, 1.f, 1.f, 1.f, 0.f,
1484 false); 1420 false);
1485 active_mask->HighResTiling()->CreateAllTilesForTesting(); 1421 active_mask->HighResTiling()->CreateAllTilesForTesting();
1486 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); 1422 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size());
1487 EXPECT_NE(0u, mask_resource_id); 1423 EXPECT_NE(0u, mask_resource_id);
1488 EXPECT_EQ(expected_size, mask_texture_size); 1424 EXPECT_EQ(expected_size, mask_texture_size);
1489 1425
1490 // Do another activate, the same holds. 1426 // Do another activate, the same holds.
1491 SetupPendingTree(huge_pile); 1427 SetupPendingTree(huge_raster_source);
1492 ActivateTree(); 1428 ActivateTree();
1493 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); 1429 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size());
1494 active_layer_->GetContentsResourceId(&mask_resource_id, &mask_texture_size); 1430 active_layer_->GetContentsResourceId(&mask_resource_id, &mask_texture_size);
1495 EXPECT_EQ(expected_size, mask_texture_size); 1431 EXPECT_EQ(expected_size, mask_texture_size);
1496 EXPECT_EQ(0u, mask_resource_id); 1432 EXPECT_EQ(0u, mask_resource_id);
1497 1433
1498 // Resize even larger, so that the scale would be smaller than the minimum 1434 // Resize even larger, so that the scale would be smaller than the minimum
1499 // contents scale. Then the layer should no longer have any tiling. 1435 // contents scale. Then the layer should no longer have any tiling.
1500 float min_contents_scale = host_impl_.settings().minimum_contents_scale; 1436 float min_contents_scale = host_impl_.settings().minimum_contents_scale;
1501 gfx::Size extra_huge_bounds(max_texture_size / min_contents_scale + 1, 10); 1437 gfx::Size extra_huge_bounds(max_texture_size / min_contents_scale + 1, 10);
1502 scoped_refptr<FakePicturePileImpl> extra_huge_pile = 1438 scoped_refptr<FakeDisplayListRasterSource> extra_huge_raster_source =
1503 FakePicturePileImpl::CreateFilledPile(tile_size, extra_huge_bounds); 1439 FakeDisplayListRasterSource::CreateFilled(extra_huge_bounds);
1504 1440
1505 SetupPendingTree(extra_huge_pile); 1441 SetupPendingTree(extra_huge_raster_source);
1506 pending_mask->SetBounds(extra_huge_bounds); 1442 pending_mask->SetBounds(extra_huge_bounds);
1507 pending_mask->SetRasterSourceOnPending(extra_huge_pile, Region()); 1443 pending_mask->SetRasterSourceOnPending(extra_huge_raster_source, Region());
1508 1444
1509 EXPECT_FALSE(pending_mask->CanHaveTilings()); 1445 EXPECT_FALSE(pending_mask->CanHaveTilings());
1510 1446
1511 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1447 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1512 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1448 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1513 1449
1514 EXPECT_EQ(0u, pending_mask->num_tilings()); 1450 EXPECT_EQ(0u, pending_mask->num_tilings());
1515 } 1451 }
1516 1452
1517 TEST_F(PictureLayerImplTest, ScaledMaskLayer) { 1453 TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
1518 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1454 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1519 1455
1520 gfx::Size tile_size(100, 100);
1521 gfx::Size layer_bounds(1000, 1000); 1456 gfx::Size layer_bounds(1000, 1000);
1522 1457
1523 host_impl_.SetDeviceScaleFactor(1.3f); 1458 host_impl_.SetDeviceScaleFactor(1.3f);
1524 1459
1525 scoped_refptr<FakePicturePileImpl> valid_pile = 1460 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
1526 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1461 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1527 SetupPendingTree(valid_pile); 1462 SetupPendingTree(valid_raster_source);
1528 1463
1529 scoped_ptr<FakePictureLayerImpl> mask_ptr = 1464 scoped_ptr<FakePictureLayerImpl> mask_ptr =
1530 FakePictureLayerImpl::CreateMaskWithRasterSource( 1465 FakePictureLayerImpl::CreateMaskWithRasterSource(
1531 host_impl_.pending_tree(), 3, valid_pile); 1466 host_impl_.pending_tree(), 3, valid_raster_source);
1532 mask_ptr->SetBounds(layer_bounds); 1467 mask_ptr->SetBounds(layer_bounds);
1533 mask_ptr->SetDrawsContent(true); 1468 mask_ptr->SetDrawsContent(true);
1534 pending_layer_->SetMaskLayer(mask_ptr.Pass()); 1469 pending_layer_->SetMaskLayer(mask_ptr.Pass());
1535 pending_layer_->SetHasRenderSurface(true); 1470 pending_layer_->SetHasRenderSurface(true);
1536 1471
1537 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); 1472 host_impl_.pending_tree()->BuildPropertyTreesForTesting();
1538 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1473 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1539 bool update_lcd_text = false; 1474 bool update_lcd_text = false;
1540 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1475 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1541 1476
(...skipping 18 matching lines...) Expand all
1560 ResourceId mask_resource_id; 1495 ResourceId mask_resource_id;
1561 gfx::Size mask_texture_size; 1496 gfx::Size mask_texture_size;
1562 active_mask->GetContentsResourceId(&mask_resource_id, &mask_texture_size); 1497 active_mask->GetContentsResourceId(&mask_resource_id, &mask_texture_size);
1563 EXPECT_NE(0u, mask_resource_id); 1498 EXPECT_NE(0u, mask_resource_id);
1564 gfx::Size expected_mask_texture_size = 1499 gfx::Size expected_mask_texture_size =
1565 gfx::ToCeiledSize(gfx::ScaleSize(active_mask->bounds(), 1.3f)); 1500 gfx::ToCeiledSize(gfx::ScaleSize(active_mask->bounds(), 1.3f));
1566 EXPECT_EQ(mask_texture_size, expected_mask_texture_size); 1501 EXPECT_EQ(mask_texture_size, expected_mask_texture_size);
1567 } 1502 }
1568 1503
1569 TEST_F(PictureLayerImplTest, ReleaseResources) { 1504 TEST_F(PictureLayerImplTest, ReleaseResources) {
1570 gfx::Size tile_size(400, 400);
1571 gfx::Size layer_bounds(1300, 1900); 1505 gfx::Size layer_bounds(1300, 1900);
1572 1506 SetupDefaultTrees(layer_bounds);
1573 scoped_refptr<FakePicturePileImpl> pending_pile =
1574 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1575 scoped_refptr<FakePicturePileImpl> active_pile =
1576 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1577
1578 SetupTrees(pending_pile, active_pile);
1579 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1507 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
1580 1508
1581 // All tilings should be removed when losing output surface. 1509 // All tilings should be removed when losing output surface.
1582 active_layer_->ReleaseResources(); 1510 active_layer_->ReleaseResources();
1583 EXPECT_FALSE(active_layer_->tilings()); 1511 EXPECT_FALSE(active_layer_->tilings());
1584 active_layer_->RecreateResources(); 1512 active_layer_->RecreateResources();
1585 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 1513 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
1586 pending_layer_->ReleaseResources(); 1514 pending_layer_->ReleaseResources();
1587 EXPECT_FALSE(pending_layer_->tilings()); 1515 EXPECT_FALSE(pending_layer_->tilings());
1588 pending_layer_->RecreateResources(); 1516 pending_layer_->RecreateResources();
1589 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 1517 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
1590 1518
1591 // This should create new tilings. 1519 // This should create new tilings.
1592 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1520 SetupDrawPropertiesAndUpdateTiles(pending_layer_,
1593 1.f, // ideal contents scale 1521 1.f, // ideal contents scale
1594 1.f, // device scale 1522 1.f, // device scale
1595 1.f, // page scale 1523 1.f, // page scale
1596 1.f, // maximum animation scale 1524 1.f, // maximum animation scale
1597 0.f, // starting animation_scale 1525 0.f, // starting animation_scale
1598 false); 1526 false);
1599 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1527 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
1600 } 1528 }
1601 1529
1602 TEST_F(PictureLayerImplTest, ClampTilesToMaxTileSize) { 1530 TEST_F(PictureLayerImplTest, ClampTilesToMaxTileSize) {
1603 // The default max tile size is larger than 400x400.
1604 gfx::Size tile_size(400, 400);
1605 gfx::Size layer_bounds(5000, 5000); 1531 gfx::Size layer_bounds(5000, 5000);
1606 1532
1607 scoped_refptr<FakePicturePileImpl> pending_pile = 1533 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
1608 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1534 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1609 1535
1610 SetupPendingTree(pending_pile); 1536 SetupPendingTree(pending_raster_source);
1611 EXPECT_GE(pending_layer_->tilings()->num_tilings(), 1u); 1537 EXPECT_GE(pending_layer_->tilings()->num_tilings(), 1u);
1612 1538
1613 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1539 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1614 1540
1615 // The default value. 1541 // The default value.
1616 EXPECT_EQ(gfx::Size(256, 256).ToString(), 1542 EXPECT_EQ(gfx::Size(256, 256).ToString(),
1617 host_impl_.settings().default_tile_size.ToString()); 1543 host_impl_.settings().default_tile_size.ToString());
1618 1544
1619 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1545 Tile* tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1620 EXPECT_EQ(gfx::Size(256, 256).ToString(), 1546 EXPECT_EQ(gfx::Size(256, 256).ToString(),
(...skipping 15 matching lines...) Expand all
1636 1562
1637 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1563 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1638 1564
1639 // Verify the tiles are not larger than the context's max texture size. 1565 // Verify the tiles are not larger than the context's max texture size.
1640 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1566 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1641 EXPECT_GE(140, tile->content_rect().width()); 1567 EXPECT_GE(140, tile->content_rect().width());
1642 EXPECT_GE(140, tile->content_rect().height()); 1568 EXPECT_GE(140, tile->content_rect().height());
1643 } 1569 }
1644 1570
1645 TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) { 1571 TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) {
1646 // The default max tile size is larger than 400x400.
1647 gfx::Size tile_size(400, 400);
1648 gfx::Size layer_bounds(500, 500); 1572 gfx::Size layer_bounds(500, 500);
1649 1573 SetupDefaultTrees(layer_bounds);
1650 scoped_refptr<FakePicturePileImpl> pending_pile =
1651 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1652 scoped_refptr<FakePicturePileImpl> active_pile =
1653 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1654
1655 SetupTrees(pending_pile, active_pile);
1656 EXPECT_GE(active_layer_->tilings()->num_tilings(), 1u); 1574 EXPECT_GE(active_layer_->tilings()->num_tilings(), 1u);
1657 1575
1658 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1576 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1659 1577
1660 // The default value. The layer is smaller than this. 1578 // The default value. The layer is smaller than this.
1661 EXPECT_EQ(gfx::Size(512, 512).ToString(), 1579 EXPECT_EQ(gfx::Size(512, 512).ToString(),
1662 host_impl_.settings().max_untiled_layer_size.ToString()); 1580 host_impl_.settings().max_untiled_layer_size.ToString());
1663 1581
1664 // There should be a single tile since the layer is small. 1582 // There should be a single tile since the layer is small.
1665 PictureLayerTiling* high_res_tiling = active_layer_->tilings()->tiling_at(0); 1583 PictureLayerTiling* high_res_tiling = active_layer_->tilings()->tiling_at(0);
(...skipping 22 matching lines...) Expand all
1688 1606
1689 // Verify the tiles are not larger than the context's max texture size. 1607 // Verify the tiles are not larger than the context's max texture size.
1690 Tile* tile = active_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1608 Tile* tile = active_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1691 EXPECT_GE(140, tile->content_rect().width()); 1609 EXPECT_GE(140, tile->content_rect().width());
1692 EXPECT_GE(140, tile->content_rect().height()); 1610 EXPECT_GE(140, tile->content_rect().height());
1693 } 1611 }
1694 1612
1695 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { 1613 TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) {
1696 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1614 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1697 1615
1698 gfx::Size tile_size(400, 400);
1699 gfx::Size layer_bounds(1300, 1900); 1616 gfx::Size layer_bounds(1300, 1900);
1700 gfx::Rect layer_rect(layer_bounds); 1617 gfx::Rect layer_rect(layer_bounds);
1701 1618
1702 scoped_refptr<FakePicturePileImpl> pending_pile =
1703 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1704 scoped_refptr<FakePicturePileImpl> active_pile =
1705 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1706
1707 gfx::Rect layer_invalidation(150, 200, 30, 180); 1619 gfx::Rect layer_invalidation(150, 200, 30, 180);
1708 SetupTreesWithInvalidation(pending_pile, active_pile, layer_invalidation); 1620 SetupDefaultTreesWithInvalidation(layer_bounds, layer_invalidation);
1709 1621
1710 active_layer_->SetContentsOpaque(true); 1622 active_layer_->SetContentsOpaque(true);
1711 active_layer_->draw_properties().visible_layer_rect = gfx::Rect(layer_bounds); 1623 active_layer_->draw_properties().visible_layer_rect = gfx::Rect(layer_bounds);
1712 1624
1713 AppendQuadsData data; 1625 AppendQuadsData data;
1714 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); 1626 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr);
1715 active_layer_->AppendQuads(render_pass.get(), &data); 1627 active_layer_->AppendQuads(render_pass.get(), &data);
1716 active_layer_->DidDraw(nullptr); 1628 active_layer_->DidDraw(nullptr);
1717 1629
1718 ASSERT_EQ(1U, render_pass->quad_list.size()); 1630 ASSERT_EQ(1u, render_pass->quad_list.size());
1719 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, 1631 EXPECT_EQ(DrawQuad::PICTURE_CONTENT,
1720 render_pass->quad_list.front()->material); 1632 render_pass->quad_list.front()->material);
1721 EXPECT_EQ(render_pass->quad_list.front()->rect, layer_rect); 1633 EXPECT_EQ(render_pass->quad_list.front()->rect, layer_rect);
1722 EXPECT_EQ(render_pass->quad_list.front()->opaque_rect, layer_rect); 1634 EXPECT_EQ(render_pass->quad_list.front()->opaque_rect, layer_rect);
1723 EXPECT_EQ(render_pass->quad_list.front()->visible_rect, layer_rect); 1635 EXPECT_EQ(render_pass->quad_list.front()->visible_rect, layer_rect);
1724 } 1636 }
1725 1637
1726 TEST_F(PictureLayerImplTest, ResourcelessPartialRecording) { 1638 TEST_F(PictureLayerImplTest, ResourcelessPartialRecording) {
1727 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1639 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1728 1640
1729 gfx::Size tile_size(400, 400); 1641 gfx::Size tile_size(400, 400);
1730 gfx::Size layer_bounds(700, 650); 1642 gfx::Size layer_bounds(700, 650);
1731 gfx::Rect layer_rect(layer_bounds); 1643 gfx::Rect layer_rect(layer_bounds);
1732 host_impl_.SetDeviceScaleFactor(2.f); 1644 host_impl_.SetDeviceScaleFactor(2.f);
1733 1645
1734 gfx::Rect recorded_viewport(20, 30, 40, 50); 1646 gfx::Rect recorded_viewport(20, 30, 40, 50);
1735 bool is_filled = true; 1647 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
1736 scoped_refptr<FakePicturePileImpl> active_pile = 1648 FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
1737 FakePicturePileImpl::CreatePile(tile_size, layer_bounds, 1649 recorded_viewport);
1738 recorded_viewport, is_filled); 1650
1739 SetupPendingTree(active_pile); 1651 SetupPendingTree(active_raster_source);
1740 ActivateTree(); 1652 ActivateTree();
1741 1653
1742 active_layer_->SetContentsOpaque(true); 1654 active_layer_->SetContentsOpaque(true);
1743 gfx::Rect visible_rect(30, 35, 10, 5); 1655 gfx::Rect visible_rect(30, 35, 10, 5);
1744 active_layer_->draw_properties().visible_layer_rect = visible_rect; 1656 active_layer_->draw_properties().visible_layer_rect = visible_rect;
1745 1657
1746 AppendQuadsData data; 1658 AppendQuadsData data;
1747 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); 1659 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr);
1748 active_layer_->AppendQuads(render_pass.get(), &data); 1660 active_layer_->AppendQuads(render_pass.get(), &data);
1749 active_layer_->DidDraw(nullptr); 1661 active_layer_->DidDraw(nullptr);
1750 1662
1751 gfx::Rect scaled_visible = gfx::ScaleToEnclosingRect(visible_rect, 2.f); 1663 gfx::Rect scaled_visible = gfx::ScaleToEnclosingRect(visible_rect, 2.f);
1752 gfx::Rect scaled_recorded = gfx::ScaleToEnclosingRect(recorded_viewport, 2.f); 1664 gfx::Rect scaled_recorded = gfx::ScaleToEnclosingRect(recorded_viewport, 2.f);
1753 gfx::Rect quad_visible = gfx::IntersectRects(scaled_visible, scaled_recorded); 1665 gfx::Rect quad_visible = gfx::IntersectRects(scaled_visible, scaled_recorded);
1754 1666
1755 ASSERT_EQ(1U, render_pass->quad_list.size()); 1667 ASSERT_EQ(1U, render_pass->quad_list.size());
1756 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, 1668 EXPECT_EQ(DrawQuad::PICTURE_CONTENT,
1757 render_pass->quad_list.front()->material); 1669 render_pass->quad_list.front()->material);
1758 const DrawQuad* quad = render_pass->quad_list.front(); 1670 const DrawQuad* quad = render_pass->quad_list.front();
1759 EXPECT_EQ(quad_visible, quad->rect); 1671 EXPECT_EQ(quad_visible, quad->rect);
1760 EXPECT_EQ(quad_visible, quad->opaque_rect); 1672 EXPECT_EQ(quad_visible, quad->opaque_rect);
1761 EXPECT_EQ(quad_visible, quad->visible_rect); 1673 EXPECT_EQ(quad_visible, quad->visible_rect);
1762 } 1674 }
1763 1675
1764 TEST_F(PictureLayerImplTest, ResourcelessEmptyRecording) { 1676 TEST_F(PictureLayerImplTest, ResourcelessEmptyRecording) {
1765 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1677 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1766 1678
1767 gfx::Size tile_size(400, 400);
1768 gfx::Size layer_bounds(700, 650); 1679 gfx::Size layer_bounds(700, 650);
1769 1680 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
1770 scoped_refptr<FakePicturePileImpl> active_pile = 1681 FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
1771 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 1682 gfx::Rect());
1772 SetupPendingTree(active_pile); 1683 SetupPendingTree(active_raster_source);
1773 ActivateTree(); 1684 ActivateTree();
1774 1685
1775 active_layer_->SetContentsOpaque(true); 1686 active_layer_->SetContentsOpaque(true);
1776 active_layer_->draw_properties().visible_layer_rect = gfx::Rect(layer_bounds); 1687 active_layer_->draw_properties().visible_layer_rect = gfx::Rect(layer_bounds);
1777 1688
1778 AppendQuadsData data; 1689 AppendQuadsData data;
1779 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); 1690 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr);
1780 active_layer_->AppendQuads(render_pass.get(), &data); 1691 active_layer_->AppendQuads(render_pass.get(), &data);
1781 active_layer_->DidDraw(nullptr); 1692 active_layer_->DidDraw(nullptr);
1782 1693
1783 EXPECT_EQ(0U, render_pass->quad_list.size()); 1694 EXPECT_EQ(0U, render_pass->quad_list.size());
1784 } 1695 }
1785 1696
1786 TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) { 1697 TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) {
1787 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1698 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1788 1699
1789 gfx::Size tile_size(1000, 1000);
1790 gfx::Size layer_bounds(1500, 1500); 1700 gfx::Size layer_bounds(1500, 1500);
1791 gfx::Rect visible_rect(250, 250, 1000, 1000); 1701 gfx::Rect visible_rect(250, 250, 1000, 1000);
1792 1702
1793 scoped_ptr<FakePicturePile> empty_recording = 1703 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
1794 FakePicturePile::CreateEmptyPile(tile_size, layer_bounds); 1704 FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds);
1795 empty_recording->SetIsSolidColor(true); 1705 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
1706 FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds);
1796 1707
1797 scoped_refptr<FakePicturePileImpl> pending_pile = 1708 SetupTrees(pending_raster_source, active_raster_source);
1798 FakePicturePileImpl::CreateFromPile(empty_recording.get(), nullptr);
1799 scoped_refptr<FakePicturePileImpl> active_pile =
1800 FakePicturePileImpl::CreateFromPile(empty_recording.get(), nullptr);
1801
1802 SetupTrees(pending_pile, active_pile);
1803 1709
1804 active_layer_->draw_properties().visible_layer_rect = visible_rect; 1710 active_layer_->draw_properties().visible_layer_rect = visible_rect;
1805 1711
1806 AppendQuadsData data; 1712 AppendQuadsData data;
1807 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); 1713 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
1808 active_layer_->AppendQuads(render_pass.get(), &data); 1714 active_layer_->AppendQuads(render_pass.get(), &data);
1809 active_layer_->DidDraw(nullptr); 1715 active_layer_->DidDraw(nullptr);
1810 1716
1811 Region remaining = visible_rect; 1717 Region remaining = visible_rect;
1812 for (const auto& quad : render_pass->quad_list) { 1718 for (const auto& quad : render_pass->quad_list) {
1813 EXPECT_TRUE(visible_rect.Contains(quad->rect)); 1719 EXPECT_TRUE(visible_rect.Contains(quad->rect));
1814 EXPECT_TRUE(remaining.Contains(quad->rect)); 1720 EXPECT_TRUE(remaining.Contains(quad->rect));
1815 remaining.Subtract(quad->rect); 1721 remaining.Subtract(quad->rect);
1816 } 1722 }
1817 1723
1818 EXPECT_TRUE(remaining.IsEmpty()); 1724 EXPECT_TRUE(remaining.IsEmpty());
1819 } 1725 }
1820 1726
1821 TEST_F(PictureLayerImplTest, TileScalesWithSolidColorPile) { 1727 TEST_F(PictureLayerImplTest, TileScalesWithSolidColorRasterSource) {
1822 gfx::Size layer_bounds(200, 200); 1728 gfx::Size layer_bounds(200, 200);
1823 gfx::Size tile_size(host_impl_.settings().default_tile_size); 1729 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
1824 scoped_refptr<FakePicturePileImpl> pending_pile = 1730 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1825 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( 1731 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
1826 tile_size, layer_bounds, false); 1732 FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds);
1827 scoped_refptr<FakePicturePileImpl> active_pile =
1828 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
1829 tile_size, layer_bounds, true);
1830 1733
1831 SetupTrees(pending_pile, active_pile); 1734 SetupTrees(pending_raster_source, active_raster_source);
1832 // Solid color pile should not allow tilings at any scale. 1735 // Solid color raster source should not allow tilings at any scale.
1833 EXPECT_FALSE(active_layer_->CanHaveTilings()); 1736 EXPECT_FALSE(active_layer_->CanHaveTilings());
1834 EXPECT_EQ(0.f, active_layer_->ideal_contents_scale()); 1737 EXPECT_EQ(0.f, active_layer_->ideal_contents_scale());
1835 1738
1836 // Activate non-solid-color pending pile makes active layer can have tilings. 1739 // Activate non-solid-color pending raster source makes active layer can have
1740 // tilings.
1837 ActivateTree(); 1741 ActivateTree();
1838 EXPECT_TRUE(active_layer_->CanHaveTilings()); 1742 EXPECT_TRUE(active_layer_->CanHaveTilings());
1839 EXPECT_GT(active_layer_->ideal_contents_scale(), 0.f); 1743 EXPECT_GT(active_layer_->ideal_contents_scale(), 0.f);
1840 } 1744 }
1841 1745
1842 TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) { 1746 TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) {
1843 gfx::Size tile_size(100, 100);
1844 gfx::Size layer_bounds(200, 200); 1747 gfx::Size layer_bounds(200, 200);
1845 1748
1846 gfx::Transform transform; 1749 gfx::Transform transform;
1847 gfx::Transform transform_for_tile_priority; 1750 gfx::Transform transform_for_tile_priority;
1848 bool resourceless_software_draw = false; 1751 bool resourceless_software_draw = false;
1849 gfx::Rect viewport(0, 0, 100, 200); 1752 gfx::Rect viewport(0, 0, 100, 200);
1850 host_impl_.SetExternalDrawConstraints(transform, 1753 host_impl_.SetExternalDrawConstraints(transform,
1851 viewport, 1754 viewport,
1852 viewport, 1755 viewport,
1853 viewport, 1756 viewport,
1854 transform, 1757 transform,
1855 resourceless_software_draw); 1758 resourceless_software_draw);
1856 1759
1857 scoped_refptr<FakePicturePileImpl> pending_pile = 1760 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
1858 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1761 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1859 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 1762 SetupPendingTreeWithFixedTileSize(pending_raster_source, gfx::Size(100, 100),
1763 Region());
1860 1764
1861 EXPECT_EQ(1u, pending_layer_->num_tilings()); 1765 EXPECT_EQ(1u, pending_layer_->num_tilings());
1862 EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority()); 1766 EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority());
1863 1767
1864 base::TimeTicks time_ticks; 1768 base::TimeTicks time_ticks;
1865 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1769 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1866 pending_layer_->UpdateTiles(resourceless_software_draw); 1770 pending_layer_->UpdateTiles(resourceless_software_draw);
1867 1771
1868 int num_visible = 0; 1772 int num_visible = 0;
1869 int num_offscreen = 0; 1773 int num_offscreen = 0;
(...skipping 18 matching lines...) Expand all
1888 1792
1889 TEST_F(NoLowResPictureLayerImplTest, 1793 TEST_F(NoLowResPictureLayerImplTest,
1890 TileOutsideOfViewportForTilePriorityNotRequired) { 1794 TileOutsideOfViewportForTilePriorityNotRequired) {
1891 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1795 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1892 1796
1893 gfx::Size tile_size(100, 100); 1797 gfx::Size tile_size(100, 100);
1894 gfx::Size layer_bounds(400, 400); 1798 gfx::Size layer_bounds(400, 400);
1895 gfx::Rect external_viewport_for_tile_priority(400, 200); 1799 gfx::Rect external_viewport_for_tile_priority(400, 200);
1896 gfx::Rect visible_layer_rect(200, 400); 1800 gfx::Rect visible_layer_rect(200, 400);
1897 1801
1898 scoped_refptr<FakePicturePileImpl> active_pile = 1802 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
1899 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1900 scoped_refptr<FakePicturePileImpl> pending_pile =
1901 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1902 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
1903 1803
1904 ASSERT_EQ(1u, pending_layer_->num_tilings()); 1804 ASSERT_EQ(1u, pending_layer_->num_tilings());
1905 ASSERT_EQ(1.f, pending_layer_->HighResTiling()->contents_scale()); 1805 ASSERT_EQ(1.f, pending_layer_->HighResTiling()->contents_scale());
1906 1806
1907 // Set external viewport for tile priority. 1807 // Set external viewport for tile priority.
1908 gfx::Rect viewport = gfx::Rect(layer_bounds); 1808 gfx::Rect viewport = gfx::Rect(layer_bounds);
1909 gfx::Transform transform; 1809 gfx::Transform transform;
1910 gfx::Transform transform_for_tile_priority; 1810 gfx::Transform transform_for_tile_priority;
1911 bool resourceless_software_draw = false; 1811 bool resourceless_software_draw = false;
1912 host_impl_.SetExternalDrawConstraints(transform, 1812 host_impl_.SetExternalDrawConstraints(transform,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 EXPECT_EQ(0u, data.num_incomplete_tiles); 1871 EXPECT_EQ(0u, data.num_incomplete_tiles);
1972 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); 1872 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads());
1973 } 1873 }
1974 1874
1975 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { 1875 TEST_F(PictureLayerImplTest, HighResTileIsComplete) {
1976 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1876 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1977 1877
1978 gfx::Size tile_size(100, 100); 1878 gfx::Size tile_size(100, 100);
1979 gfx::Size layer_bounds(200, 200); 1879 gfx::Size layer_bounds(200, 200);
1980 1880
1981 scoped_refptr<FakePicturePileImpl> pending_pile = 1881 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
1982 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1882 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1983 1883
1984 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 1884 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
1985 ActivateTree(); 1885 ActivateTree();
1986 1886
1987 // All high res tiles have resources. 1887 // All high res tiles have resources.
1988 std::vector<Tile*> tiles = 1888 std::vector<Tile*> tiles =
1989 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); 1889 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
1990 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); 1890 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
1991 1891
1992 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1892 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1993 AppendQuadsData data; 1893 AppendQuadsData data;
1994 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); 1894 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
1995 active_layer_->AppendQuads(render_pass.get(), &data); 1895 active_layer_->AppendQuads(render_pass.get(), &data);
1996 active_layer_->DidDraw(nullptr); 1896 active_layer_->DidDraw(nullptr);
1997 1897
1998 // All high res tiles drew, nothing was incomplete. 1898 // All high res tiles drew, nothing was incomplete.
1999 EXPECT_EQ(9u, render_pass->quad_list.size()); 1899 EXPECT_EQ(9u, render_pass->quad_list.size());
2000 EXPECT_EQ(0u, data.num_missing_tiles); 1900 EXPECT_EQ(0u, data.num_missing_tiles);
2001 EXPECT_EQ(0u, data.num_incomplete_tiles); 1901 EXPECT_EQ(0u, data.num_incomplete_tiles);
2002 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); 1902 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads());
2003 } 1903 }
2004 1904
2005 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { 1905 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) {
2006 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1906 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2007 1907
2008 gfx::Size tile_size(100, 100); 1908 gfx::Size tile_size(100, 100);
2009 gfx::Size layer_bounds(200, 200); 1909 gfx::Size layer_bounds(200, 200);
2010 1910
2011 scoped_refptr<FakePicturePileImpl> pending_pile = 1911 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2012 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1912 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2013 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 1913 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
2014 ActivateTree(); 1914 ActivateTree();
2015 1915
2016 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1916 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
2017 AppendQuadsData data; 1917 AppendQuadsData data;
2018 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); 1918 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
2019 active_layer_->AppendQuads(render_pass.get(), &data); 1919 active_layer_->AppendQuads(render_pass.get(), &data);
2020 active_layer_->DidDraw(nullptr); 1920 active_layer_->DidDraw(nullptr);
2021 1921
2022 EXPECT_EQ(1u, render_pass->quad_list.size()); 1922 EXPECT_EQ(1u, render_pass->quad_list.size());
2023 EXPECT_EQ(1u, data.num_missing_tiles); 1923 EXPECT_EQ(1u, data.num_missing_tiles);
2024 EXPECT_EQ(0u, data.num_incomplete_tiles); 1924 EXPECT_EQ(0u, data.num_incomplete_tiles);
2025 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); 1925 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads());
2026 } 1926 }
2027 1927
2028 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { 1928 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) {
2029 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1929 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2030 1930
2031 gfx::Size tile_size(100, 100); 1931 gfx::Size tile_size(100, 100);
2032 gfx::Size layer_bounds(200, 200); 1932 gfx::Size layer_bounds(200, 200);
2033 1933
2034 scoped_refptr<FakePicturePileImpl> pending_pile = 1934 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2035 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1935 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2036 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 1936 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
2037 ActivateTree(); 1937 ActivateTree();
2038 1938
2039 std::vector<Tile*> low_tiles = 1939 std::vector<Tile*> low_tiles =
2040 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); 1940 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting();
2041 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); 1941 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles);
2042 1942
2043 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1943 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
2044 AppendQuadsData data; 1944 AppendQuadsData data;
2045 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); 1945 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr);
2046 active_layer_->AppendQuads(render_pass.get(), &data); 1946 active_layer_->AppendQuads(render_pass.get(), &data);
2047 active_layer_->DidDraw(nullptr); 1947 active_layer_->DidDraw(nullptr);
2048 1948
2049 EXPECT_EQ(1u, render_pass->quad_list.size()); 1949 EXPECT_EQ(1u, render_pass->quad_list.size());
2050 EXPECT_EQ(0u, data.num_missing_tiles); 1950 EXPECT_EQ(0u, data.num_missing_tiles);
2051 EXPECT_EQ(1u, data.num_incomplete_tiles); 1951 EXPECT_EQ(1u, data.num_incomplete_tiles);
2052 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); 1952 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads());
2053 } 1953 }
2054 1954
2055 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { 1955 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) {
2056 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1956 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2057 1957
2058 gfx::Size tile_size(100, 100); 1958 gfx::Size tile_size(100, 100);
2059 gfx::Size layer_bounds(200, 200); 1959 gfx::Size layer_bounds(200, 200);
2060 1960
2061 scoped_refptr<FakePicturePileImpl> pending_pile = 1961 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2062 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1962 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2063 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 1963 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
2064 ActivateTree(); 1964 ActivateTree();
2065 1965
2066 // All high res tiles have resources except one. 1966 // All high res tiles have resources except one.
2067 std::vector<Tile*> high_tiles = 1967 std::vector<Tile*> high_tiles =
2068 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting(); 1968 active_layer_->tilings()->tiling_at(0)->AllTilesForTesting();
2069 high_tiles.erase(high_tiles.begin()); 1969 high_tiles.erase(high_tiles.begin());
2070 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); 1970 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles);
2071 1971
2072 // All low res tiles have resources. 1972 // All low res tiles have resources.
2073 std::vector<Tile*> low_tiles = 1973 std::vector<Tile*> low_tiles =
(...skipping 17 matching lines...) Expand all
2091 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { 1991 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) {
2092 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1992 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2093 1993
2094 gfx::Size tile_size(100, 100); 1994 gfx::Size tile_size(100, 100);
2095 gfx::Size layer_bounds(200, 200); 1995 gfx::Size layer_bounds(200, 200);
2096 gfx::Size viewport_size(400, 400); 1996 gfx::Size viewport_size(400, 400);
2097 1997
2098 host_impl_.SetViewportSize(viewport_size); 1998 host_impl_.SetViewportSize(viewport_size);
2099 host_impl_.SetDeviceScaleFactor(2.f); 1999 host_impl_.SetDeviceScaleFactor(2.f);
2100 2000
2101 scoped_refptr<FakePicturePileImpl> pending_pile = 2001 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
2102 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
2103 scoped_refptr<FakePicturePileImpl> active_pile =
2104 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
2105 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region());
2106 2002
2107 // One ideal tile exists, this will get used when drawing. 2003 // One ideal tile exists, this will get used when drawing.
2108 std::vector<Tile*> ideal_tiles; 2004 std::vector<Tile*> ideal_tiles;
2109 EXPECT_EQ(2.f, active_layer_->HighResTiling()->contents_scale()); 2005 EXPECT_EQ(2.f, active_layer_->HighResTiling()->contents_scale());
2110 ideal_tiles.push_back(active_layer_->HighResTiling()->TileAt(0, 0)); 2006 ideal_tiles.push_back(active_layer_->HighResTiling()->TileAt(0, 0));
2111 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 2007 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
2112 ideal_tiles); 2008 ideal_tiles);
2113 2009
2114 // Due to layer scale throttling, the raster contents scale is changed to 1, 2010 // Due to layer scale throttling, the raster contents scale is changed to 1,
2115 // while the ideal is still 2. 2011 // while the ideal is still 2.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); 2133 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting();
2238 2134
2239 AssertNoTilesRequired(active_layer_->HighResTiling()); 2135 AssertNoTilesRequired(active_layer_->HighResTiling());
2240 AssertNoTilesRequired(active_layer_->LowResTiling()); 2136 AssertNoTilesRequired(active_layer_->LowResTiling());
2241 } 2137 }
2242 2138
2243 TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { 2139 TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
2244 gfx::Size layer_bounds(400, 400); 2140 gfx::Size layer_bounds(400, 400);
2245 gfx::Size tile_size(100, 100); 2141 gfx::Size tile_size(100, 100);
2246 2142
2247 scoped_refptr<FakePicturePileImpl> pending_pile = 2143 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2248 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2144 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2249 // This pile will create tilings, but has no recordings so will not create any 2145 // This raster source will create tilings, but has no recordings so will not
2250 // tiles. This is attempting to simulate scrolling past the end of recorded 2146 // create any tiles. This is attempting to simulate scrolling past the end of
2251 // content on the active layer, where the recordings are so far away that 2147 // recorded content on the active layer, where the recordings are so far away
2252 // no tiles are created. 2148 // that no tiles are created.
2253 bool is_solid_color = false; 2149 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
2254 scoped_refptr<FakePicturePileImpl> active_pile = 2150 FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
2255 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( 2151 gfx::Rect());
2256 tile_size, layer_bounds, is_solid_color);
2257 2152
2258 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region()); 2153 SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
2154 tile_size, Region());
2259 2155
2260 // Active layer has tilings, but no tiles due to missing recordings. 2156 // Active layer has tilings, but no tiles due to missing recordings.
2261 EXPECT_TRUE(active_layer_->CanHaveTilings()); 2157 EXPECT_TRUE(active_layer_->CanHaveTilings());
2262 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u); 2158 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u);
2263 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u); 2159 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u);
2264 2160
2265 // Since the active layer has no tiles at all, the pending layer doesn't 2161 // Since the active layer has no tiles at all, the pending layer doesn't
2266 // need content in order to activate. 2162 // need content in order to activate.
2267 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 2163 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
2268 EXPECT_FALSE(pending_layer_->LowResTiling()); 2164 EXPECT_FALSE(pending_layer_->LowResTiling());
2269 2165
2270 AssertNoTilesRequired(pending_layer_->HighResTiling()); 2166 AssertNoTilesRequired(pending_layer_->HighResTiling());
2271 } 2167 }
2272 2168
2273 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { 2169 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) {
2274 gfx::Size layer_bounds(400, 400); 2170 gfx::Size layer_bounds(400, 400);
2275 gfx::Size tile_size(100, 100); 2171 gfx::Size tile_size(100, 100);
2276 2172
2277 scoped_refptr<FakePicturePileImpl> pending_pile = 2173 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2278 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2174 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2279 scoped_refptr<FakePicturePileImpl> active_pile = 2175 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
2280 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 2176 FakeDisplayListRasterSource::CreateEmpty(layer_bounds);
2281 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region()); 2177 SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
2178 tile_size, Region());
2282 2179
2283 // Active layer can't have tiles. 2180 // Active layer can't have tiles.
2284 EXPECT_FALSE(active_layer_->CanHaveTilings()); 2181 EXPECT_FALSE(active_layer_->CanHaveTilings());
2285 2182
2286 // All high res tiles required. This should be considered identical 2183 // All high res tiles required. This should be considered identical
2287 // to the case where there is no active layer, to avoid flashing content. 2184 // to the case where there is no active layer, to avoid flashing content.
2288 // This can happen if a layer exists for a while and switches from 2185 // This can happen if a layer exists for a while and switches from
2289 // not being able to have content to having content. 2186 // not being able to have content to having content.
2290 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 2187 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
2291 EXPECT_FALSE(pending_layer_->LowResTiling()); 2188 EXPECT_FALSE(pending_layer_->LowResTiling());
2292 2189
2293 AssertAllTilesRequired(pending_layer_->HighResTiling()); 2190 AssertAllTilesRequired(pending_layer_->HighResTiling());
2294 } 2191 }
2295 2192
2296 TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) { 2193 TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) {
2297 gfx::Size pending_layer_bounds(400, 400); 2194 gfx::Size pending_layer_bounds(400, 400);
2298 gfx::Size active_layer_bounds(200, 200); 2195 gfx::Size active_layer_bounds(200, 200);
2299 gfx::Size tile_size(100, 100); 2196 gfx::Size tile_size(100, 100);
2300 2197
2301 scoped_refptr<FakePicturePileImpl> pending_pile = 2198 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2302 FakePicturePileImpl::CreateFilledPile(tile_size, pending_layer_bounds); 2199 FakeDisplayListRasterSource::CreateFilled(pending_layer_bounds);
2303 scoped_refptr<FakePicturePileImpl> active_pile = 2200 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
2304 FakePicturePileImpl::CreateFilledPile(tile_size, active_layer_bounds); 2201 FakeDisplayListRasterSource::CreateFilled(active_layer_bounds);
2305 2202
2306 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region()); 2203 SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
2204 tile_size, Region());
2307 2205
2308 // Since the active layer has different bounds, the pending layer needs all 2206 // Since the active layer has different bounds, the pending layer needs all
2309 // high res tiles in order to activate. 2207 // high res tiles in order to activate.
2310 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 2208 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
2311 EXPECT_FALSE(pending_layer_->LowResTiling()); 2209 EXPECT_FALSE(pending_layer_->LowResTiling());
2312 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 2210 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
2313 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); 2211 active_layer_->LowResTiling()->UpdateAllRequiredStateForTesting();
2314 2212
2315 AssertAllTilesRequired(pending_layer_->HighResTiling()); 2213 AssertAllTilesRequired(pending_layer_->HighResTiling());
2316 AssertAllTilesRequired(active_layer_->HighResTiling()); 2214 AssertAllTilesRequired(active_layer_->HighResTiling());
2317 AssertNoTilesRequired(active_layer_->LowResTiling()); 2215 AssertNoTilesRequired(active_layer_->LowResTiling());
2318 } 2216 }
2319 2217
2320 TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { 2218 TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) {
2321 gfx::Size tile_size(100, 100);
2322 gfx::Size layer_bounds(400, 400); 2219 gfx::Size layer_bounds(400, 400);
2323 scoped_refptr<FakePicturePileImpl> pending_pile = 2220 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2324 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2221 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2325 2222
2326 host_impl_.CreatePendingTree(); 2223 host_impl_.CreatePendingTree();
2327 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 2224 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
2328 2225
2329 scoped_ptr<FakePictureLayerImpl> pending_layer = 2226 scoped_ptr<FakePictureLayerImpl> pending_layer =
2330 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, 2227 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_,
2331 pending_pile); 2228 pending_raster_source);
2332 pending_layer->SetDrawsContent(true); 2229 pending_layer->SetDrawsContent(true);
2333 pending_tree->SetRootLayer(pending_layer.Pass()); 2230 pending_tree->SetRootLayer(pending_layer.Pass());
2334 2231
2335 pending_layer_ = static_cast<FakePictureLayerImpl*>( 2232 pending_layer_ = static_cast<FakePictureLayerImpl*>(
2336 host_impl_.pending_tree()->LayerById(id_)); 2233 host_impl_.pending_tree()->LayerById(id_));
2337 2234
2338 // Set some state on the pending layer, make sure it is not clobbered 2235 // Set some state on the pending layer, make sure it is not clobbered
2339 // by a sync from the active layer. This could happen because if the 2236 // by a sync from the active layer. This could happen because if the
2340 // pending layer has not been post-commit initialized it will attempt 2237 // pending layer has not been post-commit initialized it will attempt
2341 // to sync from the active layer. 2238 // to sync from the active layer.
2342 float raster_page_scale = 10.f * pending_layer_->raster_page_scale(); 2239 float raster_page_scale = 10.f * pending_layer_->raster_page_scale();
2343 pending_layer_->set_raster_page_scale(raster_page_scale); 2240 pending_layer_->set_raster_page_scale(raster_page_scale);
2344 2241
2345 host_impl_.ActivateSyncTree(); 2242 host_impl_.ActivateSyncTree();
2346 2243
2347 active_layer_ = static_cast<FakePictureLayerImpl*>( 2244 active_layer_ = static_cast<FakePictureLayerImpl*>(
2348 host_impl_.active_tree()->LayerById(id_)); 2245 host_impl_.active_tree()->LayerById(id_));
2349 2246
2350 EXPECT_EQ(0u, active_layer_->num_tilings()); 2247 EXPECT_EQ(0u, active_layer_->num_tilings());
2351 EXPECT_EQ(raster_page_scale, active_layer_->raster_page_scale()); 2248 EXPECT_EQ(raster_page_scale, active_layer_->raster_page_scale());
2352 } 2249 }
2353 2250
2354 TEST_F(PictureLayerImplTest, ShareTilesOnNextFrame) { 2251 TEST_F(PictureLayerImplTest, ShareTilesOnNextFrame) {
2355 gfx::Size layer_bounds(1500, 1500); 2252 gfx::Size layer_bounds(1500, 1500);
2356 gfx::Size tile_size(100, 100);
2357 2253
2358 scoped_refptr<FakePicturePileImpl> pending_pile = 2254 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2359 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2255 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2360 2256
2361 SetupPendingTree(pending_pile); 2257 SetupPendingTree(pending_raster_source);
2362 2258
2363 PictureLayerTiling* tiling = pending_layer_->HighResTiling(); 2259 PictureLayerTiling* tiling = pending_layer_->HighResTiling();
2364 gfx::Rect first_invalidate = tiling->TilingDataForTesting().TileBounds(0, 0); 2260 gfx::Rect first_invalidate = tiling->TilingDataForTesting().TileBounds(0, 0);
2365 first_invalidate.Inset(tiling->TilingDataForTesting().border_texels(), 2261 first_invalidate.Inset(tiling->TilingDataForTesting().border_texels(),
2366 tiling->TilingDataForTesting().border_texels()); 2262 tiling->TilingDataForTesting().border_texels());
2367 gfx::Rect second_invalidate = tiling->TilingDataForTesting().TileBounds(1, 1); 2263 gfx::Rect second_invalidate = tiling->TilingDataForTesting().TileBounds(1, 1);
2368 second_invalidate.Inset(tiling->TilingDataForTesting().border_texels(), 2264 second_invalidate.Inset(tiling->TilingDataForTesting().border_texels(),
2369 tiling->TilingDataForTesting().border_texels()); 2265 tiling->TilingDataForTesting().border_texels());
2370 2266
2371 ActivateTree(); 2267 ActivateTree();
2372 2268
2373 // Make a pending tree with an invalidated raster tile 0,0. 2269 // Make a pending tree with an invalidated raster tile 0,0.
2374 SetupPendingTreeWithInvalidation(pending_pile, first_invalidate); 2270 SetupPendingTreeWithInvalidation(pending_raster_source, first_invalidate);
2375 2271
2376 // Activate and make a pending tree with an invalidated raster tile 1,1. 2272 // Activate and make a pending tree with an invalidated raster tile 1,1.
2377 ActivateTree(); 2273 ActivateTree();
2378 2274
2379 SetupPendingTreeWithInvalidation(pending_pile, second_invalidate); 2275 SetupPendingTreeWithInvalidation(pending_raster_source, second_invalidate);
2380 2276
2381 PictureLayerTiling* pending_tiling = pending_layer_->tilings()->tiling_at(0); 2277 PictureLayerTiling* pending_tiling = pending_layer_->tilings()->tiling_at(0);
2382 PictureLayerTiling* active_tiling = active_layer_->tilings()->tiling_at(0); 2278 PictureLayerTiling* active_tiling = active_layer_->tilings()->tiling_at(0);
2383 2279
2384 // pending_tiling->CreateAllTilesForTesting();
2385
2386 // Tile 0,0 not exist on pending, but tile 1,1 should. 2280 // Tile 0,0 not exist on pending, but tile 1,1 should.
2387 EXPECT_TRUE(active_tiling->TileAt(0, 0)); 2281 EXPECT_TRUE(active_tiling->TileAt(0, 0));
2388 EXPECT_TRUE(active_tiling->TileAt(1, 0)); 2282 EXPECT_TRUE(active_tiling->TileAt(1, 0));
2389 EXPECT_TRUE(active_tiling->TileAt(0, 1)); 2283 EXPECT_TRUE(active_tiling->TileAt(0, 1));
2390 EXPECT_FALSE(pending_tiling->TileAt(0, 0)); 2284 EXPECT_FALSE(pending_tiling->TileAt(0, 0));
2391 EXPECT_FALSE(pending_tiling->TileAt(1, 0)); 2285 EXPECT_FALSE(pending_tiling->TileAt(1, 0));
2392 EXPECT_FALSE(pending_tiling->TileAt(0, 1)); 2286 EXPECT_FALSE(pending_tiling->TileAt(0, 1));
2393 EXPECT_NE(active_tiling->TileAt(1, 1), pending_tiling->TileAt(1, 1)); 2287 EXPECT_NE(active_tiling->TileAt(1, 1), pending_tiling->TileAt(1, 1));
2394 EXPECT_TRUE(active_tiling->TileAt(1, 1)); 2288 EXPECT_TRUE(active_tiling->TileAt(1, 1));
2395 EXPECT_TRUE(pending_tiling->TileAt(1, 1)); 2289 EXPECT_TRUE(pending_tiling->TileAt(1, 1));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 EXPECT_TRUE(active_tiling->TileAt(0, 1)); 2322 EXPECT_TRUE(active_tiling->TileAt(0, 1));
2429 EXPECT_TRUE(active_tiling->TileAt(1, 1)); 2323 EXPECT_TRUE(active_tiling->TileAt(1, 1));
2430 2324
2431 EXPECT_FALSE(pending_tiling->TileAt(0, 0)); 2325 EXPECT_FALSE(pending_tiling->TileAt(0, 0));
2432 EXPECT_FALSE(pending_tiling->TileAt(1, 0)); 2326 EXPECT_FALSE(pending_tiling->TileAt(1, 0));
2433 EXPECT_FALSE(pending_tiling->TileAt(0, 1)); 2327 EXPECT_FALSE(pending_tiling->TileAt(0, 1));
2434 EXPECT_FALSE(pending_tiling->TileAt(1, 1)); 2328 EXPECT_FALSE(pending_tiling->TileAt(1, 1));
2435 } 2329 }
2436 2330
2437 TEST_F(PictureLayerImplTest, ShareInvalidActiveTreeTiles) { 2331 TEST_F(PictureLayerImplTest, ShareInvalidActiveTreeTiles) {
2438 gfx::Size tile_size(100, 100);
2439 gfx::Size layer_bounds(1500, 1500); 2332 gfx::Size layer_bounds(1500, 1500);
2440 2333
2441 scoped_refptr<FakePicturePileImpl> pending_pile = 2334 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2442 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2335 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2443 scoped_refptr<FakePicturePileImpl> active_pile = 2336 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
2444 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2337 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2445 SetupTreesWithInvalidation(pending_pile, active_pile, gfx::Rect(1, 1)); 2338 SetupTreesWithInvalidation(pending_raster_source, active_raster_source,
2339 gfx::Rect(1, 1));
2446 // Activate the invalidation. 2340 // Activate the invalidation.
2447 ActivateTree(); 2341 ActivateTree();
2448 // Make another pending tree without any invalidation in it. 2342 // Make another pending tree without any invalidation in it.
2449 scoped_refptr<FakePicturePileImpl> pending_pile2 = 2343 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source2 =
2450 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2344 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2451 SetupPendingTree(pending_pile2); 2345 SetupPendingTree(pending_raster_source2);
2452 2346
2453 EXPECT_GE(active_layer_->num_tilings(), 1u); 2347 EXPECT_GE(active_layer_->num_tilings(), 1u);
2454 EXPECT_GE(pending_layer_->num_tilings(), 1u); 2348 EXPECT_GE(pending_layer_->num_tilings(), 1u);
2455 2349
2456 // The active tree invalidation was handled by the active tiles. 2350 // The active tree invalidation was handled by the active tiles.
2457 PictureLayerTiling* active_tiling = active_layer_->tilings()->tiling_at(0); 2351 PictureLayerTiling* active_tiling = active_layer_->tilings()->tiling_at(0);
2458 PictureLayerTiling* pending_tiling = pending_layer_->tilings()->tiling_at(0); 2352 PictureLayerTiling* pending_tiling = pending_layer_->tilings()->tiling_at(0);
2459 ASSERT_TRUE(active_tiling); 2353 ASSERT_TRUE(active_tiling);
2460 ASSERT_TRUE(pending_tiling); 2354 ASSERT_TRUE(pending_tiling);
2461 2355
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 EXPECT_FALSE(pending_tiling->TileAt(1, 0)); 2387 EXPECT_FALSE(pending_tiling->TileAt(1, 0));
2494 EXPECT_FALSE(pending_tiling->TileAt(0, 1)); 2388 EXPECT_FALSE(pending_tiling->TileAt(0, 1));
2495 EXPECT_FALSE(pending_tiling->TileAt(1, 1)); 2389 EXPECT_FALSE(pending_tiling->TileAt(1, 1));
2496 2390
2497 EXPECT_NE(active_tiling->TileAt(0, 0), pending_tiling->TileAt(0, 0)); 2391 EXPECT_NE(active_tiling->TileAt(0, 0), pending_tiling->TileAt(0, 0));
2498 } 2392 }
2499 2393
2500 TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) { 2394 TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) {
2501 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 2395 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2502 2396
2503 gfx::Size tile_size(100, 100);
2504 gfx::Size layer_bounds(10, 10); 2397 gfx::Size layer_bounds(10, 10);
2505 2398
2506 scoped_refptr<FakePicturePileImpl> pending_pile = 2399 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2507 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2400 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2508 scoped_refptr<FakePicturePileImpl> active_pile = 2401 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
2509 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 2402 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2510 2403
2511 SetupTrees(pending_pile, active_pile); 2404 SetupTrees(pending_raster_source, active_raster_source);
2512 2405
2513 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); 2406 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f));
2514 EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f)); 2407 EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f));
2515 2408
2516 // Gpu rasterization is disabled by default. 2409 // Gpu rasterization is disabled by default.
2517 EXPECT_FALSE(host_impl_.use_gpu_rasterization()); 2410 EXPECT_FALSE(host_impl_.use_gpu_rasterization());
2518 // Toggling the gpu rasterization clears all tilings on both trees. 2411 // Toggling the gpu rasterization clears all tilings on both trees.
2519 host_impl_.SetHasGpuRasterizationTrigger(true); 2412 host_impl_.SetHasGpuRasterizationTrigger(true);
2520 host_impl_.SetContentIsSuitableForGpuRasterization(true); 2413 host_impl_.SetContentIsSuitableForGpuRasterization(true);
2521 host_impl_.UpdateTreeResourcesForGpuRasterizationIfNeeded(); 2414 host_impl_.UpdateTreeResourcesForGpuRasterizationIfNeeded();
2522 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 2415 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
2523 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 2416 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
2524 2417
2525 // Make sure that we can still add tiling to the pending layer, 2418 // Make sure that we can still add tiling to the pending layer,
2526 // that gets synced to the active layer. 2419 // that gets synced to the active layer.
2527 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 2420 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2528 bool update_lcd_text = false; 2421 bool update_lcd_text = false;
2529 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 2422 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
2530 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); 2423 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f));
2531 2424
2532 ActivateTree(); 2425 ActivateTree();
2533 EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f)); 2426 EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f));
2534 2427
2535 SetupPendingTree(pending_pile); 2428 SetupPendingTree(pending_raster_source);
2536 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); 2429 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f));
2537 2430
2538 // Toggling the gpu rasterization clears all tilings on both trees. 2431 // Toggling the gpu rasterization clears all tilings on both trees.
2539 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); 2432 EXPECT_TRUE(host_impl_.use_gpu_rasterization());
2540 host_impl_.SetHasGpuRasterizationTrigger(false); 2433 host_impl_.SetHasGpuRasterizationTrigger(false);
2541 host_impl_.UpdateTreeResourcesForGpuRasterizationIfNeeded(); 2434 host_impl_.UpdateTreeResourcesForGpuRasterizationIfNeeded();
2542 EXPECT_EQ(GpuRasterizationStatus::OFF_VIEWPORT, 2435 EXPECT_EQ(GpuRasterizationStatus::OFF_VIEWPORT,
2543 host_impl_.gpu_rasterization_status()); 2436 host_impl_.gpu_rasterization_status());
2544 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 2437 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
2545 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 2438 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
2546 2439
2547 host_impl_.SetHasGpuRasterizationTrigger(true); 2440 host_impl_.SetHasGpuRasterizationTrigger(true);
2548 host_impl_.SetContentIsSuitableForGpuRasterization(false); 2441 host_impl_.SetContentIsSuitableForGpuRasterization(false);
2549 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT, 2442 EXPECT_EQ(GpuRasterizationStatus::OFF_CONTENT,
2550 host_impl_.gpu_rasterization_status()); 2443 host_impl_.gpu_rasterization_status());
2551 } 2444 }
2552 2445
2553 TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) { 2446 TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) {
2554 gfx::Size tile_size(100, 100);
2555
2556 // Put 0.5 as high res. 2447 // Put 0.5 as high res.
2557 host_impl_.SetDeviceScaleFactor(0.5f); 2448 host_impl_.SetDeviceScaleFactor(0.5f);
2558 2449
2559 scoped_refptr<FakePicturePileImpl> pending_pile = 2450 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2560 FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(10, 10)); 2451 FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10));
2561 SetupPendingTree(pending_pile); 2452 SetupPendingTree(pending_raster_source);
2562 2453
2563 // Sanity checks. 2454 // Sanity checks.
2564 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 2455 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
2565 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(0.5f)); 2456 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(0.5f));
2566 2457
2567 ActivateTree(); 2458 ActivateTree();
2568 2459
2569 // Now, set the bounds to be 1x1, so that minimum contents scale becomes 1. 2460 // Now, set the bounds to be 1x1, so that minimum contents scale becomes 1.
2570 pending_pile = 2461 pending_raster_source =
2571 FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(1, 1)); 2462 FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1));
2572 SetupPendingTree(pending_pile); 2463 SetupPendingTree(pending_raster_source);
2573 2464
2574 // Another sanity check. 2465 // Another sanity check.
2575 EXPECT_EQ(1.f, pending_layer_->MinimumContentsScale()); 2466 EXPECT_EQ(1.f, pending_layer_->MinimumContentsScale());
2576 2467
2577 // Since the MinContentsScale is 1, the 0.5 tiling should have been replaced 2468 // Since the MinContentsScale is 1, the 0.5 tiling should have been replaced
2578 // by a 1.0 tiling during the UDP in SetupPendingTree. 2469 // by a 1.0 tiling during the UDP in SetupPendingTree.
2579 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 2470 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
2580 PictureLayerTiling* tiling = 2471 PictureLayerTiling* tiling =
2581 pending_layer_->tilings()->FindTilingWithScale(1.0f); 2472 pending_layer_->tilings()->FindTilingWithScale(1.0f);
2582 ASSERT_TRUE(tiling); 2473 ASSERT_TRUE(tiling);
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 maximum_animation_scale, 2866 maximum_animation_scale,
2976 starting_animation_scale, animating_transform); 2867 starting_animation_scale, animating_transform);
2977 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); 2868 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f);
2978 } 2869 }
2979 2870
2980 TEST_F(PictureLayerImplTest, TilingSetRasterQueue) { 2871 TEST_F(PictureLayerImplTest, TilingSetRasterQueue) {
2981 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 2872 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2982 2873
2983 host_impl_.SetViewportSize(gfx::Size(500, 500)); 2874 host_impl_.SetViewportSize(gfx::Size(500, 500));
2984 2875
2985 gfx::Size recording_tile_size(100, 100);
2986 gfx::Size layer_bounds(1000, 1000); 2876 gfx::Size layer_bounds(1000, 1000);
2987 2877
2988 scoped_refptr<FakePicturePileImpl> pending_pile = 2878 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2989 FakePicturePileImpl::CreateFilledPile(recording_tile_size, layer_bounds); 2879 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2990 2880
2991 SetupPendingTree(pending_pile); 2881 SetupPendingTree(pending_raster_source);
2992 EXPECT_EQ(1u, pending_layer_->num_tilings()); 2882 EXPECT_EQ(1u, pending_layer_->num_tilings());
2993 2883
2994 std::set<Tile*> unique_tiles; 2884 std::set<Tile*> unique_tiles;
2995 bool reached_prepaint = false; 2885 bool reached_prepaint = false;
2996 int non_ideal_tile_count = 0u; 2886 int non_ideal_tile_count = 0u;
2997 int low_res_tile_count = 0u; 2887 int low_res_tile_count = 0u;
2998 int high_res_tile_count = 0u; 2888 int high_res_tile_count = 0u;
2999 int high_res_now_tiles = 0u; 2889 int high_res_now_tiles = 0u;
3000 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll( 2890 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll(
3001 pending_layer_->picture_layer_tiling_set(), false)); 2891 pending_layer_->picture_layer_tiling_set(), false));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 queue.reset(new TilingSetRasterQueueAll( 2999 queue.reset(new TilingSetRasterQueueAll(
3110 pending_layer_->picture_layer_tiling_set(), true)); 3000 pending_layer_->picture_layer_tiling_set(), true));
3111 EXPECT_TRUE(queue->IsEmpty()); 3001 EXPECT_TRUE(queue->IsEmpty());
3112 } 3002 }
3113 3003
3114 TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) { 3004 TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) {
3115 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 3005 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
3116 3006
3117 host_impl_.SetViewportSize(gfx::Size(500, 500)); 3007 host_impl_.SetViewportSize(gfx::Size(500, 500));
3118 3008
3119 gfx::Size tile_size(100, 100);
3120 gfx::Size layer_bounds(1000, 1000); 3009 gfx::Size layer_bounds(1000, 1000);
3121 3010
3122 scoped_refptr<FakePicturePileImpl> pending_pile = 3011 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
3123 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3012 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
3124 3013
3125 SetupPendingTree(pending_pile); 3014 SetupPendingTree(pending_raster_source);
3126 ActivateTree(); 3015 ActivateTree();
3127 EXPECT_EQ(2u, active_layer_->num_tilings()); 3016 EXPECT_EQ(2u, active_layer_->num_tilings());
3128 3017
3129 scoped_ptr<TilingSetRasterQueueRequired> queue( 3018 scoped_ptr<TilingSetRasterQueueRequired> queue(
3130 new TilingSetRasterQueueRequired( 3019 new TilingSetRasterQueueRequired(
3131 active_layer_->picture_layer_tiling_set(), 3020 active_layer_->picture_layer_tiling_set(),
3132 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW)); 3021 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW));
3133 EXPECT_FALSE(queue->IsEmpty()); 3022 EXPECT_FALSE(queue->IsEmpty());
3134 while (!queue->IsEmpty()) { 3023 while (!queue->IsEmpty()) {
3135 PrioritizedTile prioritized_tile = queue->Top(); 3024 PrioritizedTile prioritized_tile = queue->Top();
3136 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); 3025 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw());
3137 EXPECT_FALSE(prioritized_tile.tile()->draw_info().IsReadyToDraw()); 3026 EXPECT_FALSE(prioritized_tile.tile()->draw_info().IsReadyToDraw());
3138 queue->Pop(); 3027 queue->Pop();
3139 } 3028 }
3140 3029
3141 queue.reset(new TilingSetRasterQueueRequired( 3030 queue.reset(new TilingSetRasterQueueRequired(
3142 active_layer_->picture_layer_tiling_set(), 3031 active_layer_->picture_layer_tiling_set(),
3143 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); 3032 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
3144 EXPECT_TRUE(queue->IsEmpty()); 3033 EXPECT_TRUE(queue->IsEmpty());
3145 } 3034 }
3146 3035
3147 TEST_F(PictureLayerImplTest, TilingSetRasterQueueRequiredNoHighRes) { 3036 TEST_F(PictureLayerImplTest, TilingSetRasterQueueRequiredNoHighRes) {
3148 scoped_ptr<FakePicturePile> empty_recording = 3037 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
3149 FakePicturePile::CreateEmptyPile(gfx::Size(256, 256), 3038 FakeDisplayListRasterSource::CreateFilledSolidColor(
3150 gfx::Size(1024, 1024)); 3039 gfx::Size(1024, 1024));
3151 empty_recording->SetIsSolidColor(true);
3152 3040
3153 scoped_refptr<FakePicturePileImpl> pending_pile = 3041 SetupPendingTree(pending_raster_source);
3154 FakePicturePileImpl::CreateFromPile(empty_recording.get(), nullptr);
3155
3156 SetupPendingTree(pending_pile);
3157 EXPECT_FALSE( 3042 EXPECT_FALSE(
3158 pending_layer_->picture_layer_tiling_set()->FindTilingWithResolution( 3043 pending_layer_->picture_layer_tiling_set()->FindTilingWithResolution(
3159 HIGH_RESOLUTION)); 3044 HIGH_RESOLUTION));
3160 3045
3161 scoped_ptr<TilingSetRasterQueueRequired> queue( 3046 scoped_ptr<TilingSetRasterQueueRequired> queue(
3162 new TilingSetRasterQueueRequired( 3047 new TilingSetRasterQueueRequired(
3163 pending_layer_->picture_layer_tiling_set(), 3048 pending_layer_->picture_layer_tiling_set(),
3164 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); 3049 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
3165 EXPECT_TRUE(queue->IsEmpty()); 3050 EXPECT_TRUE(queue->IsEmpty());
3166 } 3051 }
3167 3052
3168 TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { 3053 TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) {
3169 gfx::Size tile_size(100, 100);
3170 gfx::Size layer_bounds(1000, 1000); 3054 gfx::Size layer_bounds(1000, 1000);
3171 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 3055 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
3172 3056
3173 host_impl_.SetViewportSize(gfx::Size(500, 500)); 3057 host_impl_.SetViewportSize(gfx::Size(500, 500));
3174 3058
3175 scoped_refptr<FakePicturePileImpl> pending_pile = 3059 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
3176 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3060 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
3177 3061
3178 // TODO(vmpstr): Add a test with tilings other than high res on the active 3062 // TODO(vmpstr): Add a test with tilings other than high res on the active
3179 // tree (crbug.com/519607). 3063 // tree (crbug.com/519607).
3180 SetupPendingTree(pending_pile); 3064 SetupPendingTree(pending_raster_source);
3181 EXPECT_EQ(1u, pending_layer_->num_tilings()); 3065 EXPECT_EQ(1u, pending_layer_->num_tilings());
3182 3066
3183 std::vector<Tile*> all_tiles; 3067 std::vector<Tile*> all_tiles;
3184 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { 3068 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
3185 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); 3069 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
3186 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); 3070 std::vector<Tile*> tiles = tiling->AllTilesForTesting();
3187 all_tiles.insert(all_tiles.end(), tiles.begin(), tiles.end()); 3071 all_tiles.insert(all_tiles.end(), tiles.begin(), tiles.end());
3188 } 3072 }
3189 3073
3190 std::set<Tile*> all_tiles_set(all_tiles.begin(), all_tiles.end()); 3074 std::set<Tile*> all_tiles_set(all_tiles.begin(), all_tiles.end());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 } 3194 }
3311 3195
3312 TEST_F(PictureLayerImplTest, Occlusion) { 3196 TEST_F(PictureLayerImplTest, Occlusion) {
3313 gfx::Size tile_size(102, 102); 3197 gfx::Size tile_size(102, 102);
3314 gfx::Size layer_bounds(1000, 1000); 3198 gfx::Size layer_bounds(1000, 1000);
3315 gfx::Size viewport_size(1000, 1000); 3199 gfx::Size viewport_size(1000, 1000);
3316 3200
3317 LayerTestCommon::LayerImplTest impl; 3201 LayerTestCommon::LayerImplTest impl;
3318 host_impl_.SetViewportSize(viewport_size); 3202 host_impl_.SetViewportSize(viewport_size);
3319 3203
3320 scoped_refptr<FakePicturePileImpl> pending_pile = 3204 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
3321 FakePicturePileImpl::CreateFilledPile(layer_bounds, layer_bounds); 3205 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
3322 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 3206 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
3323 ActivateTree(); 3207 ActivateTree();
3324 3208
3325 std::vector<Tile*> tiles = 3209 std::vector<Tile*> tiles =
3326 active_layer_->HighResTiling()->AllTilesForTesting(); 3210 active_layer_->HighResTiling()->AllTilesForTesting();
3327 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); 3211 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
3328 3212
3329 { 3213 {
3330 SCOPED_TRACE("No occlusion"); 3214 SCOPED_TRACE("No occlusion");
3331 gfx::Rect occluded; 3215 gfx::Rect occluded;
3332 impl.AppendQuadsWithOcclusion(active_layer_, occluded); 3216 impl.AppendQuadsWithOcclusion(active_layer_, occluded);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 3337
3454 // The pending high-res tiles are not ready, so we cannot activate. 3338 // The pending high-res tiles are not ready, so we cannot activate.
3455 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate()); 3339 EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
3456 3340
3457 // When the pending high-res tiles are ready, we can activate. 3341 // When the pending high-res tiles are ready, we can activate.
3458 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); 3342 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
3459 EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate()); 3343 EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
3460 } 3344 }
3461 3345
3462 TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { 3346 TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
3463 gfx::Size tile_size(400, 400);
3464 gfx::Size layer_bounds(1300, 1900); 3347 gfx::Size layer_bounds(1300, 1900);
3465 3348 SetupDefaultTrees(layer_bounds);
3466 scoped_refptr<FakePicturePileImpl> pending_pile =
3467 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3468 scoped_refptr<FakePicturePileImpl> active_pile =
3469 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3470
3471 SetupTrees(pending_pile, active_pile);
3472 3349
3473 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 3350 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
3474 EXPECT_LT(low_res_factor, 1.f); 3351 EXPECT_LT(low_res_factor, 1.f);
3475 3352
3476 ResetTilingsAndRasterScales(); 3353 ResetTilingsAndRasterScales();
3477 3354
3478 SetupDrawPropertiesAndUpdateTiles(active_layer_, 3355 SetupDrawPropertiesAndUpdateTiles(active_layer_,
3479 6.f, // ideal contents scale 3356 6.f, // ideal contents scale
3480 3.f, // device scale 3357 3.f, // device scale
3481 2.f, // page scale 3358 2.f, // page scale
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3518 3.3f, // page scale 3395 3.3f, // page scale
3519 1.f, // maximum animation scale 3396 1.f, // maximum animation scale
3520 0.f, // starting animation scale 3397 0.f, // starting animation scale
3521 false); 3398 false);
3522 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 3399 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
3523 EXPECT_FLOAT_EQ(7.26f, 3400 EXPECT_FLOAT_EQ(7.26f,
3524 active_layer_->tilings()->tiling_at(0)->contents_scale()); 3401 active_layer_->tilings()->tiling_at(0)->contents_scale());
3525 } 3402 }
3526 3403
3527 TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { 3404 TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) {
3528 gfx::Size tile_size(400, 400);
3529 gfx::Size layer_bounds(1300, 1900); 3405 gfx::Size layer_bounds(1300, 1900);
3530 3406 SetupDefaultTrees(layer_bounds);
3531 scoped_refptr<FakePicturePileImpl> pending_pile =
3532 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3533 scoped_refptr<FakePicturePileImpl> active_pile =
3534 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3535
3536 SetupTrees(pending_pile, active_pile);
3537 3407
3538 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 3408 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
3539 EXPECT_LT(low_res_factor, 1.f); 3409 EXPECT_LT(low_res_factor, 1.f);
3540 3410
3541 ResetTilingsAndRasterScales(); 3411 ResetTilingsAndRasterScales();
3542 3412
3543 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 3413 SetupDrawPropertiesAndUpdateTiles(pending_layer_,
3544 6.f, // ideal contents scale 3414 6.f, // ideal contents scale
3545 3.f, // device scale 3415 3.f, // device scale
3546 2.f, // page scale 3416 2.f, // page scale
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 3480
3611 AssertAllTilesRequired(active_layer_->HighResTiling()); 3481 AssertAllTilesRequired(active_layer_->HighResTiling());
3612 if (host_impl_.settings().create_low_res_tiling) 3482 if (host_impl_.settings().create_low_res_tiling)
3613 AssertNoTilesRequired(active_layer_->LowResTiling()); 3483 AssertNoTilesRequired(active_layer_->LowResTiling());
3614 } 3484 }
3615 3485
3616 TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { 3486 TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
3617 gfx::Size layer_bounds(400, 400); 3487 gfx::Size layer_bounds(400, 400);
3618 gfx::Size tile_size(100, 100); 3488 gfx::Size tile_size(100, 100);
3619 3489
3620 scoped_refptr<FakePicturePileImpl> pending_pile = 3490 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
3621 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3491 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
3622 // This pile will create tilings, but has no recordings so will not create any 3492 // This raster source will create tilings, but has no recordings so will not
3623 // tiles. This is attempting to simulate scrolling past the end of recorded 3493 // create any tiles. This is attempting to simulate scrolling past the end of
3624 // content on the active layer, where the recordings are so far away that 3494 // recorded content on the active layer, where the recordings are so far away
3625 // no tiles are created. 3495 // that no tiles are created.
3626 bool is_solid_color = false; 3496 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
3627 scoped_refptr<FakePicturePileImpl> active_pile = 3497 FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds,
3628 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( 3498 gfx::Rect());
3629 tile_size, layer_bounds, is_solid_color);
3630 3499
3631 SetupTreesWithFixedTileSize(pending_pile, active_pile, tile_size, Region()); 3500 SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source,
3501 tile_size, Region());
3632 3502
3633 // Active layer has tilings, but no tiles due to missing recordings. 3503 // Active layer has tilings, but no tiles due to missing recordings.
3634 EXPECT_TRUE(active_layer_->CanHaveTilings()); 3504 EXPECT_TRUE(active_layer_->CanHaveTilings());
3635 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 3505 EXPECT_EQ(active_layer_->tilings()->num_tilings(),
3636 host_impl_.settings().create_low_res_tiling ? 2u : 1u); 3506 host_impl_.settings().create_low_res_tiling ? 2u : 1u);
3637 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u); 3507 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u);
3638 3508
3639 // Since the active layer has no tiles at all, the pending layer doesn't 3509 // Since the active layer has no tiles at all, the pending layer doesn't
3640 // need content in order to activate. 3510 // need content in order to activate.
3641 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); 3511 pending_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
3642 if (host_impl_.settings().create_low_res_tiling) 3512 if (host_impl_.settings().create_low_res_tiling)
3643 pending_layer_->LowResTiling()->UpdateAllRequiredStateForTesting(); 3513 pending_layer_->LowResTiling()->UpdateAllRequiredStateForTesting();
3644 3514
3645 AssertNoTilesRequired(pending_layer_->HighResTiling()); 3515 AssertNoTilesRequired(pending_layer_->HighResTiling());
3646 if (host_impl_.settings().create_low_res_tiling) 3516 if (host_impl_.settings().create_low_res_tiling)
3647 AssertNoTilesRequired(pending_layer_->LowResTiling()); 3517 AssertNoTilesRequired(pending_layer_->LowResTiling());
3648 } 3518 }
3649 3519
3650 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { 3520 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
3651 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 3521 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
3652
3653 gfx::Size tile_size(100, 100);
3654 gfx::Size layer_bounds(400, 400); 3522 gfx::Size layer_bounds(400, 400);
3655 3523 SetupDefaultTrees(layer_bounds);
3656 scoped_refptr<FakePicturePileImpl> pending_pile =
3657 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3658 scoped_refptr<FakePicturePileImpl> active_pile =
3659 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3660
3661 SetupTreesWithInvalidation(pending_pile, active_pile, Region());
3662 3524
3663 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 3525 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
3664 false); 3526 false);
3665 3527
3666 // UpdateTiles with valid viewport. Should update tile viewport. 3528 // UpdateTiles with valid viewport. Should update tile viewport.
3667 // Note viewport is considered invalid if and only if in resourceless 3529 // Note viewport is considered invalid if and only if in resourceless
3668 // software draw. 3530 // software draw.
3669 bool resourceless_software_draw = false; 3531 bool resourceless_software_draw = false;
3670 gfx::Rect viewport = gfx::Rect(layer_bounds); 3532 gfx::Rect viewport = gfx::Rect(layer_bounds);
3671 gfx::Transform transform; 3533 gfx::Transform transform;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3718 transform, 3580 transform,
3719 resourceless_software_draw); 3581 resourceless_software_draw);
3720 active_layer_->UpdateTiles(resourceless_software_draw); 3582 active_layer_->UpdateTiles(resourceless_software_draw);
3721 3583
3722 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, 3584 EXPECT_TRANSFORMATION_MATRIX_EQ(transform,
3723 active_layer_->screen_space_transform()); 3585 active_layer_->screen_space_transform());
3724 EXPECT_EQ(viewport, active_layer_->visible_rect_for_tile_priority()); 3586 EXPECT_EQ(viewport, active_layer_->visible_rect_for_tile_priority());
3725 } 3587 }
3726 3588
3727 TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { 3589 TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
3728 gfx::Size tile_size(400, 400);
3729 gfx::Size layer_bounds(1300, 1900); 3590 gfx::Size layer_bounds(1300, 1900);
3730
3731 scoped_refptr<FakePicturePileImpl> pending_pile =
3732 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3733 scoped_refptr<FakePicturePileImpl> active_pile =
3734 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3735
3736 std::vector<PictureLayerTiling*> used_tilings; 3591 std::vector<PictureLayerTiling*> used_tilings;
3737 3592 SetupDefaultTrees(layer_bounds);
3738 SetupTrees(pending_pile, active_pile);
3739 3593
3740 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 3594 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
3741 EXPECT_LT(low_res_factor, 1.f); 3595 EXPECT_LT(low_res_factor, 1.f);
3742 3596
3743 float device_scale = 1.7f; 3597 float device_scale = 1.7f;
3744 float page_scale = 3.2f; 3598 float page_scale = 3.2f;
3745 float scale = 1.f; 3599 float scale = 1.f;
3746 3600
3747 ResetTilingsAndRasterScales(); 3601 ResetTilingsAndRasterScales();
3748 3602
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 3689 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
3836 3690
3837 // If we remove it from our used tilings set, it is outside the range to keep 3691 // If we remove it from our used tilings set, it is outside the range to keep
3838 // so it is deleted. 3692 // so it is deleted.
3839 used_tilings.clear(); 3693 used_tilings.clear();
3840 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 3694 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3841 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); 3695 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings());
3842 } 3696 }
3843 3697
3844 TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) { 3698 TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) {
3845 gfx::Size tile_size(400, 400);
3846 gfx::Size layer_bounds(1300, 1900); 3699 gfx::Size layer_bounds(1300, 1900);
3847 3700 SetupDefaultTrees(layer_bounds);
3848 scoped_refptr<FakePicturePileImpl> pending_pile =
3849 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3850 scoped_refptr<FakePicturePileImpl> active_pile =
3851 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3852
3853 SetupTrees(pending_pile, active_pile);
3854 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 3701 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
3855 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings()); 3702 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings());
3856 3703
3857 // All tilings should be removed when losing output surface. 3704 // All tilings should be removed when losing output surface.
3858 active_layer_->ReleaseResources(); 3705 active_layer_->ReleaseResources();
3859 EXPECT_FALSE(active_layer_->tilings()); 3706 EXPECT_FALSE(active_layer_->tilings());
3860 active_layer_->RecreateResources(); 3707 active_layer_->RecreateResources();
3861 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 3708 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
3862 pending_layer_->ReleaseResources(); 3709 pending_layer_->ReleaseResources();
3863 EXPECT_FALSE(pending_layer_->tilings()); 3710 EXPECT_FALSE(pending_layer_->tilings());
3864 pending_layer_->RecreateResources(); 3711 pending_layer_->RecreateResources();
3865 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); 3712 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings());
3866 3713
3867 // This should create new tilings. 3714 // This should create new tilings.
3868 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 3715 SetupDrawPropertiesAndUpdateTiles(pending_layer_,
3869 1.3f, // ideal contents scale 3716 1.3f, // ideal contents scale
3870 2.7f, // device scale 3717 2.7f, // device scale
3871 3.2f, // page scale 3718 3.2f, // page scale
3872 1.f, // maximum animation scale 3719 1.f, // maximum animation scale
3873 0.f, // starting animation scale 3720 0.f, // starting animation scale
3874 false); 3721 false);
3875 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 3722 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
3876 } 3723 }
3877 3724
3878 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { 3725 TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) {
3879 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 3726 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
3880 3727
3881 gfx::Size tile_size(400, 400);
3882 gfx::Size layer_bounds(1000, 2000); 3728 gfx::Size layer_bounds(1000, 2000);
3883
3884 host_impl_.SetViewportSize(gfx::Size(10000, 20000)); 3729 host_impl_.SetViewportSize(gfx::Size(10000, 20000));
3885 3730 SetupDefaultTrees(layer_bounds);
3886 scoped_refptr<FakePicturePileImpl> pending_pile =
3887 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3888 scoped_refptr<FakePicturePileImpl> active_pile =
3889 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3890
3891 SetupTrees(pending_pile, active_pile);
3892 3731
3893 ResetTilingsAndRasterScales(); 3732 ResetTilingsAndRasterScales();
3894 SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.5f, 1.f, 1.f, 1.f, 0.f, 3733 SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.5f, 1.f, 1.f, 1.f, 0.f,
3895 false); 3734 false);
3896 3735
3897 float max_contents_scale = active_layer_->MaximumTilingContentsScale(); 3736 float max_contents_scale = active_layer_->MaximumTilingContentsScale();
3898 EXPECT_EQ(2.5f, max_contents_scale); 3737 EXPECT_EQ(2.5f, max_contents_scale);
3899 3738
3900 gfx::Transform scaled_draw_transform = active_layer_->draw_transform(); 3739 gfx::Transform scaled_draw_transform = active_layer_->draw_transform();
3901 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, 3740 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale,
(...skipping 27 matching lines...) Expand all
3929 3768
3930 void InitializeRenderer() override { 3769 void InitializeRenderer() override {
3931 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDelegating3d()); 3770 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDelegating3d());
3932 } 3771 }
3933 }; 3772 };
3934 3773
3935 TEST_F(PictureLayerImplTestWithDelegatingRenderer, 3774 TEST_F(PictureLayerImplTestWithDelegatingRenderer,
3936 DelegatingRendererWithTileOOM) { 3775 DelegatingRendererWithTileOOM) {
3937 // This test is added for crbug.com/402321, where quad should be produced when 3776 // This test is added for crbug.com/402321, where quad should be produced when
3938 // raster on demand is not allowed and tile is OOM. 3777 // raster on demand is not allowed and tile is OOM.
3939 gfx::Size tile_size = host_impl_.settings().default_tile_size;
3940 gfx::Size layer_bounds(1000, 1000); 3778 gfx::Size layer_bounds(1000, 1000);
3941 3779
3942 // Create tiles. 3780 // Create tiles.
3943 scoped_refptr<FakePicturePileImpl> pending_pile = 3781 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
3944 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3782 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
3945 SetupPendingTree(pending_pile); 3783 SetupPendingTree(pending_raster_source);
3946 pending_layer_->SetBounds(layer_bounds); 3784 pending_layer_->SetBounds(layer_bounds);
3947 ActivateTree(); 3785 ActivateTree();
3948 bool update_lcd_text = false; 3786 bool update_lcd_text = false;
3949 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); 3787 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text);
3950 std::vector<Tile*> tiles = 3788 std::vector<Tile*> tiles =
3951 active_layer_->HighResTiling()->AllTilesForTesting(); 3789 active_layer_->HighResTiling()->AllTilesForTesting();
3952 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); 3790 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
3953 3791
3954 // Force tiles after max_tiles to be OOM. TileManager uses 3792 // Force tiles after max_tiles to be OOM. TileManager uses
3955 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot 3793 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot
3956 // directly set state to host_impl_, so we set policy that would change the 3794 // directly set state to host_impl_, so we set policy that would change the
3957 // state. We also need to update tree priority separately. 3795 // state. We also need to update tree priority separately.
3958 GlobalStateThatImpactsTilePriority state; 3796 GlobalStateThatImpactsTilePriority state;
3959 size_t max_tiles = 1; 3797 size_t max_tiles = 1;
3798 gfx::Size tile_size(host_impl_.settings().default_tile_size);
3960 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); 3799 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height();
3961 size_t resource_limit = max_tiles; 3800 size_t resource_limit = max_tiles;
3962 ManagedMemoryPolicy policy(memory_limit, 3801 ManagedMemoryPolicy policy(memory_limit,
3963 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 3802 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
3964 resource_limit); 3803 resource_limit);
3965 host_impl_.SetMemoryPolicy(policy); 3804 host_impl_.SetMemoryPolicy(policy);
3966 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); 3805 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
3967 host_impl_.PrepareTiles(); 3806 host_impl_.PrepareTiles();
3968 3807
3969 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 3808 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
4039 OccludedTilesSkippedDuringRasterization) { 3878 OccludedTilesSkippedDuringRasterization) {
4040 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 3879 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4041 3880
4042 gfx::Size tile_size(102, 102); 3881 gfx::Size tile_size(102, 102);
4043 gfx::Size layer_bounds(1000, 1000); 3882 gfx::Size layer_bounds(1000, 1000);
4044 gfx::Size viewport_size(500, 500); 3883 gfx::Size viewport_size(500, 500);
4045 gfx::Point occluding_layer_position(310, 0); 3884 gfx::Point occluding_layer_position(310, 0);
4046 3885
4047 host_impl_.SetViewportSize(viewport_size); 3886 host_impl_.SetViewportSize(viewport_size);
4048 3887
4049 scoped_refptr<FakePicturePileImpl> pending_pile = 3888 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4050 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3889 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4051 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 3890 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
4052 3891
4053 // No occlusion. 3892 // No occlusion.
4054 int unoccluded_tile_count = 0; 3893 int unoccluded_tile_count = 0;
4055 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll( 3894 scoped_ptr<TilingSetRasterQueueAll> queue(new TilingSetRasterQueueAll(
4056 pending_layer_->picture_layer_tiling_set(), false)); 3895 pending_layer_->picture_layer_tiling_set(), false));
4057 while (!queue->IsEmpty()) { 3896 while (!queue->IsEmpty()) {
4058 PrioritizedTile prioritized_tile = queue->Top(); 3897 PrioritizedTile prioritized_tile = queue->Top();
4059 Tile* tile = prioritized_tile.tile(); 3898 Tile* tile = prioritized_tile.tile();
4060 3899
4061 // Occluded tiles should not be iterated over. 3900 // Occluded tiles should not be iterated over.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 OccludedTilesNotMarkedAsRequired) { 3967 OccludedTilesNotMarkedAsRequired) {
4129 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 3968 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4130 3969
4131 gfx::Size tile_size(102, 102); 3970 gfx::Size tile_size(102, 102);
4132 gfx::Size layer_bounds(1000, 1000); 3971 gfx::Size layer_bounds(1000, 1000);
4133 gfx::Size viewport_size(500, 500); 3972 gfx::Size viewport_size(500, 500);
4134 gfx::Point occluding_layer_position(310, 0); 3973 gfx::Point occluding_layer_position(310, 0);
4135 3974
4136 host_impl_.SetViewportSize(viewport_size); 3975 host_impl_.SetViewportSize(viewport_size);
4137 3976
4138 scoped_refptr<FakePicturePileImpl> pending_pile = 3977 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4139 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3978 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4140 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 3979 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
4141 3980
4142 // No occlusion. 3981 // No occlusion.
4143 int occluded_tile_count = 0; 3982 int occluded_tile_count = 0;
4144 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { 3983 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
4145 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); 3984 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
4146 auto prioritized_tiles = 3985 auto prioritized_tiles =
4147 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 3986 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
4148 3987
4149 occluded_tile_count = 0; 3988 occluded_tile_count = 0;
4150 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, 3989 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
4243 } 4082 }
4244 4083
4245 TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { 4084 TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) {
4246 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4085 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4247 4086
4248 gfx::Size tile_size(102, 102); 4087 gfx::Size tile_size(102, 102);
4249 gfx::Size layer_bounds(1000, 1000); 4088 gfx::Size layer_bounds(1000, 1000);
4250 gfx::Size viewport_size(500, 500); 4089 gfx::Size viewport_size(500, 500);
4251 gfx::Point occluding_layer_position(310, 0); 4090 gfx::Point occluding_layer_position(310, 0);
4252 4091
4253 scoped_refptr<FakePicturePileImpl> pending_pile = 4092 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4254 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4093 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4255 4094
4256 host_impl_.SetViewportSize(viewport_size); 4095 host_impl_.SetViewportSize(viewport_size);
4257 4096
4258 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 4097 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
4259 ASSERT_TRUE(pending_layer_->CanHaveTilings()); 4098 ASSERT_TRUE(pending_layer_->CanHaveTilings());
4260 4099
4261 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); 4100 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1));
4262 LayerImpl* layer1 = pending_layer_->children()[0]; 4101 LayerImpl* layer1 = pending_layer_->children()[0];
4263 layer1->SetBounds(layer_bounds); 4102 layer1->SetBounds(layer_bounds);
4264 layer1->SetDrawsContent(true); 4103 layer1->SetDrawsContent(true);
4265 layer1->SetContentsOpaque(true); 4104 layer1->SetContentsOpaque(true);
4266 layer1->SetPosition(occluding_layer_position); 4105 layer1->SetPosition(occluding_layer_position);
4267 4106
4268 pending_layer_->tilings()->RemoveAllTilings(); 4107 pending_layer_->tilings()->RemoveAllTilings();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4311 case 3: 4150 case 3:
4312 EXPECT_EQ(occluded_tile_count, 2); 4151 EXPECT_EQ(occluded_tile_count, 2);
4313 break; 4152 break;
4314 default: 4153 default:
4315 NOTREACHED(); 4154 NOTREACHED();
4316 } 4155 }
4317 } 4156 }
4318 } 4157 }
4319 4158
4320 TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) { 4159 TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
4321 gfx::Size tile_size(102, 102);
4322 gfx::Size layer_bounds(1000, 1000); 4160 gfx::Size layer_bounds(1000, 1000);
4323 gfx::Size viewport_size(1000, 1000); 4161 gfx::Size viewport_size(1000, 1000);
4324 gfx::Point occluding_layer_position(310, 0); 4162 gfx::Point occluding_layer_position(310, 0);
4325 gfx::Rect invalidation_rect(230, 230, 102, 102); 4163 gfx::Rect invalidation_rect(230, 230, 102, 102);
4326 4164
4327 scoped_refptr<FakePicturePileImpl> pending_pile = 4165 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4328 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4166 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4329 scoped_refptr<FakePicturePileImpl> active_pile = 4167 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
4330 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4168 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4331 4169
4332 host_impl_.SetViewportSize(viewport_size); 4170 host_impl_.SetViewportSize(viewport_size);
4333 SetupPendingTree(active_pile); 4171 SetupPendingTree(active_raster_source);
4334 4172
4335 // Partially occlude the active layer. 4173 // Partially occlude the active layer.
4336 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2)); 4174 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2));
4337 LayerImpl* layer1 = pending_layer_->children()[0]; 4175 LayerImpl* layer1 = pending_layer_->children()[0];
4338 layer1->SetBounds(layer_bounds); 4176 layer1->SetBounds(layer_bounds);
4339 layer1->SetDrawsContent(true); 4177 layer1->SetDrawsContent(true);
4340 layer1->SetContentsOpaque(true); 4178 layer1->SetContentsOpaque(true);
4341 layer1->SetPosition(occluding_layer_position); 4179 layer1->SetPosition(occluding_layer_position);
4342 4180
4343 ActivateTree(); 4181 ActivateTree();
(...skipping 13 matching lines...) Expand all
4357 gfx::Rect scaled_content_rect = ScaleToEnclosingRect( 4195 gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
4358 tile->content_rect(), 1.0f / tile->contents_scale()); 4196 tile->content_rect(), 1.0f / tile->contents_scale());
4359 // Tiles are occluded on the active tree iff they lie beneath the 4197 // Tiles are occluded on the active tree iff they lie beneath the
4360 // occluding layer. 4198 // occluding layer.
4361 EXPECT_EQ(prioritized_tiles[tile].is_occluded(), 4199 EXPECT_EQ(prioritized_tiles[tile].is_occluded(),
4362 scaled_content_rect.x() >= occluding_layer_position.x()); 4200 scaled_content_rect.x() >= occluding_layer_position.x());
4363 } 4201 }
4364 } 4202 }
4365 4203
4366 // Partially invalidate the pending layer. 4204 // Partially invalidate the pending layer.
4367 SetupPendingTreeWithInvalidation(pending_pile, invalidation_rect); 4205 SetupPendingTreeWithInvalidation(pending_raster_source, invalidation_rect);
4368 4206
4369 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { 4207 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) {
4370 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); 4208 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i);
4371 auto prioritized_tiles = 4209 auto prioritized_tiles =
4372 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 4210 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
4373 4211
4374 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, 4212 for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f,
4375 gfx::Rect(layer_bounds)); 4213 gfx::Rect(layer_bounds));
4376 iter; ++iter) { 4214 iter; ++iter) {
4377 if (!*iter) 4215 if (!*iter)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 gfx::Size tile_size(102, 102); 4249 gfx::Size tile_size(102, 102);
4412 gfx::Size layer_bounds(1000, 1000); 4250 gfx::Size layer_bounds(1000, 1000);
4413 gfx::Size viewport_size(1000, 1000); 4251 gfx::Size viewport_size(1000, 1000);
4414 gfx::Point pending_occluding_layer_position(310, 0); 4252 gfx::Point pending_occluding_layer_position(310, 0);
4415 gfx::Point active_occluding_layer_position(0, 310); 4253 gfx::Point active_occluding_layer_position(0, 310);
4416 gfx::Rect invalidation_rect(230, 230, 152, 152); 4254 gfx::Rect invalidation_rect(230, 230, 152, 152);
4417 4255
4418 host_impl_.SetViewportSize(viewport_size); 4256 host_impl_.SetViewportSize(viewport_size);
4419 host_impl_.SetDeviceScaleFactor(2.f); 4257 host_impl_.SetDeviceScaleFactor(2.f);
4420 4258
4421 scoped_refptr<FakePicturePileImpl> pending_pile = 4259 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4422 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4260 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4423 scoped_refptr<FakePicturePileImpl> active_pile = 4261 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
4424 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4262 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4425 4263
4426 SetupPendingTreeWithFixedTileSize(active_pile, tile_size, Region()); 4264 SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region());
4427 4265
4428 // Partially occlude the active layer. 4266 // Partially occlude the active layer.
4429 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2)); 4267 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2));
4430 LayerImpl* active_occluding_layer = pending_layer_->children()[0]; 4268 LayerImpl* active_occluding_layer = pending_layer_->children()[0];
4431 active_occluding_layer->SetBounds(layer_bounds); 4269 active_occluding_layer->SetBounds(layer_bounds);
4432 active_occluding_layer->SetDrawsContent(true); 4270 active_occluding_layer->SetDrawsContent(true);
4433 active_occluding_layer->SetContentsOpaque(true); 4271 active_occluding_layer->SetContentsOpaque(true);
4434 active_occluding_layer->SetPosition(active_occluding_layer_position); 4272 active_occluding_layer->SetPosition(active_occluding_layer_position);
4435 4273
4436 ActivateTree(); 4274 ActivateTree();
4437 4275
4438 // Partially invalidate the pending layer. Tiles inside the invalidation rect 4276 // Partially invalidate the pending layer. Tiles inside the invalidation rect
4439 // are created. 4277 // are created.
4440 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, invalidation_rect); 4278 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size,
4279 invalidation_rect);
4441 4280
4442 // Partially occlude the pending layer in a different way. 4281 // Partially occlude the pending layer in a different way.
4443 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 3)); 4282 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 3));
4444 LayerImpl* pending_occluding_layer = pending_layer_->children()[0]; 4283 LayerImpl* pending_occluding_layer = pending_layer_->children()[0];
4445 pending_occluding_layer->SetBounds(layer_bounds); 4284 pending_occluding_layer->SetBounds(layer_bounds);
4446 pending_occluding_layer->SetDrawsContent(true); 4285 pending_occluding_layer->SetDrawsContent(true);
4447 pending_occluding_layer->SetContentsOpaque(true); 4286 pending_occluding_layer->SetContentsOpaque(true);
4448 pending_occluding_layer->SetPosition(pending_occluding_layer_position); 4287 pending_occluding_layer->SetPosition(pending_occluding_layer_position);
4449 4288
4450 EXPECT_EQ(1u, pending_layer_->num_tilings()); 4289 EXPECT_EQ(1u, pending_layer_->num_tilings());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
4546 VerifyEvictionConsidersOcclusion( 4385 VerifyEvictionConsidersOcclusion(
4547 active_layer_, ACTIVE_TREE, 4386 active_layer_, ACTIVE_TREE,
4548 total_expected_occluded_tile_count_on_trees[ACTIVE_TREE], __LINE__); 4387 total_expected_occluded_tile_count_on_trees[ACTIVE_TREE], __LINE__);
4549 VerifyEvictionConsidersOcclusion( 4388 VerifyEvictionConsidersOcclusion(
4550 pending_layer_, PENDING_TREE, 4389 pending_layer_, PENDING_TREE,
4551 total_expected_occluded_tile_count_on_trees[PENDING_TREE], __LINE__); 4390 total_expected_occluded_tile_count_on_trees[PENDING_TREE], __LINE__);
4552 pending_layer_->set_has_valid_tile_priorities(true); 4391 pending_layer_->set_has_valid_tile_priorities(true);
4553 } 4392 }
4554 4393
4555 TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) { 4394 TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) {
4556 gfx::Size tile_size(102, 102);
4557 gfx::Size layer_bounds(1000, 1000); 4395 gfx::Size layer_bounds(1000, 1000);
4558 4396
4559 scoped_refptr<FakePicturePileImpl> pile = 4397 scoped_refptr<FakeDisplayListRasterSource> raster_source =
4560 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4398 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4561 SetupPendingTree(pile); 4399 SetupPendingTree(raster_source);
4562 EXPECT_FALSE(pending_layer_->GetPendingOrActiveTwinLayer()); 4400 EXPECT_FALSE(pending_layer_->GetPendingOrActiveTwinLayer());
4563 4401
4564 ActivateTree(); 4402 ActivateTree();
4565 EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer()); 4403 EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
4566 4404
4567 SetupPendingTree(pile); 4405 SetupPendingTree(raster_source);
4568 EXPECT_TRUE(pending_layer_->GetPendingOrActiveTwinLayer()); 4406 EXPECT_TRUE(pending_layer_->GetPendingOrActiveTwinLayer());
4569 EXPECT_TRUE(active_layer_->GetPendingOrActiveTwinLayer()); 4407 EXPECT_TRUE(active_layer_->GetPendingOrActiveTwinLayer());
4570 EXPECT_EQ(pending_layer_, active_layer_->GetPendingOrActiveTwinLayer()); 4408 EXPECT_EQ(pending_layer_, active_layer_->GetPendingOrActiveTwinLayer());
4571 EXPECT_EQ(active_layer_, pending_layer_->GetPendingOrActiveTwinLayer()); 4409 EXPECT_EQ(active_layer_, pending_layer_->GetPendingOrActiveTwinLayer());
4572 4410
4573 ActivateTree(); 4411 ActivateTree();
4574 EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer()); 4412 EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
4575 4413
4576 // Make an empty pending tree. 4414 // Make an empty pending tree.
4577 host_impl_.CreatePendingTree(); 4415 host_impl_.CreatePendingTree();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
4694 ActivateTree(); 4532 ActivateTree();
4695 4533
4696 // We've switched to a solid color, so we should end up with no tilings. 4534 // We've switched to a solid color, so we should end up with no tilings.
4697 ASSERT_TRUE(active_layer_->tilings()); 4535 ASSERT_TRUE(active_layer_->tilings());
4698 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 4536 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
4699 } 4537 }
4700 4538
4701 TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) { 4539 TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) {
4702 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4540 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4703 4541
4704 gfx::Size tile_size(100, 100);
4705 gfx::Size layer_bounds(400, 4000); 4542 gfx::Size layer_bounds(400, 4000);
4706 4543 SetupDefaultTrees(layer_bounds);
4707 scoped_refptr<FakePicturePileImpl> pending_pile =
4708 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4709 scoped_refptr<FakePicturePileImpl> active_pile =
4710 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4711
4712 SetupTrees(pending_pile, active_pile);
4713 4544
4714 Region invalidation; 4545 Region invalidation;
4715 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100); 4546 gfx::Rect viewport = gfx::Rect(0, 0, 100, 100);
4716 gfx::Transform transform; 4547 gfx::Transform transform;
4717 4548
4718 host_impl_.SetRequiresHighResToDraw(); 4549 host_impl_.SetRequiresHighResToDraw();
4719 4550
4720 // Update tiles. 4551 // Update tiles.
4721 pending_layer_->draw_properties().visible_layer_rect = viewport; 4552 pending_layer_->draw_properties().visible_layer_rect = viewport;
4722 pending_layer_->draw_properties().screen_space_transform = transform; 4553 pending_layer_->draw_properties().screen_space_transform = transform;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4760 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); 4591 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
4761 4592
4762 // Ensure we can activate. 4593 // Ensure we can activate.
4763 EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate()); 4594 EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
4764 } 4595 }
4765 4596
4766 TEST_F(PictureLayerImplTest, CloneMissingRecordings) { 4597 TEST_F(PictureLayerImplTest, CloneMissingRecordings) {
4767 gfx::Size tile_size(100, 100); 4598 gfx::Size tile_size(100, 100);
4768 gfx::Size layer_bounds(400, 400); 4599 gfx::Size layer_bounds(400, 400);
4769 4600
4770 scoped_refptr<FakePicturePileImpl> filled_pile = 4601 scoped_refptr<FakeDisplayListRasterSource> filled_raster_source =
4771 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4602 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4772 4603
4773 scoped_ptr<FakePicturePile> partial_recording = 4604 scoped_refptr<FakeDisplayListRasterSource> partial_raster_source =
4774 FakePicturePile::CreateEmptyPile(tile_size, layer_bounds); 4605 FakeDisplayListRasterSource::CreatePartiallyFilled(
4775 for (int i = 1; i < partial_recording->tiling().num_tiles_x(); ++i) { 4606 layer_bounds, gfx::Rect(100, 100, 300, 300));
4776 for (int j = 1; j < partial_recording->tiling().num_tiles_y(); ++j)
4777 partial_recording->AddRecordingAt(i, j);
4778 }
4779 scoped_refptr<FakePicturePileImpl> partial_pile =
4780 FakePicturePileImpl::CreateFromPile(partial_recording.get(), nullptr);
4781 4607
4782 SetupPendingTreeWithFixedTileSize(filled_pile, tile_size, Region()); 4608 SetupPendingTreeWithFixedTileSize(filled_raster_source, tile_size, Region());
4783 ActivateTree(); 4609 ActivateTree();
4784 4610
4785 PictureLayerTiling* pending_tiling = old_pending_layer_->HighResTiling(); 4611 PictureLayerTiling* pending_tiling = old_pending_layer_->HighResTiling();
4786 PictureLayerTiling* active_tiling = active_layer_->HighResTiling(); 4612 PictureLayerTiling* active_tiling = active_layer_->HighResTiling();
4787 4613
4788 // We should have all tiles on active, and none on pending. 4614 // We should have all tiles on active, and none on pending.
4789 EXPECT_EQ(0u, pending_tiling->AllTilesForTesting().size()); 4615 EXPECT_EQ(0u, pending_tiling->AllTilesForTesting().size());
4790 EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size()); 4616 EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
4791 4617
4792 // Now put a partially-recorded pile on the pending tree (and invalidate 4618 // Now put a partially-recorded raster source on the pending tree (and
4793 // everything, since the main thread PicturePile will invalidate dropped 4619 // invalidate everything, since the main thread recording will invalidate
4794 // recordings). This will cause us to be missing some tiles. 4620 // dropped recordings). This will cause us to be missing some tiles.
4795 SetupPendingTreeWithFixedTileSize(partial_pile, tile_size, 4621 SetupPendingTreeWithFixedTileSize(partial_raster_source, tile_size,
4796 Region(gfx::Rect(layer_bounds))); 4622 Region(gfx::Rect(layer_bounds)));
4797 EXPECT_EQ(3u * 3u, pending_tiling->AllTilesForTesting().size()); 4623 EXPECT_EQ(3u * 3u, pending_tiling->AllTilesForTesting().size());
4798 EXPECT_FALSE(pending_tiling->TileAt(0, 0)); 4624 EXPECT_FALSE(pending_tiling->TileAt(0, 0));
4799 EXPECT_FALSE(pending_tiling->TileAt(1, 1)); 4625 EXPECT_FALSE(pending_tiling->TileAt(1, 1));
4800 EXPECT_TRUE(pending_tiling->TileAt(2, 2)); 4626 EXPECT_TRUE(pending_tiling->TileAt(2, 2));
4801 4627
4802 // Active is not affected yet. 4628 // Active is not affected yet.
4803 EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size()); 4629 EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
4804 4630
4805 // Activate the tree. The same tiles go missing on the active tree. 4631 // Activate the tree. The same tiles go missing on the active tree.
4806 ActivateTree(); 4632 ActivateTree();
4807 EXPECT_EQ(3u * 3u, active_tiling->AllTilesForTesting().size()); 4633 EXPECT_EQ(3u * 3u, active_tiling->AllTilesForTesting().size());
4808 EXPECT_FALSE(active_tiling->TileAt(0, 0)); 4634 EXPECT_FALSE(active_tiling->TileAt(0, 0));
4809 EXPECT_FALSE(active_tiling->TileAt(1, 1)); 4635 EXPECT_FALSE(active_tiling->TileAt(1, 1));
4810 EXPECT_TRUE(active_tiling->TileAt(2, 2)); 4636 EXPECT_TRUE(active_tiling->TileAt(2, 2));
4811 4637
4812 // Now put a full recording on the pending tree again. We'll get all our tiles 4638 // Now put a full recording on the pending tree again. We'll get all our tiles
4813 // back. 4639 // back.
4814 SetupPendingTreeWithFixedTileSize(filled_pile, tile_size, 4640 SetupPendingTreeWithFixedTileSize(filled_raster_source, tile_size,
4815 Region(gfx::Rect(layer_bounds))); 4641 Region(gfx::Rect(layer_bounds)));
4816 EXPECT_EQ(5u * 5u, pending_tiling->AllTilesForTesting().size()); 4642 EXPECT_EQ(5u * 5u, pending_tiling->AllTilesForTesting().size());
4817 Tile* tile00 = pending_tiling->TileAt(0, 0); 4643 Tile* tile00 = pending_tiling->TileAt(0, 0);
4818 Tile* tile11 = pending_tiling->TileAt(1, 1); 4644 Tile* tile11 = pending_tiling->TileAt(1, 1);
4819 Tile* tile22 = pending_tiling->TileAt(2, 2); 4645 Tile* tile22 = pending_tiling->TileAt(2, 2);
4820 4646
4821 // Active is not affected yet. 4647 // Active is not affected yet.
4822 EXPECT_EQ(3u * 3u, active_tiling->AllTilesForTesting().size()); 4648 EXPECT_EQ(3u * 3u, active_tiling->AllTilesForTesting().size());
4823 4649
4824 // Activate the tree. The tiles are moved to the active tree. 4650 // Activate the tree. The tiles are moved to the active tree.
4825 ActivateTree(); 4651 ActivateTree();
4826 EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size()); 4652 EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
4827 EXPECT_EQ(tile00, active_tiling->TileAt(0, 0)); 4653 EXPECT_EQ(tile00, active_tiling->TileAt(0, 0));
4828 EXPECT_EQ(tile11, active_tiling->TileAt(1, 1)); 4654 EXPECT_EQ(tile11, active_tiling->TileAt(1, 1));
4829 EXPECT_EQ(tile22, active_tiling->TileAt(2, 2)); 4655 EXPECT_EQ(tile22, active_tiling->TileAt(2, 2));
4830 } 4656 }
4831 4657
4832 TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) { 4658 TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) {
4833 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4659 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4834 4660
4835 gfx::Size tile_size(102, 102); 4661 gfx::Size tile_size(102, 102);
4836 gfx::Size layer_bounds(100, 100); 4662 gfx::Size layer_bounds(100, 100);
4837 gfx::Size viewport_size(100, 100); 4663 gfx::Size viewport_size(100, 100);
4838 4664
4839 host_impl_.SetViewportSize(viewport_size); 4665 host_impl_.SetViewportSize(viewport_size);
4840 host_impl_.SetDeviceScaleFactor(1.f); 4666 host_impl_.SetDeviceScaleFactor(1.f);
4841 4667
4842 scoped_refptr<FakePicturePileImpl> pending_pile = 4668 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4843 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4669 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4844 scoped_refptr<FakePicturePileImpl> active_pile = 4670 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
4845 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4671 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4846 4672
4847 SetupPendingTreeWithFixedTileSize(active_pile, tile_size, Region()); 4673 SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region());
4848 4674
4849 ActivateTree(); 4675 ActivateTree();
4850 EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles()); 4676 EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles());
4851 4677
4852 host_impl_.SetExternalDrawConstraints( 4678 host_impl_.SetExternalDrawConstraints(
4853 gfx::Transform(), // transform 4679 gfx::Transform(), // transform
4854 gfx::Rect(), // clip 4680 gfx::Rect(), // clip
4855 gfx::Rect(), // viewport 4681 gfx::Rect(), // viewport
4856 gfx::Rect(0, 5000, 100, 100), // viewport_rect_for_tile_priority 4682 gfx::Rect(0, 5000, 100, 100), // viewport_rect_for_tile_priority
4857 gfx::Transform(), // transform_for_tile_priority 4683 gfx::Transform(), // transform_for_tile_priority
4858 false); 4684 false);
4859 4685
4860 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, gfx::Rect()); 4686 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size,
4687 gfx::Rect());
4861 4688
4862 EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles()); 4689 EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles());
4863 EXPECT_TRUE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty()); 4690 EXPECT_TRUE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
4864 ActivateTree(); 4691 ActivateTree();
4865 EXPECT_FALSE(active_layer_->HighResTiling()->has_tiles()); 4692 EXPECT_FALSE(active_layer_->HighResTiling()->has_tiles());
4866 EXPECT_TRUE(active_layer_->HighResTiling()->live_tiles_rect().IsEmpty()); 4693 EXPECT_TRUE(active_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
4867 4694
4868 host_impl_.SetExternalDrawConstraints( 4695 host_impl_.SetExternalDrawConstraints(
4869 gfx::Transform(), // transform 4696 gfx::Transform(), // transform
4870 gfx::Rect(), // clip 4697 gfx::Rect(), // clip
4871 gfx::Rect(), // viewport 4698 gfx::Rect(), // viewport
4872 gfx::Rect(0, 110, 100, 100), // viewport_rect_for_tile_priority 4699 gfx::Rect(0, 110, 100, 100), // viewport_rect_for_tile_priority
4873 gfx::Transform(), // transform_for_tile_priority 4700 gfx::Transform(), // transform_for_tile_priority
4874 false); 4701 false);
4875 4702
4876 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, gfx::Rect()); 4703 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size,
4704 gfx::Rect());
4877 4705
4878 EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles()); 4706 EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles());
4879 EXPECT_FALSE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty()); 4707 EXPECT_FALSE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
4880 ActivateTree(); 4708 ActivateTree();
4881 EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles()); 4709 EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles());
4882 EXPECT_FALSE(active_layer_->HighResTiling()->live_tiles_rect().IsEmpty()); 4710 EXPECT_FALSE(active_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
4883 } 4711 }
4884 4712
4885 TEST_F(PictureLayerImplTest, ScrollPropagatesToPending) { 4713 TEST_F(PictureLayerImplTest, ScrollPropagatesToPending) {
4886 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4714 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4887 4715
4888 gfx::Size tile_size(102, 102);
4889 gfx::Size layer_bounds(1000, 1000); 4716 gfx::Size layer_bounds(1000, 1000);
4890 gfx::Size viewport_size(100, 100); 4717 gfx::Size viewport_size(100, 100);
4891 4718
4892 host_impl_.SetViewportSize(viewport_size); 4719 host_impl_.SetViewportSize(viewport_size);
4893 host_impl_.SetDeviceScaleFactor(1.f); 4720 host_impl_.SetDeviceScaleFactor(1.f);
4894 4721
4895 scoped_refptr<FakePicturePileImpl> pending_pile = 4722 SetupDefaultTrees(layer_bounds);
4896 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4897 scoped_refptr<FakePicturePileImpl> active_pile =
4898 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4899
4900 SetupTrees(pending_pile, active_pile);
4901 4723
4902 active_layer_->SetCurrentScrollOffset(gfx::ScrollOffset(0.0, 50.0)); 4724 active_layer_->SetCurrentScrollOffset(gfx::ScrollOffset(0.0, 50.0));
4903 host_impl_.active_tree()->UpdateDrawProperties(false); 4725 host_impl_.active_tree()->UpdateDrawProperties(false);
4904 EXPECT_EQ("0,50 100x100", active_layer_->HighResTiling() 4726 EXPECT_EQ("0,50 100x100", active_layer_->HighResTiling()
4905 ->GetCurrentVisibleRectForTesting() 4727 ->GetCurrentVisibleRectForTesting()
4906 .ToString()); 4728 .ToString());
4907 4729
4908 EXPECT_EQ("0,0 100x100", pending_layer_->HighResTiling() 4730 EXPECT_EQ("0,0 100x100", pending_layer_->HighResTiling()
4909 ->GetCurrentVisibleRectForTesting() 4731 ->GetCurrentVisibleRectForTesting()
4910 .ToString()); 4732 .ToString());
4911 host_impl_.pending_tree()->UpdateDrawProperties(false); 4733 host_impl_.pending_tree()->UpdateDrawProperties(false);
4912 EXPECT_EQ("0,50 100x100", pending_layer_->HighResTiling() 4734 EXPECT_EQ("0,50 100x100", pending_layer_->HighResTiling()
4913 ->GetCurrentVisibleRectForTesting() 4735 ->GetCurrentVisibleRectForTesting()
4914 .ToString()); 4736 .ToString());
4915 } 4737 }
4916 4738
4917 TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) { 4739 TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) {
4918 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 4740 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
4919 4741
4920 gfx::Size tile_size(102, 102); 4742 gfx::Size tile_size(102, 102);
4921 gfx::Size layer_bounds(100, 100); 4743 gfx::Size layer_bounds(100, 100);
4922 gfx::Size viewport_size(100, 100); 4744 gfx::Size viewport_size(100, 100);
4923 4745
4924 host_impl_.SetViewportSize(viewport_size); 4746 host_impl_.SetViewportSize(viewport_size);
4925 host_impl_.SetDeviceScaleFactor(1.f); 4747 host_impl_.SetDeviceScaleFactor(1.f);
4926 4748
4927 scoped_refptr<FakePicturePileImpl> pending_pile = 4749 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4928 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4750 FakeDisplayListRasterSource::CreateFilledLCD(layer_bounds);
4929 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); 4751 SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
4930 4752
4931 EXPECT_TRUE(pending_layer_->RasterSourceUsesLCDText()); 4753 EXPECT_TRUE(pending_layer_->RasterSourceUsesLCDText());
4932 EXPECT_TRUE(pending_layer_->HighResTiling()->has_tiles()); 4754 EXPECT_TRUE(pending_layer_->HighResTiling()->has_tiles());
4933 std::vector<Tile*> tiles = 4755 std::vector<Tile*> tiles =
4934 pending_layer_->HighResTiling()->AllTilesForTesting(); 4756 pending_layer_->HighResTiling()->AllTilesForTesting();
4935 auto prioritized_tiles = pending_layer_->HighResTiling() 4757 auto prioritized_tiles = pending_layer_->HighResTiling()
4936 ->UpdateAndGetAllPrioritizedTilesForTesting(); 4758 ->UpdateAndGetAllPrioritizedTilesForTesting();
4937 4759
4938 for (Tile* tile : tiles) 4760 for (Tile* tile : tiles)
4939 EXPECT_EQ(pending_layer_->raster_source(), 4761 EXPECT_EQ(pending_layer_->raster_source(),
4940 prioritized_tiles[tile].raster_source()); 4762 prioritized_tiles[tile].raster_source());
4941 4763
4942 pending_layer_->draw_properties().can_use_lcd_text = false; 4764 pending_layer_->draw_properties().can_use_lcd_text = false;
4943 pending_layer_->UpdateCanUseLCDTextAfterCommit(); 4765 pending_layer_->UpdateCanUseLCDTextAfterCommit();
4944 4766
4945 EXPECT_FALSE(pending_layer_->RasterSourceUsesLCDText()); 4767 EXPECT_FALSE(pending_layer_->RasterSourceUsesLCDText());
4946 EXPECT_NE(pending_pile.get(), pending_layer_->raster_source()); 4768 EXPECT_NE(pending_raster_source.get(), pending_layer_->raster_source());
4947 EXPECT_TRUE(pending_layer_->HighResTiling()->has_tiles()); 4769 EXPECT_TRUE(pending_layer_->HighResTiling()->has_tiles());
4948 tiles = pending_layer_->HighResTiling()->AllTilesForTesting(); 4770 tiles = pending_layer_->HighResTiling()->AllTilesForTesting();
4949 prioritized_tiles = pending_layer_->HighResTiling() 4771 prioritized_tiles = pending_layer_->HighResTiling()
4950 ->UpdateAndGetAllPrioritizedTilesForTesting(); 4772 ->UpdateAndGetAllPrioritizedTilesForTesting();
4951 for (Tile* tile : tiles) 4773 for (Tile* tile : tiles)
4952 EXPECT_EQ(pending_layer_->raster_source(), 4774 EXPECT_EQ(pending_layer_->raster_source(),
4953 prioritized_tiles[tile].raster_source()); 4775 prioritized_tiles[tile].raster_source());
4954 } 4776 }
4955 4777
4956 TEST_F(PictureLayerImplTest, TilingAllTilesDone) { 4778 TEST_F(PictureLayerImplTest, TilingAllTilesDone) {
4957 gfx::Size tile_size = host_impl_.settings().default_tile_size; 4779 gfx::Size tile_size = host_impl_.settings().default_tile_size;
4958 size_t tile_mem = 4 * tile_size.width() * tile_size.height(); 4780 size_t tile_mem = 4 * tile_size.width() * tile_size.height();
4959 gfx::Size layer_bounds(1000, 1000); 4781 gfx::Size layer_bounds(1000, 1000);
4960 4782
4961 // Create tiles. 4783 // Create tiles.
4962 scoped_refptr<FakePicturePileImpl> pending_pile = 4784 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
4963 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 4785 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
4964 SetupPendingTree(pending_pile); 4786 SetupPendingTree(pending_raster_source);
4965 pending_layer_->SetBounds(layer_bounds); 4787 pending_layer_->SetBounds(layer_bounds);
4966 ActivateTree(); 4788 ActivateTree();
4967 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 4789 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
4968 active_layer_->HighResTiling()->AllTilesForTesting()); 4790 active_layer_->HighResTiling()->AllTilesForTesting());
4969 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); 4791 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
4970 4792
4971 EXPECT_FALSE(active_layer_->HighResTiling()->all_tiles_done()); 4793 EXPECT_FALSE(active_layer_->HighResTiling()->all_tiles_done());
4972 4794
4973 { 4795 {
4974 // Set a memory policy that will fit all tiles. 4796 // Set a memory policy that will fit all tiles.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
5063 // 50% of viewport in height. 4885 // 50% of viewport in height.
5064 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4886 result = layer->CalculateTileSize(gfx::Size(447, 400));
5065 EXPECT_EQ(result.width(), 448); 4887 EXPECT_EQ(result.width(), 448);
5066 EXPECT_EQ(result.height(), 448); 4888 EXPECT_EQ(result.height(), 448);
5067 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4889 result = layer->CalculateTileSize(gfx::Size(500, 499));
5068 EXPECT_EQ(result.width(), 512); 4890 EXPECT_EQ(result.width(), 512);
5069 EXPECT_EQ(result.height(), 500 + 2); 4891 EXPECT_EQ(result.height(), 500 + 2);
5070 } 4892 }
5071 4893
5072 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { 4894 TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) {
5073 gfx::Size tile_size(400, 400);
5074 gfx::Size layer_bounds(1300, 1900); 4895 gfx::Size layer_bounds(1300, 1900);
5075 4896
5076 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 4897 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
5077 4898 SetupDefaultTrees(layer_bounds);
5078 scoped_refptr<FakePicturePileImpl> pending_pile =
5079 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
5080 scoped_refptr<FakePicturePileImpl> active_pile =
5081 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
5082
5083 // Set up the high and low res tilings before pinch zoom.
5084 SetupTrees(pending_pile, active_pile);
5085 ResetTilingsAndRasterScales(); 4899 ResetTilingsAndRasterScales();
5086 4900
5087 float page_scale = 2.f; 4901 float page_scale = 2.f;
5088 SetContentsScaleOnBothLayers(page_scale, 1.0f, page_scale, 1.0f, 0.f, false); 4902 SetContentsScaleOnBothLayers(page_scale, 1.0f, page_scale, 1.0f, 0.f, false);
5089 EXPECT_BOTH_EQ(num_tilings(), 1u); 4903 EXPECT_BOTH_EQ(num_tilings(), 1u);
5090 EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), page_scale); 4904 EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), page_scale);
5091 4905
5092 host_impl_.PinchGestureBegin(); 4906 host_impl_.PinchGestureBegin();
5093 4907
5094 // Zoom out to exactly the low res factor so that the previous high res 4908 // Zoom out to exactly the low res factor so that the previous high res
5095 // would be equal to the current low res (if it were possible to have one). 4909 // would be equal to the current low res (if it were possible to have one).
5096 float zoomed = page_scale / low_res_factor; 4910 float zoomed = page_scale / low_res_factor;
5097 SetContentsScaleOnBothLayers(zoomed, 1.0f, zoomed, 1.0f, 0.f, false); 4911 SetContentsScaleOnBothLayers(zoomed, 1.0f, zoomed, 1.0f, 0.f, false);
5098 EXPECT_EQ(1u, pending_layer_->num_tilings()); 4912 EXPECT_EQ(1u, pending_layer_->num_tilings());
5099 EXPECT_EQ(zoomed, pending_layer_->tilings()->tiling_at(0)->contents_scale()); 4913 EXPECT_EQ(zoomed, pending_layer_->tilings()->tiling_at(0)->contents_scale());
5100 } 4914 }
5101 4915
5102 TEST_F(PictureLayerImplTest, HighResWasLowResCollision) { 4916 TEST_F(PictureLayerImplTest, HighResWasLowResCollision) {
5103 gfx::Size tile_size(400, 400);
5104 gfx::Size layer_bounds(1300, 1900); 4917 gfx::Size layer_bounds(1300, 1900);
5105 4918
5106 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 4919 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
5107 4920
5108 scoped_refptr<FakePicturePileImpl> pending_pile = 4921 SetupDefaultTrees(layer_bounds);
5109 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
5110 scoped_refptr<FakePicturePileImpl> active_pile =
5111 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
5112
5113 // Set up the high and low res tilings before pinch zoom.
5114 SetupTrees(pending_pile, active_pile);
5115 ResetTilingsAndRasterScales(); 4922 ResetTilingsAndRasterScales();
5116 4923
5117 float page_scale = 4.f; 4924 float page_scale = 4.f;
5118 float low_res = page_scale * low_res_factor; 4925 float low_res = page_scale * low_res_factor;
5119 float extra_low_res = low_res * low_res_factor; 4926 float extra_low_res = low_res * low_res_factor;
5120 SetupDrawPropertiesAndUpdateTiles(active_layer_, page_scale, 1.0f, page_scale, 4927 SetupDrawPropertiesAndUpdateTiles(active_layer_, page_scale, 1.0f, page_scale,
5121 1.0f, 0.f, false); 4928 1.0f, 0.f, false);
5122 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings()); 4929 EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
5123 EXPECT_EQ(page_scale, 4930 EXPECT_EQ(page_scale,
5124 active_layer_->tilings()->tiling_at(0)->contents_scale()); 4931 active_layer_->tilings()->tiling_at(0)->contents_scale());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5163 // New low res tiling. 4970 // New low res tiling.
5164 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); 4971 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles());
5165 4972
5166 // This tiling will be high res now, it won't contain low res content since it 4973 // This tiling will be high res now, it won't contain low res content since it
5167 // was all destroyed. 4974 // was all destroyed.
5168 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); 4975 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles());
5169 } 4976 }
5170 4977
5171 } // namespace 4978 } // namespace
5172 } // namespace cc 4979 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698