| 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 <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "cc/debug/rendering_stats_instrumentation.h" | 15 #include "cc/debug/rendering_stats_instrumentation.h" |
| 16 #include "cc/resources/memory_history.h" | 16 #include "cc/resources/memory_history.h" |
| 17 #include "cc/resources/picture_pile_impl.h" | 17 #include "cc/resources/picture_pile_impl.h" |
| 18 #include "cc/resources/raster_worker_pool.h" | 18 #include "cc/resources/raster_worker_pool.h" |
| 19 #include "cc/resources/resource_pool.h" | 19 #include "cc/resources/resource_pool.h" |
| 20 #include "cc/resources/tile_priority.h" | 20 #include "cc/resources/tile_priority.h" |
| 21 | 21 |
| 22 namespace cc { | 22 namespace cc { |
| 23 class ResourceProvider; | 23 class ResourceProvider; |
| 24 class Tile; | 24 class Tile; |
| 25 class TileVersion; | 25 class TileVersion; |
| 26 | 26 |
| 27 // Low quality implies no lcd test; |
| 28 // high quality implies lcd text. |
| 29 // Note that the order of these matters, from "better" to "worse" in terms of |
| 30 // quality. |
| 31 enum TileRasterMode { |
| 32 HIGH_QUALITY_RASTER_MODE = 0, |
| 33 HIGH_QUALITY_NO_LCD_RASTER_MODE = 1, |
| 34 LOW_QUALITY_RASTER_MODE = 2, |
| 35 NUM_RASTER_MODES = 3 |
| 36 }; |
| 37 |
| 27 class CC_EXPORT TileManagerClient { | 38 class CC_EXPORT TileManagerClient { |
| 28 public: | 39 public: |
| 29 virtual void ScheduleManageTiles() = 0; | 40 virtual void ScheduleManageTiles() = 0; |
| 30 virtual void DidInitializeVisibleTile() = 0; | 41 virtual void DidInitializeVisibleTile() = 0; |
| 31 virtual bool | 42 virtual bool |
| 32 ShouldForceTileUploadsRequiredForActivationToComplete() const = 0; | 43 ShouldForceTileUploadsRequiredForActivationToComplete() const = 0; |
| 33 | 44 |
| 34 protected: | 45 protected: |
| 35 virtual ~TileManagerClient() {} | 46 virtual ~TileManagerClient() {} |
| 36 }; | 47 }; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 128 |
| 118 private: | 129 private: |
| 119 // Data that is passed to raster tasks. | 130 // Data that is passed to raster tasks. |
| 120 struct RasterTaskMetadata { | 131 struct RasterTaskMetadata { |
| 121 scoped_ptr<base::Value> AsValue() const; | 132 scoped_ptr<base::Value> AsValue() const; |
| 122 bool is_tile_in_pending_tree_now_bin; | 133 bool is_tile_in_pending_tree_now_bin; |
| 123 TileResolution tile_resolution; | 134 TileResolution tile_resolution; |
| 124 int layer_id; | 135 int layer_id; |
| 125 const void* tile_id; | 136 const void* tile_id; |
| 126 int source_frame_number; | 137 int source_frame_number; |
| 138 TileRasterMode raster_mode; |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 void AssignBinsToTiles(); | 141 void AssignBinsToTiles(); |
| 130 void SortTiles(); | 142 void SortTiles(); |
| 143 TileRasterMode DetermineRasterMode(const Tile* tile) const; |
| 131 void AssignGpuMemoryToTiles(); | 144 void AssignGpuMemoryToTiles(); |
| 132 void FreeResourcesForTile(Tile* tile); | 145 void FreeResourcesForTile(Tile* tile); |
| 146 void FreeUnusedResourcesForTile(Tile* tile); |
| 133 void ScheduleManageTiles() { | 147 void ScheduleManageTiles() { |
| 134 if (manage_tiles_pending_) | 148 if (manage_tiles_pending_) |
| 135 return; | 149 return; |
| 136 client_->ScheduleManageTiles(); | 150 client_->ScheduleManageTiles(); |
| 137 manage_tiles_pending_ = true; | 151 manage_tiles_pending_ = true; |
| 138 } | 152 } |
| 139 RasterWorkerPool::Task CreateImageDecodeTask( | 153 RasterWorkerPool::Task CreateImageDecodeTask( |
| 140 Tile* tile, skia::LazyPixelRef* pixel_ref); | 154 Tile* tile, skia::LazyPixelRef* pixel_ref); |
| 141 void OnImageDecodeTaskCompleted( | 155 void OnImageDecodeTaskCompleted( |
| 142 scoped_refptr<Tile> tile, | 156 scoped_refptr<Tile> tile, |
| 143 uint32_t pixel_ref_id); | 157 uint32_t pixel_ref_id); |
| 144 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; | 158 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; |
| 145 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); | 159 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); |
| 146 void OnRasterTaskCompleted( | 160 void OnRasterTaskCompleted( |
| 147 scoped_refptr<Tile> tile, | 161 scoped_refptr<Tile> tile, |
| 148 scoped_ptr<ResourcePool::Resource> resource, | 162 scoped_ptr<ResourcePool::Resource> resource, |
| 149 PicturePileImpl::Analysis* analysis, | 163 PicturePileImpl::Analysis* analysis, |
| 164 TileRasterMode raster_mode, |
| 150 bool was_canceled); | 165 bool was_canceled); |
| 151 void DidFinishTileInitialization(Tile* tile); | 166 void DidFinishTileInitialization(Tile* tile); |
| 152 void DidTileTreeBinChange(Tile* tile, | 167 void DidTileTreeBinChange(Tile* tile, |
| 153 TileManagerBin new_tree_bin, | 168 TileManagerBin new_tree_bin, |
| 154 WhichTree tree); | 169 WhichTree tree); |
| 155 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; | 170 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; |
| 156 void AddRequiredTileForActivation(Tile* tile); | 171 void AddRequiredTileForActivation(Tile* tile); |
| 157 | 172 |
| 158 static void RunImageDecodeTask( | 173 static void RunImageDecodeTask( |
| 159 skia::LazyPixelRef* pixel_ref, | 174 skia::LazyPixelRef* pixel_ref, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 219 |
| 205 bool use_color_estimator_; | 220 bool use_color_estimator_; |
| 206 bool did_initialize_visible_tile_; | 221 bool did_initialize_visible_tile_; |
| 207 | 222 |
| 208 DISALLOW_COPY_AND_ASSIGN(TileManager); | 223 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 209 }; | 224 }; |
| 210 | 225 |
| 211 } // namespace cc | 226 } // namespace cc |
| 212 | 227 |
| 213 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 228 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |