| 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_TILE_MANAGER_H_ | 5 #ifndef CC_TILE_MANAGER_H_ |
| 6 #define CC_TILE_MANAGER_H_ | 6 #define CC_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 enum TileManagerBinPriority { | 50 enum TileManagerBinPriority { |
| 51 HIGH_PRIORITY_BIN = 0, | 51 HIGH_PRIORITY_BIN = 0, |
| 52 LOW_PRIORITY_BIN = 1, | 52 LOW_PRIORITY_BIN = 1, |
| 53 NUM_BIN_PRIORITIES = 2 | 53 NUM_BIN_PRIORITIES = 2 |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 enum TileRasterState { | 56 enum TileRasterState { |
| 57 IDLE_STATE = 0, | 57 IDLE_STATE = 0, |
| 58 WAITING_FOR_RASTER_STATE = 1, | 58 WAITING_FOR_RASTER_STATE = 1, |
| 59 RASTER_STATE = 2, | 59 RASTER_STATE = 2, |
| 60 SET_PIXELS_STATE = 3, | 60 UPLOAD_STATE = 3, |
| 61 NUM_STATES = 4 | 61 NUM_STATES = 4 |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 enum TileUploadMethod { |
| 65 TILE_UPLOAD_ASYNC = 0, |
| 66 TILE_UPLOAD_SYNC = 1 |
| 67 }; |
| 68 |
| 64 // This is state that is specific to a tile that is | 69 // This is state that is specific to a tile that is |
| 65 // managed by the TileManager. | 70 // managed by the TileManager. |
| 66 class CC_EXPORT ManagedTileState { | 71 class CC_EXPORT ManagedTileState { |
| 67 public: | 72 public: |
| 68 ManagedTileState(); | 73 ManagedTileState(); |
| 69 ~ManagedTileState(); | 74 ~ManagedTileState(); |
| 70 | 75 |
| 71 // Persisted state: valid all the time. | 76 // Persisted state: valid all the time. |
| 72 bool can_use_gpu_memory; | 77 bool can_use_gpu_memory; |
| 73 bool can_be_freed; | 78 bool can_be_freed; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void OnImageDecodeTaskCompleted( | 153 void OnImageDecodeTaskCompleted( |
| 149 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); | 154 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); |
| 150 bool CanDispatchRasterTask(Tile* tile) const; | 155 bool CanDispatchRasterTask(Tile* tile) const; |
| 151 bool CanPerformCheapRaster(Tile* tile) const; | 156 bool CanPerformCheapRaster(Tile* tile) const; |
| 152 scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile); | 157 scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile); |
| 153 void DispatchOneRasterTask(scoped_refptr<Tile> tile); | 158 void DispatchOneRasterTask(scoped_refptr<Tile> tile); |
| 154 void PerformOneCheapRaster(Tile* tile); | 159 void PerformOneCheapRaster(Tile* tile); |
| 155 void OnRasterCompleted( | 160 void OnRasterCompleted( |
| 156 scoped_refptr<Tile> tile, | 161 scoped_refptr<Tile> tile, |
| 157 scoped_ptr<ResourcePool::Resource> resource, | 162 scoped_ptr<ResourcePool::Resource> resource, |
| 158 int manage_tiles_call_count_when_dispatched); | 163 int manage_tiles_call_count_when_dispatched, |
| 164 TileUploadMethod upload_method); |
| 159 void OnRasterTaskCompleted( | 165 void OnRasterTaskCompleted( |
| 160 scoped_refptr<Tile> tile, | 166 scoped_refptr<Tile> tile, |
| 161 scoped_ptr<ResourcePool::Resource> resource, | 167 scoped_ptr<ResourcePool::Resource> resource, |
| 162 int manage_tiles_call_count_when_dispatched); | 168 int manage_tiles_call_count_when_dispatched); |
| 163 void DidFinishTileInitialization(Tile* tile); | 169 void DidFinishTileInitialization(Tile* tile); |
| 164 void DidTileRasterStateChange(Tile* tile, TileRasterState state); | 170 void DidTileRasterStateChange(Tile* tile, TileRasterState state); |
| 165 void DidTileBinChange(Tile* tile, | 171 void DidTileBinChange(Tile* tile, |
| 166 TileManagerBin bin, | 172 TileManagerBin bin, |
| 167 WhichTree tree); | 173 WhichTree tree); |
| 174 void DidCompleteTileUpload(Tile* tile); |
| 168 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; | 175 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; |
| 169 | 176 |
| 170 static void PerformRaster(uint8* buffer, | 177 static void PerformRaster(uint8* buffer, |
| 171 const gfx::Rect& rect, | 178 const gfx::Rect& rect, |
| 172 float contents_scale, | 179 float contents_scale, |
| 173 bool use_cheapness_estimator, | 180 bool use_cheapness_estimator, |
| 174 PicturePileImpl* picture_pile, | 181 PicturePileImpl* picture_pile, |
| 175 RenderingStats* stats); | 182 RenderingStats* stats); |
| 176 static void PerformImageDecode(skia::LazyPixelRef* pixel_ref, | 183 static void PerformImageDecode(skia::LazyPixelRef* pixel_ref, |
| 177 RenderingStats* stats); | 184 RenderingStats* stats); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 193 | 200 |
| 194 typedef std::list<Tile*> TileList; | 201 typedef std::list<Tile*> TileList; |
| 195 // Tiles with image decoding tasks. These tiles need to be rasterized | 202 // Tiles with image decoding tasks. These tiles need to be rasterized |
| 196 // when all the image decoding tasks finish. | 203 // when all the image decoding tasks finish. |
| 197 TileList tiles_with_image_decoding_tasks_; | 204 TileList tiles_with_image_decoding_tasks_; |
| 198 | 205 |
| 199 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; | 206 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; |
| 200 PixelRefMap pending_decode_tasks_; | 207 PixelRefMap pending_decode_tasks_; |
| 201 | 208 |
| 202 typedef std::queue<scoped_refptr<Tile> > TileQueue; | 209 typedef std::queue<scoped_refptr<Tile> > TileQueue; |
| 203 TileQueue tiles_with_pending_set_pixels_; | 210 TileQueue tiles_with_pending_upload_; |
| 204 size_t bytes_pending_set_pixels_; | 211 size_t bytes_pending_upload_; |
| 205 bool ever_exceeded_memory_budget_; | 212 bool ever_exceeded_memory_budget_; |
| 206 MemoryHistory::Entry memory_stats_from_last_assign_; | 213 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 207 | 214 |
| 208 bool record_rendering_stats_; | 215 bool record_rendering_stats_; |
| 209 RenderingStats rendering_stats_; | 216 RenderingStats rendering_stats_; |
| 210 | 217 |
| 211 bool use_cheapness_estimator_; | 218 bool use_cheapness_estimator_; |
| 212 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 219 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
| 213 | 220 |
| 214 DISALLOW_COPY_AND_ASSIGN(TileManager); | 221 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 215 }; | 222 }; |
| 216 | 223 |
| 217 } // namespace cc | 224 } // namespace cc |
| 218 | 225 |
| 219 #endif // CC_TILE_MANAGER_H_ | 226 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |