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 3760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3771 active_layer_->HighResTiling()->AllTilesForTesting(); | 3771 active_layer_->HighResTiling()->AllTilesForTesting(); |
3772 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 3772 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
3773 | 3773 |
3774 // Force tiles after max_tiles to be OOM. TileManager uses | 3774 // Force tiles after max_tiles to be OOM. TileManager uses |
3775 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot | 3775 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot |
3776 // directly set state to host_impl_, so we set policy that would change the | 3776 // directly set state to host_impl_, so we set policy that would change the |
3777 // state. We also need to update tree priority separately. | 3777 // state. We also need to update tree priority separately. |
3778 GlobalStateThatImpactsTilePriority state; | 3778 GlobalStateThatImpactsTilePriority state; |
3779 size_t max_tiles = 1; | 3779 size_t max_tiles = 1; |
3780 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); | 3780 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); |
3781 size_t resource_limit = max_tiles; | |
3782 ManagedMemoryPolicy policy(memory_limit, | 3781 ManagedMemoryPolicy policy(memory_limit, |
3783 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 3782 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); |
3784 resource_limit); | |
3785 host_impl_.SetMemoryPolicy(policy); | 3783 host_impl_.SetMemoryPolicy(policy); |
3786 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 3784 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
3787 host_impl_.ManageTiles(); | 3785 host_impl_.ManageTiles(); |
3788 | 3786 |
3789 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3787 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
3790 AppendQuadsData data; | 3788 AppendQuadsData data; |
3791 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); | 3789 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); |
3792 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 3790 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
3793 active_layer_->DidDraw(nullptr); | 3791 active_layer_->DidDraw(nullptr); |
3794 | 3792 |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4742 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4740 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4743 EXPECT_EQ(result.width(), 448); | 4741 EXPECT_EQ(result.width(), 448); |
4744 EXPECT_EQ(result.height(), 448); | 4742 EXPECT_EQ(result.height(), 448); |
4745 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4743 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4746 EXPECT_EQ(result.width(), 512); | 4744 EXPECT_EQ(result.width(), 512); |
4747 EXPECT_EQ(result.height(), 500 + 2); | 4745 EXPECT_EQ(result.height(), 500 + 2); |
4748 } | 4746 } |
4749 | 4747 |
4750 } // namespace | 4748 } // namespace |
4751 } // namespace cc | 4749 } // namespace cc |
OLD | NEW |