| 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/resources/tile.h" | 6 #include "cc/resources/tile.h" |
| 7 #include "cc/resources/tile_priority.h" | 7 #include "cc/resources/tile_priority.h" |
| 8 #include "cc/test/fake_impl_proxy.h" | 8 #include "cc/test/fake_impl_proxy.h" |
| 9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
| 10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 for (unsigned i = 0; i < tile_count; | 154 for (unsigned i = 0; i < tile_count; |
| 155 i += 100 / priority_change_percent) { | 155 i += 100 / priority_change_percent) { |
| 156 Tile* tile = tiles[i].first.get(); | 156 Tile* tile = tiles[i].first.get(); |
| 157 ManagedTileBin bin = GetNextBin(tiles[i].second); | 157 ManagedTileBin bin = GetNextBin(tiles[i].second); |
| 158 tile->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); | 158 tile->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); |
| 159 tile->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); | 159 tile->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); |
| 160 tiles[i].second = bin; | 160 tiles[i].second = bin; |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 tile_manager_->ManageTiles(GlobalStateForTest()); | 164 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
| 165 resource_pool_->SetResourceUsageLimits( |
| 166 global_state.soft_memory_limit_in_bytes, |
| 167 0, |
| 168 global_state.num_resources_limit); |
| 169 tile_manager_->ManageTiles(global_state); |
| 165 tile_manager_->UpdateVisibleTiles(); | 170 tile_manager_->UpdateVisibleTiles(); |
| 166 timer_.NextLap(); | 171 timer_.NextLap(); |
| 167 } while (!timer_.HasTimeLimitExpired()); | 172 } while (!timer_.HasTimeLimitExpired()); |
| 168 | 173 |
| 169 perf_test::PrintResult( | 174 perf_test::PrintResult( |
| 170 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 175 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| 171 } | 176 } |
| 172 | 177 |
| 173 private: | 178 private: |
| 174 FakeTileManagerClient tile_manager_client_; | 179 FakeTileManagerClient tile_manager_client_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 216 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 212 kTimeCheckInterval) {} | 217 kTimeCheckInterval) {} |
| 213 | 218 |
| 214 void SetTreePriority(TreePriority tree_priority) { | 219 void SetTreePriority(TreePriority tree_priority) { |
| 215 GlobalStateThatImpactsTilePriority state; | 220 GlobalStateThatImpactsTilePriority state; |
| 216 gfx::Size tile_size(256, 256); | 221 gfx::Size tile_size(256, 256); |
| 217 | 222 |
| 218 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; | 223 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; |
| 219 state.num_resources_limit = max_tiles_; | 224 state.num_resources_limit = max_tiles_; |
| 220 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | 225 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; |
| 221 state.unused_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; | |
| 222 state.memory_limit_policy = memory_limit_policy_; | 226 state.memory_limit_policy = memory_limit_policy_; |
| 223 state.tree_priority = tree_priority; | 227 state.tree_priority = tree_priority; |
| 224 | 228 |
| 225 global_state_ = state; | 229 global_state_ = state; |
| 230 host_impl_.resource_pool()->SetResourceUsageLimits( |
| 231 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); |
| 226 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 232 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
| 227 } | 233 } |
| 228 | 234 |
| 229 virtual void SetUp() OVERRIDE { | 235 virtual void SetUp() OVERRIDE { |
| 230 InitializeRenderer(); | 236 InitializeRenderer(); |
| 231 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 237 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 232 } | 238 } |
| 233 | 239 |
| 234 virtual void InitializeRenderer() { | 240 virtual void InitializeRenderer() { |
| 235 host_impl_.InitializeRenderer( | 241 host_impl_.InitializeRenderer( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 347 |
| 342 RunTest("2_16", 16); | 348 RunTest("2_16", 16); |
| 343 RunTest("2_32", 32); | 349 RunTest("2_32", 32); |
| 344 RunTest("2_64", 64); | 350 RunTest("2_64", 64); |
| 345 RunTest("2_128", 128); | 351 RunTest("2_128", 128); |
| 346 } | 352 } |
| 347 | 353 |
| 348 } // namespace | 354 } // namespace |
| 349 | 355 |
| 350 } // namespace cc | 356 } // namespace cc |
| OLD | NEW |