OLD | NEW |
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_TILES_TILE_MANAGER_H_ | 5 #ifndef CC_TILES_TILE_MANAGER_H_ |
6 #define CC_TILES_TILE_MANAGER_H_ | 6 #define CC_TILES_TILE_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 147 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
148 return memory_stats_from_last_assign_; | 148 return memory_stats_from_last_assign_; |
149 } | 149 } |
150 | 150 |
151 // Public methods for testing. | 151 // Public methods for testing. |
152 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 152 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
153 for (size_t i = 0; i < tiles.size(); ++i) { | 153 for (size_t i = 0; i < tiles.size(); ++i) { |
154 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 154 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
155 draw_info.resource_ = resource_pool_->AcquireResource( | 155 draw_info.resource_ = resource_pool_->AcquireResource( |
156 tiles[i]->desired_texture_size(), | 156 tiles[i]->desired_texture_size(), |
157 tile_task_runner_->GetResourceFormat()); | 157 tile_task_runner_->GetResourceFormat(false)); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 161 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
162 for (size_t i = 0; i < tiles.size(); ++i) { | 162 for (size_t i = 0; i < tiles.size(); ++i) { |
163 Tile* tile = tiles[i]; | 163 Tile* tile = tiles[i]; |
164 FreeResourcesForTile(tile); | 164 FreeResourcesForTile(tile); |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 273 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
274 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 274 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
275 const MemoryUsage& limit, | 275 const MemoryUsage& limit, |
276 const TilePriority& oother_priority, | 276 const TilePriority& oother_priority, |
277 MemoryUsage* usage); | 277 MemoryUsage* usage); |
278 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); | 278 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
279 bool AreRequiredTilesReadyToDraw(RasterTilePriorityQueue::Type type) const; | 279 bool AreRequiredTilesReadyToDraw(RasterTilePriorityQueue::Type type) const; |
280 void CheckIfMoreTilesNeedToBePrepared(); | 280 void CheckIfMoreTilesNeedToBePrepared(); |
281 void CheckAndIssueSignals(); | 281 void CheckAndIssueSignals(); |
282 | 282 |
| 283 ResourceFormat DetermineResourceFormat(const Tile* tile) const; |
| 284 bool DetermineResourceRequiresSwizzle(const Tile* tile) const; |
| 285 |
283 TileManagerClient* client_; | 286 TileManagerClient* client_; |
284 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 287 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
285 ResourcePool* resource_pool_; | 288 ResourcePool* resource_pool_; |
286 TileTaskRunner* tile_task_runner_; | 289 TileTaskRunner* tile_task_runner_; |
287 GlobalStateThatImpactsTilePriority global_state_; | 290 GlobalStateThatImpactsTilePriority global_state_; |
288 size_t scheduled_raster_task_limit_; | 291 size_t scheduled_raster_task_limit_; |
289 | 292 |
290 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 293 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
291 TileMap tiles_; | 294 TileMap tiles_; |
292 | 295 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 331 |
329 uint64_t prepare_tiles_count_; | 332 uint64_t prepare_tiles_count_; |
330 uint64_t next_tile_id_; | 333 uint64_t next_tile_id_; |
331 | 334 |
332 DISALLOW_COPY_AND_ASSIGN(TileManager); | 335 DISALLOW_COPY_AND_ASSIGN(TileManager); |
333 }; | 336 }; |
334 | 337 |
335 } // namespace cc | 338 } // namespace cc |
336 | 339 |
337 #endif // CC_TILES_TILE_MANAGER_H_ | 340 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |