Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 643993005: Remove limit on number of resources in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698