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

Side by Side Diff: cc/tiles/tile_manager_perftest.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/tiles/picture_layer_tiling_unittest.cc ('k') | cc/tiles/tile_manager_unittest.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 "base/lazy_instance.h"
5 #include "base/location.h" 6 #include "base/location.h"
6 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
7 #include "base/time/time.h" 8 #include "base/time/time.h"
8 #include "cc/debug/lap_timer.h" 9 #include "cc/debug/lap_timer.h"
9 #include "cc/raster/raster_buffer.h" 10 #include "cc/raster/raster_buffer.h"
10 #include "cc/test/begin_frame_args_test.h" 11 #include "cc/test/begin_frame_args_test.h"
12 #include "cc/test/fake_display_list_raster_source.h"
11 #include "cc/test/fake_impl_proxy.h" 13 #include "cc/test/fake_impl_proxy.h"
12 #include "cc/test/fake_layer_tree_host_impl.h" 14 #include "cc/test/fake_layer_tree_host_impl.h"
13 #include "cc/test/fake_output_surface.h" 15 #include "cc/test/fake_output_surface.h"
14 #include "cc/test/fake_output_surface_client.h" 16 #include "cc/test/fake_output_surface_client.h"
15 #include "cc/test/fake_picture_layer_impl.h" 17 #include "cc/test/fake_picture_layer_impl.h"
16 #include "cc/test/fake_picture_pile_impl.h"
17 #include "cc/test/fake_tile_manager.h" 18 #include "cc/test/fake_tile_manager.h"
18 #include "cc/test/fake_tile_manager_client.h" 19 #include "cc/test/fake_tile_manager_client.h"
19 #include "cc/test/test_shared_bitmap_manager.h" 20 #include "cc/test/test_shared_bitmap_manager.h"
20 #include "cc/test/test_task_graph_runner.h" 21 #include "cc/test/test_task_graph_runner.h"
21 #include "cc/test/test_tile_priorities.h" 22 #include "cc/test/test_tile_priorities.h"
22 #include "cc/tiles/tile.h" 23 #include "cc/tiles/tile.h"
23 #include "cc/tiles/tile_priority.h" 24 #include "cc/tiles/tile_priority.h"
24 #include "cc/trees/layer_tree_impl.h" 25 #include "cc/trees/layer_tree_impl.h"
25 26
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); 119 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
119 } 120 }
120 121
121 virtual void InitializeRenderer() { 122 virtual void InitializeRenderer() {
122 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); 123 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass());
123 tile_manager()->SetTileTaskRunnerForTesting( 124 tile_manager()->SetTileTaskRunnerForTesting(
124 g_fake_tile_task_runner.Pointer()); 125 g_fake_tile_task_runner.Pointer());
125 } 126 }
126 127
127 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 128 void SetupDefaultTrees(const gfx::Size& layer_bounds) {
128 scoped_refptr<FakePicturePileImpl> pending_pile = 129 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
129 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); 130 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
130 scoped_refptr<FakePicturePileImpl> active_pile = 131 scoped_refptr<FakeDisplayListRasterSource> active_raster_source =
131 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); 132 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
132 133
133 SetupTrees(pending_pile, active_pile); 134 SetupTrees(pending_raster_source, active_raster_source);
134 } 135 }
135 136
136 void ActivateTree() { 137 void ActivateTree() {
137 host_impl_.ActivateSyncTree(); 138 host_impl_.ActivateSyncTree();
138 CHECK(!host_impl_.pending_tree()); 139 CHECK(!host_impl_.pending_tree());
139 pending_root_layer_ = NULL; 140 pending_root_layer_ = NULL;
140 active_root_layer_ = static_cast<FakePictureLayerImpl*>( 141 active_root_layer_ = static_cast<FakePictureLayerImpl*>(
141 host_impl_.active_tree()->LayerById(id_)); 142 host_impl_.active_tree()->LayerById(id_));
142 } 143 }
143 144
144 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, 145 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds,
145 const gfx::Size& tile_size) { 146 const gfx::Size& tile_size) {
146 SetupDefaultTrees(layer_bounds); 147 SetupDefaultTrees(layer_bounds);
147 pending_root_layer_->set_fixed_tile_size(tile_size); 148 pending_root_layer_->set_fixed_tile_size(tile_size);
148 active_root_layer_->set_fixed_tile_size(tile_size); 149 active_root_layer_->set_fixed_tile_size(tile_size);
149 } 150 }
150 151
151 void SetupTrees(scoped_refptr<PicturePileImpl> pending_pile, 152 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
152 scoped_refptr<PicturePileImpl> active_pile) { 153 scoped_refptr<RasterSource> active_raster_source) {
153 SetupPendingTree(active_pile); 154 SetupPendingTree(active_raster_source);
154 ActivateTree(); 155 ActivateTree();
155 SetupPendingTree(pending_pile); 156 SetupPendingTree(pending_raster_source);
156 } 157 }
157 158
158 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { 159 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
159 host_impl_.CreatePendingTree(); 160 host_impl_.CreatePendingTree();
160 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 161 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
161 // Clear recycled tree. 162 // Clear recycled tree.
162 pending_tree->DetachLayerTree(); 163 pending_tree->DetachLayerTree();
163 164
164 scoped_ptr<FakePictureLayerImpl> pending_layer = 165 scoped_ptr<FakePictureLayerImpl> pending_layer =
165 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, pile); 166 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_,
167 raster_source);
166 pending_layer->SetDrawsContent(true); 168 pending_layer->SetDrawsContent(true);
167 pending_layer->SetHasRenderSurface(true); 169 pending_layer->SetHasRenderSurface(true);
168 pending_tree->SetRootLayer(pending_layer.Pass()); 170 pending_tree->SetRootLayer(pending_layer.Pass());
169 171
170 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( 172 pending_root_layer_ = static_cast<FakePictureLayerImpl*>(
171 host_impl_.pending_tree()->LayerById(id_)); 173 host_impl_.pending_tree()->LayerById(id_));
172 } 174 }
173 175
174 void RunRasterQueueConstructTest(const std::string& test_name, 176 void RunRasterQueueConstructTest(const std::string& test_name,
175 int layer_count) { 177 int layer_count) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 SetupDefaultTreesWithFixedTileSize(layer_bounds, 339 SetupDefaultTreesWithFixedTileSize(layer_bounds,
338 settings_.default_tile_size); 340 settings_.default_tile_size);
339 341
340 std::vector<FakePictureLayerImpl*> layers; 342 std::vector<FakePictureLayerImpl*> layers;
341 343
342 // Pending layer counts as one layer. 344 // Pending layer counts as one layer.
343 layers.push_back(pending_root_layer_); 345 layers.push_back(pending_root_layer_);
344 int next_id = id_ + 1; 346 int next_id = id_ + 1;
345 347
346 // Create the rest of the layers as children of the root layer. 348 // Create the rest of the layers as children of the root layer.
347 scoped_refptr<FakePicturePileImpl> pile = 349 scoped_refptr<FakeDisplayListRasterSource> raster_source =
348 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); 350 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
349 while (static_cast<int>(layers.size()) < layer_count) { 351 while (static_cast<int>(layers.size()) < layer_count) {
350 scoped_ptr<FakePictureLayerImpl> layer = 352 scoped_ptr<FakePictureLayerImpl> layer =
351 FakePictureLayerImpl::CreateWithRasterSource( 353 FakePictureLayerImpl::CreateWithRasterSource(
352 host_impl_.pending_tree(), next_id, pile); 354 host_impl_.pending_tree(), next_id, raster_source);
353 layer->SetBounds(layer_bounds); 355 layer->SetBounds(layer_bounds);
354 layer->SetDrawsContent(true); 356 layer->SetDrawsContent(true);
355 layers.push_back(layer.get()); 357 layers.push_back(layer.get());
356 pending_root_layer_->AddChild(layer.Pass()); 358 pending_root_layer_->AddChild(layer.Pass());
357 ++next_id; 359 ++next_id;
358 } 360 }
359 361
360 bool update_lcd_text = false; 362 bool update_lcd_text = false;
361 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 363 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
362 for (FakePictureLayerImpl* layer : layers) 364 for (FakePictureLayerImpl* layer : layers)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 TestTaskGraphRunner task_graph_runner_; 412 TestTaskGraphRunner task_graph_runner_;
411 TileMemoryLimitPolicy memory_limit_policy_; 413 TileMemoryLimitPolicy memory_limit_policy_;
412 int max_tiles_; 414 int max_tiles_;
413 int id_; 415 int id_;
414 FakeImplProxy proxy_; 416 FakeImplProxy proxy_;
415 FakeLayerTreeHostImpl host_impl_; 417 FakeLayerTreeHostImpl host_impl_;
416 FakePictureLayerImpl* pending_root_layer_; 418 FakePictureLayerImpl* pending_root_layer_;
417 FakePictureLayerImpl* active_root_layer_; 419 FakePictureLayerImpl* active_root_layer_;
418 LapTimer timer_; 420 LapTimer timer_;
419 LayerTreeSettings settings_; 421 LayerTreeSettings settings_;
420
421 static const gfx::Size kDefaultTileSize;
422 }; 422 };
423 423
424 const gfx::Size TileManagerPerfTest::kDefaultTileSize(100, 100);
425
426 TEST_F(TileManagerPerfTest, PrepareTiles) { 424 TEST_F(TileManagerPerfTest, PrepareTiles) {
427 RunPrepareTilesTest("2_100", 2, 100); 425 RunPrepareTilesTest("2_100", 2, 100);
428 RunPrepareTilesTest("2_500", 2, 500); 426 RunPrepareTilesTest("2_500", 2, 500);
429 RunPrepareTilesTest("2_1000", 2, 1000); 427 RunPrepareTilesTest("2_1000", 2, 1000);
430 RunPrepareTilesTest("10_100", 10, 100); 428 RunPrepareTilesTest("10_100", 10, 100);
431 RunPrepareTilesTest("10_500", 10, 500); 429 RunPrepareTilesTest("10_500", 10, 500);
432 RunPrepareTilesTest("10_1000", 10, 1000); 430 RunPrepareTilesTest("10_1000", 10, 1000);
433 RunPrepareTilesTest("50_100", 100, 100); 431 RunPrepareTilesTest("50_100", 100, 100);
434 RunPrepareTilesTest("50_500", 100, 500); 432 RunPrepareTilesTest("50_500", 100, 500);
435 RunPrepareTilesTest("50_1000", 100, 1000); 433 RunPrepareTilesTest("50_1000", 100, 1000);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); 470 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64);
473 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); 471 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128);
474 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); 472 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16);
475 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); 473 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32);
476 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); 474 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64);
477 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); 475 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128);
478 } 476 }
479 477
480 } // namespace 478 } // namespace
481 } // namespace cc 479 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling_unittest.cc ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698