| 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_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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void CleanUpReleasedTiles(); | 193 void CleanUpReleasedTiles(); |
| 194 | 194 |
| 195 // Overriden from RefCountedManager<Tile>: | 195 // Overriden from RefCountedManager<Tile>: |
| 196 friend class Tile; | 196 friend class Tile; |
| 197 void Release(Tile* tile) override; | 197 void Release(Tile* tile) override; |
| 198 | 198 |
| 199 // Overriden from TileTaskRunnerClient: | 199 // Overriden from TileTaskRunnerClient: |
| 200 void DidFinishRunningTileTasks(TaskSet task_set) override; | 200 void DidFinishRunningTileTasks(TaskSet task_set) override; |
| 201 TaskSetCollection TasksThatShouldBeForcedToComplete() const override; | 201 TaskSetCollection TasksThatShouldBeForcedToComplete() const override; |
| 202 | 202 |
| 203 typedef std::vector<Tile*> TileVector; | 203 typedef std::vector<PrioritizedTile> PrioritizedTileVector; |
| 204 typedef std::set<Tile*> TileSet; | 204 typedef std::set<Tile*> TileSet; |
| 205 | 205 |
| 206 // Virtual for test | 206 // Virtual for test |
| 207 virtual void ScheduleTasks( | 207 virtual void ScheduleTasks( |
| 208 const TileVector& tiles_that_need_to_be_rasterized); | 208 const PrioritizedTileVector& tiles_that_need_to_be_rasterized); |
| 209 | 209 |
| 210 void AssignGpuMemoryToTiles(RasterTilePriorityQueue* raster_priority_queue, | 210 void AssignGpuMemoryToTiles( |
| 211 size_t scheduled_raser_task_limit, | 211 RasterTilePriorityQueue* raster_priority_queue, |
| 212 TileVector* tiles_that_need_to_be_rasterized); | 212 size_t scheduled_raser_task_limit, |
| 213 PrioritizedTileVector* tiles_that_need_to_be_rasterized); |
| 213 | 214 |
| 214 private: | 215 private: |
| 215 class MemoryUsage { | 216 class MemoryUsage { |
| 216 public: | 217 public: |
| 217 MemoryUsage(); | 218 MemoryUsage(); |
| 218 MemoryUsage(int64 memory_bytes, int resource_count); | 219 MemoryUsage(int64 memory_bytes, int resource_count); |
| 219 | 220 |
| 220 static MemoryUsage FromConfig(const gfx::Size& size, ResourceFormat format); | 221 static MemoryUsage FromConfig(const gfx::Size& size, ResourceFormat format); |
| 221 static MemoryUsage FromTile(const Tile* tile); | 222 static MemoryUsage FromTile(const Tile* tile); |
| 222 | 223 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 240 const RasterSource::SolidColorAnalysis& analysis, | 241 const RasterSource::SolidColorAnalysis& analysis, |
| 241 bool was_canceled); | 242 bool was_canceled); |
| 242 void UpdateTileDrawInfo(Tile* tile, | 243 void UpdateTileDrawInfo(Tile* tile, |
| 243 scoped_ptr<ScopedResource> resource, | 244 scoped_ptr<ScopedResource> resource, |
| 244 const RasterSource::SolidColorAnalysis& analysis); | 245 const RasterSource::SolidColorAnalysis& analysis); |
| 245 | 246 |
| 246 void FreeResourcesForTile(Tile* tile); | 247 void FreeResourcesForTile(Tile* tile); |
| 247 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 248 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
| 248 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | 249 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, |
| 249 SkPixelRef* pixel_ref); | 250 SkPixelRef* pixel_ref); |
| 250 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); | 251 scoped_refptr<RasterTask> CreateRasterTask( |
| 252 const PrioritizedTile& prioritized_tile); |
| 251 | 253 |
| 252 scoped_ptr<EvictionTilePriorityQueue> | 254 scoped_ptr<EvictionTilePriorityQueue> |
| 253 FreeTileResourcesUntilUsageIsWithinLimit( | 255 FreeTileResourcesUntilUsageIsWithinLimit( |
| 254 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 256 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
| 255 const MemoryUsage& limit, | 257 const MemoryUsage& limit, |
| 256 MemoryUsage* usage); | 258 MemoryUsage* usage); |
| 257 scoped_ptr<EvictionTilePriorityQueue> | 259 scoped_ptr<EvictionTilePriorityQueue> |
| 258 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 260 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
| 259 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 261 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
| 260 const MemoryUsage& limit, | 262 const MemoryUsage& limit, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 309 |
| 308 bool did_notify_ready_to_activate_; | 310 bool did_notify_ready_to_activate_; |
| 309 bool did_notify_ready_to_draw_; | 311 bool did_notify_ready_to_draw_; |
| 310 | 312 |
| 311 DISALLOW_COPY_AND_ASSIGN(TileManager); | 313 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 312 }; | 314 }; |
| 313 | 315 |
| 314 } // namespace cc | 316 } // namespace cc |
| 315 | 317 |
| 316 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 318 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |