| 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 "cc/resources/eviction_tile_priority_queue.h" | 5 #include "cc/resources/eviction_tile_priority_queue.h" |
| 6 #include "cc/resources/raster_tile_priority_queue.h" | 6 #include "cc/resources/raster_tile_priority_queue.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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 ReleaseTiles(&active_tree_tiles); | 475 ReleaseTiles(&active_tree_tiles); |
| 476 ReleaseTiles(&pending_tree_tiles); | 476 ReleaseTiles(&pending_tree_tiles); |
| 477 } | 477 } |
| 478 | 478 |
| 479 // If true, the max tile limit should be applied as bytes; if false, | 479 // If true, the max tile limit should be applied as bytes; if false, |
| 480 // as num_resources_limit. | 480 // as num_resources_limit. |
| 481 INSTANTIATE_TEST_CASE_P(TileManagerTests, | 481 INSTANTIATE_TEST_CASE_P(TileManagerTests, |
| 482 TileManagerTest, | 482 TileManagerTest, |
| 483 ::testing::Values(true, false)); | 483 ::testing::Values(true, false)); |
| 484 | 484 |
| 485 class LowResTilingsSettings : public ImplSidePaintingSettings { |
| 486 public: |
| 487 LowResTilingsSettings() { create_low_res_tiling = true; } |
| 488 }; |
| 489 |
| 485 class TileManagerTilePriorityQueueTest : public testing::Test { | 490 class TileManagerTilePriorityQueueTest : public testing::Test { |
| 486 public: | 491 public: |
| 487 TileManagerTilePriorityQueueTest() | 492 TileManagerTilePriorityQueueTest() |
| 488 : memory_limit_policy_(ALLOW_ANYTHING), | 493 : memory_limit_policy_(ALLOW_ANYTHING), |
| 489 max_tiles_(10000), | 494 max_tiles_(10000), |
| 490 ready_to_activate_(false), | 495 ready_to_activate_(false), |
| 491 id_(7), | 496 id_(7), |
| 492 proxy_(base::MessageLoopProxy::current()), | 497 proxy_(base::MessageLoopProxy::current()), |
| 493 host_impl_(ImplSidePaintingSettings(), | 498 host_impl_(LowResTilingsSettings(), &proxy_, &shared_bitmap_manager_) {} |
| 494 &proxy_, | |
| 495 &shared_bitmap_manager_) {} | |
| 496 | 499 |
| 497 void SetTreePriority(TreePriority tree_priority) { | 500 void SetTreePriority(TreePriority tree_priority) { |
| 498 GlobalStateThatImpactsTilePriority state; | 501 GlobalStateThatImpactsTilePriority state; |
| 499 gfx::Size tile_size(256, 256); | 502 gfx::Size tile_size(256, 256); |
| 500 | 503 |
| 501 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; | 504 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; |
| 502 state.num_resources_limit = max_tiles_; | 505 state.num_resources_limit = max_tiles_; |
| 503 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | 506 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; |
| 504 state.memory_limit_policy = memory_limit_policy_; | 507 state.memory_limit_policy = memory_limit_policy_; |
| 505 state.tree_priority = tree_priority; | 508 state.tree_priority = tree_priority; |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 all_tiles.insert(queue.Top()); | 1216 all_tiles.insert(queue.Top()); |
| 1214 ++tile_count; | 1217 ++tile_count; |
| 1215 queue.Pop(); | 1218 queue.Pop(); |
| 1216 } | 1219 } |
| 1217 EXPECT_EQ(tile_count, all_tiles.size()); | 1220 EXPECT_EQ(tile_count, all_tiles.size()); |
| 1218 EXPECT_EQ(17u, tile_count); | 1221 EXPECT_EQ(17u, tile_count); |
| 1219 } | 1222 } |
| 1220 | 1223 |
| 1221 } // namespace | 1224 } // namespace |
| 1222 } // namespace cc | 1225 } // namespace cc |
| OLD | NEW |