Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 | 88 |
| 89 // This class manages tiles, deciding which should get rasterized and which | 89 // This class manages tiles, deciding which should get rasterized and which |
| 90 // should no longer have any memory assigned to them. Tile objects are "owned" | 90 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 91 // by layers; they automatically register with the manager when they are | 91 // by layers; they automatically register with the manager when they are |
| 92 // created, and unregister from the manager when they are deleted. | 92 // created, and unregister from the manager when they are deleted. |
| 93 class CC_EXPORT TileManager { | 93 class CC_EXPORT TileManager { |
| 94 public: | 94 public: |
| 95 TileManager(TileManagerClient* client, | 95 TileManager(TileManagerClient* client, |
| 96 ResourceProvider *resource_provider, | 96 ResourceProvider *resource_provider, |
| 97 size_t num_raster_threads, | 97 size_t num_raster_threads, |
| 98 bool record_rendering_stats); | 98 bool record_rendering_stats, |
| 99 bool use_cheapess_estimator); | |
| 99 virtual ~TileManager(); | 100 virtual ~TileManager(); |
| 100 | 101 |
| 101 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 102 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
| 102 return global_state_; | 103 return global_state_; |
| 103 } | 104 } |
| 104 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 105 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
| 105 | 106 |
| 106 void ManageTiles(); | 107 void ManageTiles(); |
| 107 void CheckForCompletedTileUploads(); | 108 void CheckForCompletedTileUploads(); |
| 108 | 109 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 void DispatchOneImageDecodeTask( | 144 void DispatchOneImageDecodeTask( |
| 144 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); | 145 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); |
| 145 void OnImageDecodeTaskCompleted( | 146 void OnImageDecodeTaskCompleted( |
| 146 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); | 147 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); |
| 147 bool CanDispatchRasterTask(Tile* tile); | 148 bool CanDispatchRasterTask(Tile* tile); |
| 148 void DispatchOneRasterTask(scoped_refptr<Tile> tile); | 149 void DispatchOneRasterTask(scoped_refptr<Tile> tile); |
| 149 void OnRasterTaskCompleted( | 150 void OnRasterTaskCompleted( |
| 150 scoped_refptr<Tile> tile, | 151 scoped_refptr<Tile> tile, |
| 151 scoped_ptr<ResourcePool::Resource> resource, | 152 scoped_ptr<ResourcePool::Resource> resource, |
| 152 int manage_tiles_call_count_when_dispatched); | 153 int manage_tiles_call_count_when_dispatched); |
| 154 void OnRasterTaskCompletedByWorker( | |
| 155 scoped_refptr<Tile> tile, | |
| 156 scoped_ptr<ResourcePool::Resource> resource, | |
| 157 int manage_tiles_call_count_when_dispatched); | |
|
reveman
2013/02/04 22:53:24
How about OnRasterCompleted() and OnRasterTaskComp
Sami
2013/02/05 12:26:23
Good idea, I like that naming.
| |
| 153 void DidFinishTileInitialization(Tile* tile); | 158 void DidFinishTileInitialization(Tile* tile); |
| 154 void DidTileRasterStateChange(Tile* tile, TileRasterState state); | 159 void DidTileRasterStateChange(Tile* tile, TileRasterState state); |
| 155 void DidTileBinChange(Tile* tile, | 160 void DidTileBinChange(Tile* tile, |
| 156 TileManagerBin bin, | 161 TileManagerBin bin, |
| 157 WhichTree tree); | 162 WhichTree tree); |
| 158 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; | 163 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; |
| 159 | 164 |
| 160 static void RunRasterTask(uint8* buffer, | 165 static void RunRasterTask(uint8* buffer, |
|
reveman
2013/02/04 22:53:24
Maybe rename to PerformRaster if you like my sugge
Sami
2013/02/05 12:26:23
Done.
| |
| 161 const gfx::Rect& rect, | 166 const gfx::Rect& rect, |
| 162 float contents_scale, | 167 float contents_scale, |
| 163 PicturePileImpl* picture_pile, | 168 PicturePileImpl* picture_pile, |
| 164 RenderingStats* stats); | 169 RenderingStats* stats); |
| 165 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, | 170 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, |
| 166 RenderingStats* stats); | 171 RenderingStats* stats); |
| 167 | 172 |
| 168 TileManagerClient* client_; | 173 TileManagerClient* client_; |
| 169 scoped_ptr<ResourcePool> resource_pool_; | 174 scoped_ptr<ResourcePool> resource_pool_; |
| 170 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 175 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 187 | 192 |
| 188 typedef std::queue<scoped_refptr<Tile> > TileQueue; | 193 typedef std::queue<scoped_refptr<Tile> > TileQueue; |
| 189 TileQueue tiles_with_pending_set_pixels_; | 194 TileQueue tiles_with_pending_set_pixels_; |
| 190 size_t bytes_pending_set_pixels_; | 195 size_t bytes_pending_set_pixels_; |
| 191 bool ever_exceeded_memory_budget_; | 196 bool ever_exceeded_memory_budget_; |
| 192 MemoryHistory::Entry memory_stats_from_last_assign_; | 197 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 193 | 198 |
| 194 bool record_rendering_stats_; | 199 bool record_rendering_stats_; |
| 195 RenderingStats rendering_stats_; | 200 RenderingStats rendering_stats_; |
| 196 | 201 |
| 202 bool use_cheapness_estimator_; | |
| 203 | |
| 197 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 204 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
| 198 | 205 |
| 199 DISALLOW_COPY_AND_ASSIGN(TileManager); | 206 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 200 }; | 207 }; |
| 201 | 208 |
| 202 } // namespace cc | 209 } // namespace cc |
| 203 | 210 |
| 204 #endif // CC_TILE_MANAGER_H_ | 211 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |