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 3806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3817 // state. We also need to update tree priority separately. | 3817 // state. We also need to update tree priority separately. |
3818 GlobalStateThatImpactsTilePriority state; | 3818 GlobalStateThatImpactsTilePriority state; |
3819 size_t max_tiles = 1; | 3819 size_t max_tiles = 1; |
3820 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); | 3820 size_t memory_limit = max_tiles * 4 * tile_size.width() * tile_size.height(); |
3821 size_t resource_limit = max_tiles; | 3821 size_t resource_limit = max_tiles; |
3822 ManagedMemoryPolicy policy(memory_limit, | 3822 ManagedMemoryPolicy policy(memory_limit, |
3823 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 3823 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
3824 resource_limit); | 3824 resource_limit); |
3825 host_impl_.SetMemoryPolicy(policy); | 3825 host_impl_.SetMemoryPolicy(policy); |
3826 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 3826 host_impl_.SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
3827 host_impl_.ManageTiles(); | 3827 host_impl_.PrepareTiles(); |
3828 | 3828 |
3829 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 3829 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
3830 AppendQuadsData data; | 3830 AppendQuadsData data; |
3831 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); | 3831 active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); |
3832 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); | 3832 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); |
3833 active_layer_->DidDraw(nullptr); | 3833 active_layer_->DidDraw(nullptr); |
3834 | 3834 |
3835 // Even when OOM, quads should be produced, and should be different material | 3835 // Even when OOM, quads should be produced, and should be different material |
3836 // from quads with resource. | 3836 // from quads with resource. |
3837 EXPECT_LT(max_tiles, render_pass->quad_list.size()); | 3837 EXPECT_LT(max_tiles, render_pass->quad_list.size()); |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4756 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4756 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4757 EXPECT_EQ(result.width(), 448); | 4757 EXPECT_EQ(result.width(), 448); |
4758 EXPECT_EQ(result.height(), 448); | 4758 EXPECT_EQ(result.height(), 448); |
4759 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4759 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4760 EXPECT_EQ(result.width(), 512); | 4760 EXPECT_EQ(result.width(), 512); |
4761 EXPECT_EQ(result.height(), 500 + 2); | 4761 EXPECT_EQ(result.height(), 500 + 2); |
4762 } | 4762 } |
4763 | 4763 |
4764 } // namespace | 4764 } // namespace |
4765 } // namespace cc | 4765 } // namespace cc |
OLD | NEW |