| 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/tile.h" | 5 #include "cc/resources/tile.h" |
| 6 #include "cc/resources/tile_priority.h" | 6 #include "cc/resources/tile_priority.h" |
| 7 #include "cc/test/fake_impl_proxy.h" | 7 #include "cc/test/fake_impl_proxy.h" |
| 8 #include "cc/test/fake_layer_tree_host_impl.h" | 8 #include "cc/test/fake_layer_tree_host_impl.h" |
| 9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
| 10 #include "cc/test/fake_output_surface_client.h" | 10 #include "cc/test/fake_output_surface_client.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 if (UsingMemoryLimit()) { | 59 if (UsingMemoryLimit()) { |
| 60 state.soft_memory_limit_in_bytes = | 60 state.soft_memory_limit_in_bytes = |
| 61 max_tiles_ * 4 * tile_size.width() * tile_size.height(); | 61 max_tiles_ * 4 * tile_size.width() * tile_size.height(); |
| 62 state.num_resources_limit = 100; | 62 state.num_resources_limit = 100; |
| 63 } else { | 63 } else { |
| 64 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; | 64 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; |
| 65 state.num_resources_limit = max_tiles_; | 65 state.num_resources_limit = max_tiles_; |
| 66 } | 66 } |
| 67 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | 67 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; |
| 68 state.unused_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; | |
| 69 state.memory_limit_policy = memory_limit_policy_; | 68 state.memory_limit_policy = memory_limit_policy_; |
| 70 state.tree_priority = tree_priority; | 69 state.tree_priority = tree_priority; |
| 71 | 70 |
| 72 global_state_ = state; | 71 global_state_ = state; |
| 72 resource_pool_->SetResourceUsageLimits(state.soft_memory_limit_in_bytes, |
| 73 state.soft_memory_limit_in_bytes, |
| 74 state.num_resources_limit); |
| 73 tile_manager_->SetGlobalStateForTesting(state); | 75 tile_manager_->SetGlobalStateForTesting(state); |
| 74 } | 76 } |
| 75 | 77 |
| 76 virtual void TearDown() OVERRIDE { | 78 virtual void TearDown() OVERRIDE { |
| 77 tile_manager_.reset(NULL); | 79 tile_manager_.reset(NULL); |
| 78 picture_pile_ = NULL; | 80 picture_pile_ = NULL; |
| 79 | 81 |
| 80 testing::Test::TearDown(); | 82 testing::Test::TearDown(); |
| 81 } | 83 } |
| 82 | 84 |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 &proxy_, | 652 &proxy_, |
| 651 &shared_bitmap_manager_) {} | 653 &shared_bitmap_manager_) {} |
| 652 | 654 |
| 653 void SetTreePriority(TreePriority tree_priority) { | 655 void SetTreePriority(TreePriority tree_priority) { |
| 654 GlobalStateThatImpactsTilePriority state; | 656 GlobalStateThatImpactsTilePriority state; |
| 655 gfx::Size tile_size(256, 256); | 657 gfx::Size tile_size(256, 256); |
| 656 | 658 |
| 657 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; | 659 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; |
| 658 state.num_resources_limit = max_tiles_; | 660 state.num_resources_limit = max_tiles_; |
| 659 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | 661 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; |
| 660 state.unused_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; | |
| 661 state.memory_limit_policy = memory_limit_policy_; | 662 state.memory_limit_policy = memory_limit_policy_; |
| 662 state.tree_priority = tree_priority; | 663 state.tree_priority = tree_priority; |
| 663 | 664 |
| 664 global_state_ = state; | 665 global_state_ = state; |
| 666 host_impl_.resource_pool()->SetResourceUsageLimits( |
| 667 state.soft_memory_limit_in_bytes, |
| 668 state.soft_memory_limit_in_bytes, |
| 669 state.num_resources_limit); |
| 665 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 670 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
| 666 } | 671 } |
| 667 | 672 |
| 668 virtual void SetUp() OVERRIDE { | 673 virtual void SetUp() OVERRIDE { |
| 669 InitializeRenderer(); | 674 InitializeRenderer(); |
| 670 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 675 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 671 } | 676 } |
| 672 | 677 |
| 673 virtual void InitializeRenderer() { | 678 virtual void InitializeRenderer() { |
| 674 host_impl_.InitializeRenderer( | 679 host_impl_.InitializeRenderer( |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1134 |
| 1130 last_tile = tile; | 1135 last_tile = tile; |
| 1131 new_content_tiles.insert(tile); | 1136 new_content_tiles.insert(tile); |
| 1132 } | 1137 } |
| 1133 | 1138 |
| 1134 EXPECT_EQ(tile_count, new_content_tiles.size()); | 1139 EXPECT_EQ(tile_count, new_content_tiles.size()); |
| 1135 EXPECT_EQ(all_tiles, new_content_tiles); | 1140 EXPECT_EQ(all_tiles, new_content_tiles); |
| 1136 } | 1141 } |
| 1137 } // namespace | 1142 } // namespace |
| 1138 } // namespace cc | 1143 } // namespace cc |
| OLD | NEW |