| OLD | NEW |
| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 private: | 78 private: |
| 79 RasterTask::Vector completed_tasks_; | 79 RasterTask::Vector completed_tasks_; |
| 80 }; | 80 }; |
| 81 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = | 81 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = |
| 82 LAZY_INSTANCE_INITIALIZER; | 82 LAZY_INSTANCE_INITIALIZER; |
| 83 | 83 |
| 84 class TileManagerPerfTest : public testing::Test { | 84 class TileManagerPerfTest : public testing::Test { |
| 85 public: | 85 public: |
| 86 TileManagerPerfTest() | 86 TileManagerPerfTest() |
| 87 : memory_limit_policy_(ALLOW_ANYTHING), | 87 : memory_limit_policy_(ALLOW_ANYTHING), |
| 88 max_tiles_(10000), | |
| 89 id_(7), | 88 id_(7), |
| 90 proxy_(base::MessageLoopProxy::current()), | 89 proxy_(base::MessageLoopProxy::current()), |
| 91 host_impl_(ImplSidePaintingSettings(10000), | 90 host_impl_(ImplSidePaintingSettings(10000), |
| 92 &proxy_, | 91 &proxy_, |
| 93 &shared_bitmap_manager_), | 92 &shared_bitmap_manager_), |
| 94 timer_(kWarmupRuns, | 93 timer_(kWarmupRuns, |
| 95 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 94 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 96 kTimeCheckInterval) {} | 95 kTimeCheckInterval) {} |
| 97 | 96 |
| 98 void SetTreePriority(TreePriority tree_priority) { | 97 void SetTreePriority(TreePriority tree_priority) { |
| 99 GlobalStateThatImpactsTilePriority state; | 98 GlobalStateThatImpactsTilePriority state; |
| 100 gfx::Size tile_size(256, 256); | 99 gfx::Size tile_size(256, 256); |
| 101 | 100 |
| 102 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; | 101 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; |
| 103 state.num_resources_limit = max_tiles_; | |
| 104 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | 102 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; |
| 105 state.memory_limit_policy = memory_limit_policy_; | 103 state.memory_limit_policy = memory_limit_policy_; |
| 106 state.tree_priority = tree_priority; | 104 state.tree_priority = tree_priority; |
| 107 | 105 |
| 108 global_state_ = state; | 106 global_state_ = state; |
| 109 host_impl_.resource_pool()->SetResourceUsageLimits( | 107 host_impl_.resource_pool()->SetResourceUsageLimits( |
| 110 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); | 108 state.soft_memory_limit_in_bytes, 0); |
| 111 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 109 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
| 112 } | 110 } |
| 113 | 111 |
| 114 virtual void SetUp() override { | 112 virtual void SetUp() override { |
| 115 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); | 113 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); |
| 116 InitializeRenderer(); | 114 InitializeRenderer(); |
| 117 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 115 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 118 } | 116 } |
| 119 | 117 |
| 120 virtual void InitializeRenderer() { | 118 virtual void InitializeRenderer() { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return layers; | 378 return layers; |
| 381 } | 379 } |
| 382 | 380 |
| 383 GlobalStateThatImpactsTilePriority GlobalStateForTest() { | 381 GlobalStateThatImpactsTilePriority GlobalStateForTest() { |
| 384 GlobalStateThatImpactsTilePriority state; | 382 GlobalStateThatImpactsTilePriority state; |
| 385 gfx::Size tile_size = settings_.default_tile_size; | 383 gfx::Size tile_size = settings_.default_tile_size; |
| 386 state.soft_memory_limit_in_bytes = | 384 state.soft_memory_limit_in_bytes = |
| 387 10000u * 4u * | 385 10000u * 4u * |
| 388 static_cast<size_t>(tile_size.width() * tile_size.height()); | 386 static_cast<size_t>(tile_size.width() * tile_size.height()); |
| 389 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; | 387 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; |
| 390 state.num_resources_limit = 10000; | |
| 391 state.memory_limit_policy = ALLOW_ANYTHING; | 388 state.memory_limit_policy = ALLOW_ANYTHING; |
| 392 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; | 389 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; |
| 393 return state; | 390 return state; |
| 394 } | 391 } |
| 395 | 392 |
| 396 void RunManageTilesTest(const std::string& test_name, | 393 void RunManageTilesTest(const std::string& test_name, |
| 397 int layer_count, | 394 int layer_count, |
| 398 int approximate_tile_count_per_layer) { | 395 int approximate_tile_count_per_layer) { |
| 399 std::vector<LayerImpl*> layers = | 396 std::vector<LayerImpl*> layers = |
| 400 CreateLayers(layer_count, approximate_tile_count_per_layer); | 397 CreateLayers(layer_count, approximate_tile_count_per_layer); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 418 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 415 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| 419 } | 416 } |
| 420 | 417 |
| 421 TileManager* tile_manager() { return host_impl_.tile_manager(); } | 418 TileManager* tile_manager() { return host_impl_.tile_manager(); } |
| 422 | 419 |
| 423 protected: | 420 protected: |
| 424 GlobalStateThatImpactsTilePriority global_state_; | 421 GlobalStateThatImpactsTilePriority global_state_; |
| 425 | 422 |
| 426 TestSharedBitmapManager shared_bitmap_manager_; | 423 TestSharedBitmapManager shared_bitmap_manager_; |
| 427 TileMemoryLimitPolicy memory_limit_policy_; | 424 TileMemoryLimitPolicy memory_limit_policy_; |
| 428 int max_tiles_; | |
| 429 int id_; | 425 int id_; |
| 430 FakeImplProxy proxy_; | 426 FakeImplProxy proxy_; |
| 431 FakeLayerTreeHostImpl host_impl_; | 427 FakeLayerTreeHostImpl host_impl_; |
| 432 FakePictureLayerImpl* pending_root_layer_; | 428 FakePictureLayerImpl* pending_root_layer_; |
| 433 FakePictureLayerImpl* active_root_layer_; | 429 FakePictureLayerImpl* active_root_layer_; |
| 434 LapTimer timer_; | 430 LapTimer timer_; |
| 435 scoped_refptr<FakePicturePileImpl> picture_pile_; | 431 scoped_refptr<FakePicturePileImpl> picture_pile_; |
| 436 LayerTreeSettings settings_; | 432 LayerTreeSettings settings_; |
| 437 }; | 433 }; |
| 438 | 434 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 482 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 487 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 483 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 488 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 484 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 489 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 485 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 490 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 486 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 491 } | 487 } |
| 492 | 488 |
| 493 } // namespace | 489 } // namespace |
| 494 | 490 |
| 495 } // namespace cc | 491 } // namespace cc |
| OLD | NEW |