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 30 matching lines...) Expand all Loading... |
41 kTimeCheckInterval) {} | 41 kTimeCheckInterval) {} |
42 | 42 |
43 // Overridden from testing::Test: | 43 // Overridden from testing::Test: |
44 virtual void SetUp() OVERRIDE { | 44 virtual void SetUp() OVERRIDE { |
45 output_surface_ = FakeOutputSurface::Create3d(); | 45 output_surface_ = FakeOutputSurface::Create3d(); |
46 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 46 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
47 | 47 |
48 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 48 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
49 resource_provider_ = ResourceProvider::Create( | 49 resource_provider_ = ResourceProvider::Create( |
50 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1); | 50 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1); |
| 51 resource_pool_ = ResourcePool::Create( |
| 52 resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888); |
51 size_t raster_task_limit_bytes = 32 * 1024 * 1024; // 16-64MB in practice. | 53 size_t raster_task_limit_bytes = 32 * 1024 * 1024; // 16-64MB in practice. |
52 tile_manager_ = | 54 tile_manager_ = make_scoped_ptr(new FakeTileManager( |
53 make_scoped_ptr(new FakeTileManager(&tile_manager_client_, | 55 &tile_manager_client_, resource_pool_.get(), raster_task_limit_bytes)); |
54 resource_provider_.get(), | |
55 raster_task_limit_bytes)); | |
56 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); | 56 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); |
57 } | 57 } |
58 | 58 |
59 GlobalStateThatImpactsTilePriority GlobalStateForTest() { | 59 GlobalStateThatImpactsTilePriority GlobalStateForTest() { |
60 GlobalStateThatImpactsTilePriority state; | 60 GlobalStateThatImpactsTilePriority state; |
61 gfx::Size tile_size = settings_.default_tile_size; | 61 gfx::Size tile_size = settings_.default_tile_size; |
62 state.soft_memory_limit_in_bytes = | 62 state.soft_memory_limit_in_bytes = |
63 10000u * 4u * | 63 10000u * 4u * |
64 static_cast<size_t>(tile_size.width() * tile_size.height()); | 64 static_cast<size_t>(tile_size.width() * tile_size.height()); |
65 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; | 65 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 private: | 173 private: |
174 FakeTileManagerClient tile_manager_client_; | 174 FakeTileManagerClient tile_manager_client_; |
175 LayerTreeSettings settings_; | 175 LayerTreeSettings settings_; |
176 scoped_ptr<FakeTileManager> tile_manager_; | 176 scoped_ptr<FakeTileManager> tile_manager_; |
177 scoped_refptr<FakePicturePileImpl> picture_pile_; | 177 scoped_refptr<FakePicturePileImpl> picture_pile_; |
178 FakeOutputSurfaceClient output_surface_client_; | 178 FakeOutputSurfaceClient output_surface_client_; |
179 scoped_ptr<FakeOutputSurface> output_surface_; | 179 scoped_ptr<FakeOutputSurface> output_surface_; |
180 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 180 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
181 scoped_ptr<ResourceProvider> resource_provider_; | 181 scoped_ptr<ResourceProvider> resource_provider_; |
| 182 scoped_ptr<ResourcePool> resource_pool_; |
182 LapTimer timer_; | 183 LapTimer timer_; |
183 }; | 184 }; |
184 | 185 |
185 TEST_F(TileManagerPerfTest, ManageTiles) { | 186 TEST_F(TileManagerPerfTest, ManageTiles) { |
186 RunManageTilesTest("100_0", 100, 0); | 187 RunManageTilesTest("100_0", 100, 0); |
187 RunManageTilesTest("1000_0", 1000, 0); | 188 RunManageTilesTest("1000_0", 1000, 0); |
188 RunManageTilesTest("10000_0", 10000, 0); | 189 RunManageTilesTest("10000_0", 10000, 0); |
189 RunManageTilesTest("100_10", 100, 10); | 190 RunManageTilesTest("100_10", 100, 10); |
190 RunManageTilesTest("1000_10", 1000, 10); | 191 RunManageTilesTest("1000_10", 1000, 10); |
191 RunManageTilesTest("10000_10", 10000, 10); | 192 RunManageTilesTest("10000_10", 10000, 10); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 341 |
341 RunTest("2_16", 16); | 342 RunTest("2_16", 16); |
342 RunTest("2_32", 32); | 343 RunTest("2_32", 32); |
343 RunTest("2_64", 64); | 344 RunTest("2_64", 64); |
344 RunTest("2_128", 128); | 345 RunTest("2_128", 128); |
345 } | 346 } |
346 | 347 |
347 } // namespace | 348 } // namespace |
348 | 349 |
349 } // namespace cc | 350 } // namespace cc |
OLD | NEW |