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 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3671 active_layer_->HighResTiling()->AllTilesForTesting(); | 3671 active_layer_->HighResTiling()->AllTilesForTesting(); |
3672 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 3672 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
3673 | 3673 |
3674 // Force tiles after max_tiles to be OOM. TileManager uses | 3674 // Force tiles after max_tiles to be OOM. TileManager uses |
3675 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot | 3675 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot |
3676 // directly set state to host_impl_, so we set policy that would change the | 3676 // directly set state to host_impl_, so we set policy that would change the |
3677 // state. We also need to update tree priority separately. | 3677 // state. We also need to update tree priority separately. |
3678 GlobalStateThatImpactsTilePriority state; | 3678 GlobalStateThatImpactsTilePriority state; |
3679 size_t max_tiles = 1; | 3679 size_t max_tiles = 1; |
3680 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); | 3680 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); |
3681 size_t resource_limit = max_tiles; | |
3682 ManagedMemoryPolicy policy(memory_limit, | 3681 ManagedMemoryPolicy policy(memory_limit, |
3683 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 3682 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); |
3684 resource_limit); | |
3685 host_impl_.SetMemoryPolicy(policy); | 3683 host_impl_.SetMemoryPolicy(policy); |
3686 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 3684 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
3687 host_impl_.ManageTiles(); | 3685 host_impl_.ManageTiles(); |
3688 | 3686 |
3689 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3687 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
3690 AppendQuadsData data; | 3688 AppendQuadsData data; |
3691 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); | 3689 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); |
3692 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 3690 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
3693 active_layer_->DidDraw(nullptr); | 3691 active_layer_->DidDraw(nullptr); |
3694 | 3692 |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4611 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4614 EXPECT_EQ(result.width(), 448); | 4612 EXPECT_EQ(result.width(), 448); |
4615 EXPECT_EQ(result.height(), 448); | 4613 EXPECT_EQ(result.height(), 448); |
4616 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4614 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4617 EXPECT_EQ(result.width(), 512); | 4615 EXPECT_EQ(result.width(), 512); |
4618 EXPECT_EQ(result.height(), 500 + 2); | 4616 EXPECT_EQ(result.height(), 500 + 2); |
4619 } | 4617 } |
4620 | 4618 |
4621 } // namespace | 4619 } // namespace |
4622 } // namespace cc | 4620 } // namespace cc |
OLD | NEW |