| 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_output_surface.h" | 8 #include "cc/test/fake_output_surface.h" |
| 9 #include "cc/test/fake_output_surface_client.h" | 9 #include "cc/test/fake_output_surface_client.h" |
| 10 #include "cc/test/fake_picture_pile_impl.h" | 10 #include "cc/test/fake_picture_pile_impl.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 output_surface_ = FakeOutputSurface::Create3d(); | 39 output_surface_ = FakeOutputSurface::Create3d(); |
| 40 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 40 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 41 | 41 |
| 42 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 42 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
| 43 tile_manager_ = make_scoped_ptr( | 43 tile_manager_ = make_scoped_ptr( |
| 44 new FakeTileManager(&tile_manager_client_, resource_provider_.get())); | 44 new FakeTileManager(&tile_manager_client_, resource_provider_.get())); |
| 45 | 45 |
| 46 GlobalStateThatImpactsTilePriority state; | 46 GlobalStateThatImpactsTilePriority state; |
| 47 gfx::Size tile_size = settings_.default_tile_size; | 47 gfx::Size tile_size = settings_.default_tile_size; |
| 48 state.memory_limit_in_bytes = | 48 state.memory_limit_in_bytes = |
| 49 10000 * 4 * tile_size.width() * tile_size.height(); | 49 10000u * 4u * |
| 50 static_cast<size_t>(tile_size.width() * tile_size.height()); |
| 51 state.num_resources_limit = 10000; |
| 50 state.memory_limit_policy = ALLOW_ANYTHING; | 52 state.memory_limit_policy = ALLOW_ANYTHING; |
| 51 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; | 53 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; |
| 52 | 54 |
| 53 tile_manager_->SetGlobalState(state); | 55 tile_manager_->SetGlobalState(state); |
| 54 picture_pile_ = FakePicturePileImpl::CreatePile(); | 56 picture_pile_ = FakePicturePileImpl::CreatePile(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 virtual void TearDown() OVERRIDE { | 59 virtual void TearDown() OVERRIDE { |
| 58 tile_manager_.reset(NULL); | 60 tile_manager_.reset(NULL); |
| 59 picture_pile_ = NULL; | 61 picture_pile_ = NULL; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 i += 100 / priority_change_percent) { | 143 i += 100 / priority_change_percent) { |
| 142 Tile* tile = tiles[i].first; | 144 Tile* tile = tiles[i].first; |
| 143 ManagedTileBin bin = GetNextBin(tiles[i].second); | 145 ManagedTileBin bin = GetNextBin(tiles[i].second); |
| 144 tile->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); | 146 tile->SetPriority(ACTIVE_TREE, GetTilePriorityFromBin(bin)); |
| 145 tile->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); | 147 tile->SetPriority(PENDING_TREE, GetTilePriorityFromBin(bin)); |
| 146 tiles[i].second = bin; | 148 tiles[i].second = bin; |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 | 151 |
| 150 tile_manager_->ManageTiles(); | 152 tile_manager_->ManageTiles(); |
| 153 tile_manager_->CheckForCompletedTasks(); |
| 151 timer_.NextLap(); | 154 timer_.NextLap(); |
| 152 } while (!timer_.HasTimeLimitExpired()); | 155 } while (!timer_.HasTimeLimitExpired()); |
| 153 | 156 |
| 154 perf_test::PrintResult("manage_tiles", "", test_name, | 157 perf_test::PrintResult("manage_tiles", "", test_name, |
| 155 timer_.LapsPerSecond(), "runs/s", true); | 158 timer_.LapsPerSecond(), "runs/s", true); |
| 156 } | 159 } |
| 157 | 160 |
| 158 private: | 161 private: |
| 159 FakeTileManagerClient tile_manager_client_; | 162 FakeTileManagerClient tile_manager_client_; |
| 160 LayerTreeSettings settings_; | 163 LayerTreeSettings settings_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 174 RunManageTilesTest("1000_10", 1000, 10); | 177 RunManageTilesTest("1000_10", 1000, 10); |
| 175 RunManageTilesTest("10000_10", 10000, 10); | 178 RunManageTilesTest("10000_10", 10000, 10); |
| 176 RunManageTilesTest("100_100", 100, 100); | 179 RunManageTilesTest("100_100", 100, 100); |
| 177 RunManageTilesTest("1000_100", 1000, 100); | 180 RunManageTilesTest("1000_100", 1000, 100); |
| 178 RunManageTilesTest("10000_100", 10000, 100); | 181 RunManageTilesTest("10000_100", 10000, 100); |
| 179 } | 182 } |
| 180 | 183 |
| 181 } // namespace | 184 } // namespace |
| 182 | 185 |
| 183 } // namespace cc | 186 } // namespace cc |
| OLD | NEW |