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

Side by Side Diff: cc/resources/tile_manager_perftest.cc

Issue 684273003: cc: Fix picture layer impl not to create a tiling with invalid size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a local variable Created 6 years, 1 month 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 | « no previous file | no next file » | 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 "base/time/time.h" 5 #include "base/time/time.h"
6 #include "cc/debug/lap_timer.h" 6 #include "cc/debug/lap_timer.h"
7 #include "cc/resources/raster_buffer.h" 7 #include "cc/resources/raster_buffer.h"
8 #include "cc/resources/tile.h" 8 #include "cc/resources/tile.h"
9 #include "cc/resources/tile_priority.h" 9 #include "cc/resources/tile_priority.h"
10 #include "cc/test/begin_frame_args_test.h" 10 #include "cc/test/begin_frame_args_test.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 state.memory_limit_policy = memory_limit_policy_; 105 state.memory_limit_policy = memory_limit_policy_;
106 state.tree_priority = tree_priority; 106 state.tree_priority = tree_priority;
107 107
108 global_state_ = state; 108 global_state_ = state;
109 host_impl_.resource_pool()->SetResourceUsageLimits( 109 host_impl_.resource_pool()->SetResourceUsageLimits(
110 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); 110 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit);
111 host_impl_.tile_manager()->SetGlobalStateForTesting(state); 111 host_impl_.tile_manager()->SetGlobalStateForTesting(state);
112 } 112 }
113 113
114 virtual void SetUp() override { 114 virtual void SetUp() override {
115 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
116 InitializeRenderer(); 115 InitializeRenderer();
117 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); 116 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
118 } 117 }
119 118
120 virtual void InitializeRenderer() { 119 virtual void InitializeRenderer() {
121 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); 120 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass());
122 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); 121 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer());
123 } 122 }
124 123
125 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 124 void SetupDefaultTrees(const gfx::Size& layer_bounds) {
126 gfx::Size tile_size(100, 100);
127
128 scoped_refptr<FakePicturePileImpl> pending_pile = 125 scoped_refptr<FakePicturePileImpl> pending_pile =
129 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 126 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds);
130 scoped_refptr<FakePicturePileImpl> active_pile = 127 scoped_refptr<FakePicturePileImpl> active_pile =
131 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 128 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds);
132 129
133 SetupTrees(pending_pile, active_pile); 130 SetupTrees(pending_pile, active_pile);
134 } 131 }
135 132
136 void ActivateTree() { 133 void ActivateTree() {
137 host_impl_.ActivateSyncTree(); 134 host_impl_.ActivateSyncTree();
138 CHECK(!host_impl_.pending_tree()); 135 CHECK(!host_impl_.pending_tree());
139 pending_root_layer_ = NULL; 136 pending_root_layer_ = NULL;
140 active_root_layer_ = static_cast<FakePictureLayerImpl*>( 137 active_root_layer_ = static_cast<FakePictureLayerImpl*>(
141 host_impl_.active_tree()->LayerById(id_)); 138 host_impl_.active_tree()->LayerById(id_));
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 active_root_layer_->CreateDefaultTilingsAndTiles(); 350 active_root_layer_->CreateDefaultTilingsAndTiles();
354 pending_root_layer_->CreateDefaultTilingsAndTiles(); 351 pending_root_layer_->CreateDefaultTilingsAndTiles();
355 352
356 std::vector<LayerImpl*> layers; 353 std::vector<LayerImpl*> layers;
357 354
358 // Pending layer counts as one layer. 355 // Pending layer counts as one layer.
359 layers.push_back(pending_root_layer_); 356 layers.push_back(pending_root_layer_);
360 int next_id = id_ + 1; 357 int next_id = id_ + 1;
361 358
362 // Create the rest of the layers as children of the root layer. 359 // Create the rest of the layers as children of the root layer.
360 scoped_refptr<FakePicturePileImpl> pile =
361 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds);
363 while (static_cast<int>(layers.size()) < layer_count) { 362 while (static_cast<int>(layers.size()) < layer_count) {
364 scoped_ptr<FakePictureLayerImpl> layer = 363 scoped_ptr<FakePictureLayerImpl> layer =
365 FakePictureLayerImpl::CreateWithPile( 364 FakePictureLayerImpl::CreateWithPile(host_impl_.pending_tree(),
366 host_impl_.pending_tree(), next_id, picture_pile_); 365 next_id, pile);
367 layer->SetBounds(layer_bounds); 366 layer->SetBounds(layer_bounds);
368 layers.push_back(layer.get()); 367 layers.push_back(layer.get());
369 pending_root_layer_->AddChild(layer.Pass()); 368 pending_root_layer_->AddChild(layer.Pass());
370 369
371 FakePictureLayerImpl* fake_layer = 370 FakePictureLayerImpl* fake_layer =
372 static_cast<FakePictureLayerImpl*>(layers.back()); 371 static_cast<FakePictureLayerImpl*>(layers.back());
373 372
374 fake_layer->SetDrawsContent(true); 373 fake_layer->SetDrawsContent(true);
375 fake_layer->DoPostCommitInitializationIfNeeded(); 374 fake_layer->DoPostCommitInitializationIfNeeded();
376 fake_layer->CreateDefaultTilingsAndTiles(); 375 fake_layer->CreateDefaultTilingsAndTiles();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 424
426 TestSharedBitmapManager shared_bitmap_manager_; 425 TestSharedBitmapManager shared_bitmap_manager_;
427 TileMemoryLimitPolicy memory_limit_policy_; 426 TileMemoryLimitPolicy memory_limit_policy_;
428 int max_tiles_; 427 int max_tiles_;
429 int id_; 428 int id_;
430 FakeImplProxy proxy_; 429 FakeImplProxy proxy_;
431 FakeLayerTreeHostImpl host_impl_; 430 FakeLayerTreeHostImpl host_impl_;
432 FakePictureLayerImpl* pending_root_layer_; 431 FakePictureLayerImpl* pending_root_layer_;
433 FakePictureLayerImpl* active_root_layer_; 432 FakePictureLayerImpl* active_root_layer_;
434 LapTimer timer_; 433 LapTimer timer_;
435 scoped_refptr<FakePicturePileImpl> picture_pile_;
436 LayerTreeSettings settings_; 434 LayerTreeSettings settings_;
435
436 static const gfx::Size kDefaultTileSize;
437 }; 437 };
438 438
439 const gfx::Size TileManagerPerfTest::kDefaultTileSize(100, 100);
440
439 TEST_F(TileManagerPerfTest, ManageTiles) { 441 TEST_F(TileManagerPerfTest, ManageTiles) {
440 RunManageTilesTest("2_100", 2, 100); 442 RunManageTilesTest("2_100", 2, 100);
441 RunManageTilesTest("2_500", 2, 500); 443 RunManageTilesTest("2_500", 2, 500);
442 RunManageTilesTest("2_1000", 2, 1000); 444 RunManageTilesTest("2_1000", 2, 1000);
443 RunManageTilesTest("10_100", 10, 100); 445 RunManageTilesTest("10_100", 10, 100);
444 RunManageTilesTest("10_500", 10, 500); 446 RunManageTilesTest("10_500", 10, 500);
445 RunManageTilesTest("10_1000", 10, 1000); 447 RunManageTilesTest("10_1000", 10, 1000);
446 RunManageTilesTest("50_100", 100, 100); 448 RunManageTilesTest("50_100", 100, 100);
447 RunManageTilesTest("50_500", 100, 500); 449 RunManageTilesTest("50_500", 100, 500);
448 RunManageTilesTest("50_1000", 100, 1000); 450 RunManageTilesTest("50_1000", 100, 1000);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); 488 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128);
487 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); 489 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16);
488 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); 490 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32);
489 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); 491 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64);
490 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); 492 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128);
491 } 493 }
492 494
493 } // namespace 495 } // namespace
494 496
495 } // namespace cc 497 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698