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

Side by Side Diff: cc/resources/tile_manager_unittest.cc

Issue 228183002: cc: Move ResourcePool ownership to LTHI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/tile_manager_perftest.cc ('k') | cc/test/fake_picture_layer_tiling_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/resources/tile.h" 5 #include "cc/resources/tile.h"
6 #include "cc/resources/tile_priority.h" 6 #include "cc/resources/tile_priority.h"
7 #include "cc/test/fake_impl_proxy.h" 7 #include "cc/test/fake_impl_proxy.h"
8 #include "cc/test/fake_layer_tree_host_impl.h" 8 #include "cc/test/fake_layer_tree_host_impl.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 22 matching lines...) Expand all
33 void Initialize(int max_tiles, 33 void Initialize(int max_tiles,
34 TileMemoryLimitPolicy memory_limit_policy, 34 TileMemoryLimitPolicy memory_limit_policy,
35 TreePriority tree_priority, 35 TreePriority tree_priority,
36 bool allow_on_demand_raster = true) { 36 bool allow_on_demand_raster = true) {
37 output_surface_ = FakeOutputSurface::Create3d(); 37 output_surface_ = FakeOutputSurface::Create3d();
38 CHECK(output_surface_->BindToClient(&output_surface_client_)); 38 CHECK(output_surface_->BindToClient(&output_surface_client_));
39 39
40 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); 40 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
41 resource_provider_ = ResourceProvider::Create( 41 resource_provider_ = ResourceProvider::Create(
42 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1); 42 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1);
43 resource_pool_ = ResourcePool::Create(
44 resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888);
43 tile_manager_ = make_scoped_ptr(new FakeTileManager( 45 tile_manager_ = make_scoped_ptr(new FakeTileManager(
44 this, resource_provider_.get(), allow_on_demand_raster)); 46 this, resource_pool_.get(), allow_on_demand_raster));
45 47
46 memory_limit_policy_ = memory_limit_policy; 48 memory_limit_policy_ = memory_limit_policy;
47 max_tiles_ = max_tiles; 49 max_tiles_ = max_tiles;
48 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); 50 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile();
49 51
50 SetTreePriority(tree_priority); 52 SetTreePriority(tree_priority);
51 } 53 }
52 54
53 void SetTreePriority(TreePriority tree_priority) { 55 void SetTreePriority(TreePriority tree_priority) {
54 GlobalStateThatImpactsTilePriority state; 56 GlobalStateThatImpactsTilePriority state;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 GlobalStateThatImpactsTilePriority global_state_; 144 GlobalStateThatImpactsTilePriority global_state_;
143 145
144 private: 146 private:
145 LayerTreeSettings settings_; 147 LayerTreeSettings settings_;
146 scoped_ptr<FakeTileManager> tile_manager_; 148 scoped_ptr<FakeTileManager> tile_manager_;
147 scoped_refptr<FakePicturePileImpl> picture_pile_; 149 scoped_refptr<FakePicturePileImpl> picture_pile_;
148 FakeOutputSurfaceClient output_surface_client_; 150 FakeOutputSurfaceClient output_surface_client_;
149 scoped_ptr<FakeOutputSurface> output_surface_; 151 scoped_ptr<FakeOutputSurface> output_surface_;
150 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; 152 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
151 scoped_ptr<ResourceProvider> resource_provider_; 153 scoped_ptr<ResourceProvider> resource_provider_;
154 scoped_ptr<ResourcePool> resource_pool_;
152 TileMemoryLimitPolicy memory_limit_policy_; 155 TileMemoryLimitPolicy memory_limit_policy_;
153 int max_tiles_; 156 int max_tiles_;
154 bool ready_to_activate_; 157 bool ready_to_activate_;
155 }; 158 };
156 159
157 TEST_P(TileManagerTest, EnoughMemoryAllowAnything) { 160 TEST_P(TileManagerTest, EnoughMemoryAllowAnything) {
158 // A few tiles of each type of priority, with enough memory for all tiles. 161 // A few tiles of each type of priority, with enough memory for all tiles.
159 162
160 Initialize(10, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); 163 Initialize(10, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY);
161 TileVector active_now = 164 TileVector active_now =
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 969
967 EXPECT_EQ(tile_count, new_content_tiles.size()); 970 EXPECT_EQ(tile_count, new_content_tiles.size());
968 EXPECT_EQ(all_tiles, new_content_tiles); 971 EXPECT_EQ(all_tiles, new_content_tiles);
969 // Since we don't guarantee increasing distance due to spiral iterator, we 972 // Since we don't guarantee increasing distance due to spiral iterator, we
970 // should check that we're _mostly_ right. 973 // should check that we're _mostly_ right.
971 EXPECT_GT(increasing_distance_tiles, 3 * tile_count / 4); 974 EXPECT_GT(increasing_distance_tiles, 3 * tile_count / 4);
972 } 975 }
973 976
974 } // namespace 977 } // namespace
975 } // namespace cc 978 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager_perftest.cc ('k') | cc/test/fake_picture_layer_tiling_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698