| 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/tile.h" | 7 #include "cc/resources/tile.h" |
| 8 #include "cc/resources/tile_priority.h" | 8 #include "cc/resources/tile_priority.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return NULL; | 69 return NULL; |
| 70 } | 70 } |
| 71 virtual void ReleaseCanvasForRaster(RasterTask* task) OVERRIDE {} | 71 virtual void ReleaseCanvasForRaster(RasterTask* task) OVERRIDE {} |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 RasterTask::Vector completed_tasks_; | 74 RasterTask::Vector completed_tasks_; |
| 75 }; | 75 }; |
| 76 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = | 76 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = |
| 77 LAZY_INSTANCE_INITIALIZER; | 77 LAZY_INSTANCE_INITIALIZER; |
| 78 | 78 |
| 79 class TileManagerPerfTest : public testing::Test, public TileManagerClient { | 79 class TileManagerPerfTest : public testing::Test { |
| 80 public: | 80 public: |
| 81 TileManagerPerfTest() | 81 TileManagerPerfTest() |
| 82 : memory_limit_policy_(ALLOW_ANYTHING), | 82 : memory_limit_policy_(ALLOW_ANYTHING), |
| 83 max_tiles_(10000), | 83 max_tiles_(10000), |
| 84 ready_to_activate_(false), | |
| 85 id_(7), | 84 id_(7), |
| 86 proxy_(base::MessageLoopProxy::current()), | 85 proxy_(base::MessageLoopProxy::current()), |
| 87 host_impl_(ImplSidePaintingSettings(10000), | 86 host_impl_(ImplSidePaintingSettings(10000), |
| 88 &proxy_, | 87 &proxy_, |
| 89 &shared_bitmap_manager_), | 88 &shared_bitmap_manager_), |
| 90 timer_(kWarmupRuns, | 89 timer_(kWarmupRuns, |
| 91 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 90 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 92 kTimeCheckInterval) {} | 91 kTimeCheckInterval) {} |
| 93 | 92 |
| 94 void SetTreePriority(TreePriority tree_priority) { | 93 void SetTreePriority(TreePriority tree_priority) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 tile_manager()->ManageTiles(global_state); | 283 tile_manager()->ManageTiles(global_state); |
| 285 tile_manager()->UpdateVisibleTiles(); | 284 tile_manager()->UpdateVisibleTiles(); |
| 286 timer_.NextLap(); | 285 timer_.NextLap(); |
| 287 host_impl_.ResetCurrentFrameTimeForNextFrame(); | 286 host_impl_.ResetCurrentFrameTimeForNextFrame(); |
| 288 } while (!timer_.HasTimeLimitExpired()); | 287 } while (!timer_.HasTimeLimitExpired()); |
| 289 | 288 |
| 290 perf_test::PrintResult( | 289 perf_test::PrintResult( |
| 291 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 290 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| 292 } | 291 } |
| 293 | 292 |
| 294 // TileManagerClient implementation. | |
| 295 virtual void NotifyReadyToActivate() OVERRIDE { ready_to_activate_ = true; } | |
| 296 virtual void NotifyTileStateChanged(const Tile* tile) OVERRIDE {} | |
| 297 | |
| 298 TileManager* tile_manager() { return host_impl_.tile_manager(); } | 293 TileManager* tile_manager() { return host_impl_.tile_manager(); } |
| 299 | 294 |
| 300 protected: | 295 protected: |
| 301 GlobalStateThatImpactsTilePriority global_state_; | 296 GlobalStateThatImpactsTilePriority global_state_; |
| 302 | 297 |
| 303 TestSharedBitmapManager shared_bitmap_manager_; | 298 TestSharedBitmapManager shared_bitmap_manager_; |
| 304 TileMemoryLimitPolicy memory_limit_policy_; | 299 TileMemoryLimitPolicy memory_limit_policy_; |
| 305 int max_tiles_; | 300 int max_tiles_; |
| 306 bool ready_to_activate_; | |
| 307 int id_; | 301 int id_; |
| 308 FakeImplProxy proxy_; | 302 FakeImplProxy proxy_; |
| 309 FakeLayerTreeHostImpl host_impl_; | 303 FakeLayerTreeHostImpl host_impl_; |
| 310 FakePictureLayerImpl* pending_root_layer_; | 304 FakePictureLayerImpl* pending_root_layer_; |
| 311 FakePictureLayerImpl* active_root_layer_; | 305 FakePictureLayerImpl* active_root_layer_; |
| 312 LapTimer timer_; | 306 LapTimer timer_; |
| 313 scoped_refptr<FakePicturePileImpl> picture_pile_; | 307 scoped_refptr<FakePicturePileImpl> picture_pile_; |
| 314 LayerTreeSettings settings_; | 308 LayerTreeSettings settings_; |
| 315 }; | 309 }; |
| 316 | 310 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 336 | 330 |
| 337 RunRasterIteratorTest("2_16", 16); | 331 RunRasterIteratorTest("2_16", 16); |
| 338 RunRasterIteratorTest("2_32", 32); | 332 RunRasterIteratorTest("2_32", 32); |
| 339 RunRasterIteratorTest("2_64", 64); | 333 RunRasterIteratorTest("2_64", 64); |
| 340 RunRasterIteratorTest("2_128", 128); | 334 RunRasterIteratorTest("2_128", 128); |
| 341 } | 335 } |
| 342 | 336 |
| 343 } // namespace | 337 } // namespace |
| 344 | 338 |
| 345 } // namespace cc | 339 } // namespace cc |
| OLD | NEW |