| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "cc/base/ref_counted_managed.h" | 17 #include "cc/base/ref_counted_managed.h" |
| 18 #include "cc/base/unique_notifier.h" | 18 #include "cc/base/unique_notifier.h" |
| 19 #include "cc/debug/rendering_stats_instrumentation.h" | 19 #include "cc/debug/rendering_stats_instrumentation.h" |
| 20 #include "cc/resources/eviction_tile_priority_queue.h" | 20 #include "cc/resources/eviction_tile_priority_queue.h" |
| 21 #include "cc/resources/managed_tile_state.h" | 21 #include "cc/resources/managed_tile_state.h" |
| 22 #include "cc/resources/memory_history.h" | 22 #include "cc/resources/memory_history.h" |
| 23 #include "cc/resources/picture_pile_impl.h" | 23 #include "cc/resources/raster_source.h" |
| 24 #include "cc/resources/raster_tile_priority_queue.h" | 24 #include "cc/resources/raster_tile_priority_queue.h" |
| 25 #include "cc/resources/rasterizer.h" | 25 #include "cc/resources/rasterizer.h" |
| 26 #include "cc/resources/resource_pool.h" | 26 #include "cc/resources/resource_pool.h" |
| 27 #include "cc/resources/tile.h" | 27 #include "cc/resources/tile.h" |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| 30 namespace debug { | 30 namespace debug { |
| 31 class ConvertableToTraceFormat; | 31 class ConvertableToTraceFormat; |
| 32 class TracedValue; | 32 class TracedValue; |
| 33 } | 33 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Rasterizer* rasterizer, | 100 Rasterizer* rasterizer, |
| 101 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 101 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 102 size_t scheduled_raster_task_limit); | 102 size_t scheduled_raster_task_limit); |
| 103 ~TileManager() override; | 103 ~TileManager() override; |
| 104 | 104 |
| 105 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); | 105 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); |
| 106 | 106 |
| 107 // Returns true when visible tiles have been initialized. | 107 // Returns true when visible tiles have been initialized. |
| 108 bool UpdateVisibleTiles(); | 108 bool UpdateVisibleTiles(); |
| 109 | 109 |
| 110 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, | 110 scoped_refptr<Tile> CreateTile(RasterSource* raster_source, |
| 111 const gfx::Size& tile_size, | 111 const gfx::Size& tile_size, |
| 112 const gfx::Rect& content_rect, | 112 const gfx::Rect& content_rect, |
| 113 float contents_scale, | 113 float contents_scale, |
| 114 int layer_id, | 114 int layer_id, |
| 115 int source_frame_number, | 115 int source_frame_number, |
| 116 int flags); | 116 int flags); |
| 117 | 117 |
| 118 scoped_refptr<base::debug::ConvertableToTraceFormat> BasicStateAsValue() | 118 scoped_refptr<base::debug::ConvertableToTraceFormat> BasicStateAsValue() |
| 119 const; | 119 const; |
| 120 void BasicStateAsValueInto(base::debug::TracedValue* dict) const; | 120 void BasicStateAsValueInto(base::debug::TracedValue* dict) const; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 private: | 206 private: |
| 207 int64 memory_bytes_; | 207 int64 memory_bytes_; |
| 208 int resource_count_; | 208 int resource_count_; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 void OnImageDecodeTaskCompleted(int layer_id, | 211 void OnImageDecodeTaskCompleted(int layer_id, |
| 212 SkPixelRef* pixel_ref, | 212 SkPixelRef* pixel_ref, |
| 213 bool was_canceled); | 213 bool was_canceled); |
| 214 void OnRasterTaskCompleted(Tile::Id tile, | 214 void OnRasterTaskCompleted(Tile::Id tile, |
| 215 scoped_ptr<ScopedResource> resource, | 215 scoped_ptr<ScopedResource> resource, |
| 216 const PicturePileImpl::Analysis& analysis, | 216 const RasterSource::Analysis& analysis, |
| 217 bool was_canceled); | 217 bool was_canceled); |
| 218 | 218 |
| 219 void FreeResourcesForTile(Tile* tile); | 219 void FreeResourcesForTile(Tile* tile); |
| 220 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 220 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
| 221 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | 221 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, |
| 222 SkPixelRef* pixel_ref); | 222 SkPixelRef* pixel_ref); |
| 223 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); | 223 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
| 224 | 224 |
| 225 void RebuildEvictionQueueIfNeeded(); | 225 void RebuildEvictionQueueIfNeeded(); |
| 226 bool FreeTileResourcesUntilUsageIsWithinLimit(const MemoryUsage& limit, | 226 bool FreeTileResourcesUntilUsageIsWithinLimit(const MemoryUsage& limit, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 RasterTilePriorityQueue raster_priority_queue_; | 276 RasterTilePriorityQueue raster_priority_queue_; |
| 277 EvictionTilePriorityQueue eviction_priority_queue_; | 277 EvictionTilePriorityQueue eviction_priority_queue_; |
| 278 bool eviction_priority_queue_is_up_to_date_; | 278 bool eviction_priority_queue_is_up_to_date_; |
| 279 | 279 |
| 280 DISALLOW_COPY_AND_ASSIGN(TileManager); | 280 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 } // namespace cc | 283 } // namespace cc |
| 284 | 284 |
| 285 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 285 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |