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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 3694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3705 active_layer_->HighResTiling()->AllTilesForTesting(); | 3705 active_layer_->HighResTiling()->AllTilesForTesting(); |
3706 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 3706 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
3707 | 3707 |
3708 // Force tiles after max_tiles to be OOM. TileManager uses | 3708 // Force tiles after max_tiles to be OOM. TileManager uses |
3709 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot | 3709 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot |
3710 // directly set state to host_impl_, so we set policy that would change the | 3710 // directly set state to host_impl_, so we set policy that would change the |
3711 // state. We also need to update tree priority separately. | 3711 // state. We also need to update tree priority separately. |
3712 GlobalStateThatImpactsTilePriority state; | 3712 GlobalStateThatImpactsTilePriority state; |
3713 size_t max_tiles = 1; | 3713 size_t max_tiles = 1; |
3714 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); | 3714 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); |
3715 size_t resource_limit = max_tiles; | |
3716 ManagedMemoryPolicy policy(memory_limit, | 3715 ManagedMemoryPolicy policy(memory_limit, |
3717 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 3716 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); |
3718 resource_limit); | |
3719 host_impl_.SetMemoryPolicy(policy); | 3717 host_impl_.SetMemoryPolicy(policy); |
3720 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 3718 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
3721 host_impl_.ManageTiles(); | 3719 host_impl_.ManageTiles(); |
3722 | 3720 |
3723 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3721 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
3724 AppendQuadsData data; | 3722 AppendQuadsData data; |
3725 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); | 3723 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); |
3726 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 3724 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
3727 active_layer_->DidDraw(nullptr); | 3725 active_layer_->DidDraw(nullptr); |
3728 | 3726 |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4647 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4645 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4648 EXPECT_EQ(result.width(), 448); | 4646 EXPECT_EQ(result.width(), 448); |
4649 EXPECT_EQ(result.height(), 448); | 4647 EXPECT_EQ(result.height(), 448); |
4650 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4648 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4651 EXPECT_EQ(result.width(), 512); | 4649 EXPECT_EQ(result.width(), 512); |
4652 EXPECT_EQ(result.height(), 500 + 2); | 4650 EXPECT_EQ(result.height(), 500 + 2); |
4653 } | 4651 } |
4654 | 4652 |
4655 } // namespace | 4653 } // namespace |
4656 } // namespace cc | 4654 } // namespace cc |
OLD | NEW |