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

Side by Side Diff: cc/resources/tile_manager.h

Issue 860813002: Remove the default format from ResourcePool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error in perftest. Created 5 years, 11 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #ifndef CC_RESOURCES_TILE_MANAGER_H_ 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_
6 #define CC_RESOURCES_TILE_MANAGER_H_ 6 #define CC_RESOURCES_TILE_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Adding additional values requires increasing kNumberOfTaskSets in 98 // Adding additional values requires increasing kNumberOfTaskSets in
99 // rasterizer.h 99 // rasterizer.h
100 }; 100 };
101 101
102 COMPILE_ASSERT(NamedTaskSet::ALL == (kNumberOfTaskSets - 1), 102 COMPILE_ASSERT(NamedTaskSet::ALL == (kNumberOfTaskSets - 1),
103 NamedTaskSet_ALL_not_kNumberOfTaskSets_minus_1); 103 NamedTaskSet_ALL_not_kNumberOfTaskSets_minus_1);
104 104
105 static scoped_ptr<TileManager> Create(TileManagerClient* client, 105 static scoped_ptr<TileManager> Create(TileManagerClient* client,
106 base::SequencedTaskRunner* task_runner, 106 base::SequencedTaskRunner* task_runner,
107 ResourcePool* resource_pool, 107 ResourcePool* resource_pool,
108 ResourceFormat resource_format,
108 TileTaskRunner* tile_task_runner, 109 TileTaskRunner* tile_task_runner,
109 Rasterizer* rasterizer, 110 Rasterizer* rasterizer,
110 size_t scheduled_raster_task_limit); 111 size_t scheduled_raster_task_limit);
111 ~TileManager() override; 112 ~TileManager() override;
112 113
113 // Assigns tile memory and schedules work to prepare tiles for drawing. 114 // Assigns tile memory and schedules work to prepare tiles for drawing.
114 // - Runs client_->NotifyReadyToActivate() when all tiles required for 115 // - Runs client_->NotifyReadyToActivate() when all tiles required for
115 // activation are prepared, or failed to prepare due to OOM. 116 // activation are prepared, or failed to prepare due to OOM.
116 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are 117 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are
117 // prepared, or failed to prepare due to OOM. 118 // prepared, or failed to prepare due to OOM.
(...skipping 14 matching lines...) Expand all
132 void BasicStateAsValueInto(base::debug::TracedValue* dict) const; 133 void BasicStateAsValueInto(base::debug::TracedValue* dict) const;
133 const MemoryHistory::Entry& memory_stats_from_last_assign() const { 134 const MemoryHistory::Entry& memory_stats_from_last_assign() const {
134 return memory_stats_from_last_assign_; 135 return memory_stats_from_last_assign_;
135 } 136 }
136 137
137 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { 138 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) {
138 for (size_t i = 0; i < tiles.size(); ++i) { 139 for (size_t i = 0; i < tiles.size(); ++i) {
139 TileDrawInfo& draw_info = tiles[i]->draw_info(); 140 TileDrawInfo& draw_info = tiles[i]->draw_info();
140 draw_info.resource_ = 141 draw_info.resource_ =
141 resource_pool_->AcquireResource(tiles[i]->desired_texture_size(), 142 resource_pool_->AcquireResource(tiles[i]->desired_texture_size(),
142 resource_pool_->default_format()); 143 resource_format_);
143 } 144 }
144 } 145 }
145 146
146 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { 147 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) {
147 for (size_t i = 0; i < tiles.size(); ++i) { 148 for (size_t i = 0; i < tiles.size(); ++i) {
148 Tile* tile = tiles[i]; 149 Tile* tile = tiles[i];
149 FreeResourcesForTile(tile); 150 FreeResourcesForTile(tile);
150 } 151 }
151 } 152 }
152 153
(...skipping 19 matching lines...) Expand all
172 } 173 }
173 174
174 void SetScheduledRasterTaskLimitForTesting(size_t limit) { 175 void SetScheduledRasterTaskLimitForTesting(size_t limit) {
175 scheduled_raster_task_limit_ = limit; 176 scheduled_raster_task_limit_ = limit;
176 } 177 }
177 178
178 protected: 179 protected:
179 TileManager(TileManagerClient* client, 180 TileManager(TileManagerClient* client,
180 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 181 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
181 ResourcePool* resource_pool, 182 ResourcePool* resource_pool,
183 ResourceFormat resource_format,
182 TileTaskRunner* tile_task_runner, 184 TileTaskRunner* tile_task_runner,
183 Rasterizer* rasterizer, 185 Rasterizer* rasterizer,
184 size_t scheduled_raster_task_limit); 186 size_t scheduled_raster_task_limit);
185 187
186 void FreeResourcesForReleasedTiles(); 188 void FreeResourcesForReleasedTiles();
187 void CleanUpReleasedTiles(); 189 void CleanUpReleasedTiles();
188 190
189 // Overriden from RefCountedManager<Tile>: 191 // Overriden from RefCountedManager<Tile>:
190 friend class Tile; 192 friend class Tile;
191 void Release(Tile* tile) override; 193 void Release(Tile* tile) override;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 312
311 bool did_notify_ready_to_activate_; 313 bool did_notify_ready_to_activate_;
312 bool did_notify_ready_to_draw_; 314 bool did_notify_ready_to_draw_;
313 315
314 DISALLOW_COPY_AND_ASSIGN(TileManager); 316 DISALLOW_COPY_AND_ASSIGN(TileManager);
315 }; 317 };
316 318
317 } // namespace cc 319 } // namespace cc
318 320
319 #endif // CC_RESOURCES_TILE_MANAGER_H_ 321 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698