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