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 <list> | 8 #include <list> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // This class manages tiles, deciding which should get rasterized and which | 59 // This class manages tiles, deciding which should get rasterized and which |
60 // should no longer have any memory assigned to them. Tile objects are "owned" | 60 // should no longer have any memory assigned to them. Tile objects are "owned" |
61 // by layers; they automatically register with the manager when they are | 61 // by layers; they automatically register with the manager when they are |
62 // created, and unregister from the manager when they are deleted. | 62 // created, and unregister from the manager when they are deleted. |
63 class CC_EXPORT TileManager : public WorkerPoolClient { | 63 class CC_EXPORT TileManager : public WorkerPoolClient { |
64 public: | 64 public: |
65 TileManager(TileManagerClient* client, | 65 TileManager(TileManagerClient* client, |
66 ResourceProvider *resource_provider, | 66 ResourceProvider *resource_provider, |
67 size_t num_raster_threads, | 67 size_t num_raster_threads, |
68 bool use_cheapess_estimator, | |
69 bool use_color_estimator, | 68 bool use_color_estimator, |
70 bool prediction_benchmarking, | 69 bool prediction_benchmarking, |
71 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 70 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
72 virtual ~TileManager(); | 71 virtual ~TileManager(); |
73 | 72 |
74 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 73 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
75 return global_state_; | 74 return global_state_; |
76 } | 75 } |
77 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 76 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
78 | 77 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void AssignBinsToTiles(); | 123 void AssignBinsToTiles(); |
125 void SortTiles(); | 124 void SortTiles(); |
126 void AssignGpuMemoryToTiles(); | 125 void AssignGpuMemoryToTiles(); |
127 void FreeResourcesForTile(Tile* tile); | 126 void FreeResourcesForTile(Tile* tile); |
128 void ScheduleManageTiles() { | 127 void ScheduleManageTiles() { |
129 if (manage_tiles_pending_) | 128 if (manage_tiles_pending_) |
130 return; | 129 return; |
131 client_->ScheduleManageTiles(); | 130 client_->ScheduleManageTiles(); |
132 manage_tiles_pending_ = true; | 131 manage_tiles_pending_ = true; |
133 } | 132 } |
134 void UpdateCheapTasksTimeLimit(); | |
135 void AnalyzeTile(Tile* tile); | 133 void AnalyzeTile(Tile* tile); |
136 void GatherPixelRefsForTile(Tile* tile); | 134 void GatherPixelRefsForTile(Tile* tile); |
137 void DispatchImageDecodeTasksForTile(Tile* tile); | 135 void DispatchImageDecodeTasksForTile(Tile* tile); |
138 void DispatchOneImageDecodeTask( | 136 void DispatchOneImageDecodeTask( |
139 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); | 137 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); |
140 void OnImageDecodeTaskCompleted( | 138 void OnImageDecodeTaskCompleted( |
141 scoped_refptr<Tile> tile, | 139 scoped_refptr<Tile> tile, |
142 uint32_t pixel_ref_id); | 140 uint32_t pixel_ref_id); |
143 bool CanDispatchRasterTask(Tile* tile) const; | 141 bool CanDispatchRasterTask(Tile* tile) const; |
144 scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile); | 142 scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile); |
(...skipping 12 matching lines...) Expand all Loading... |
157 uint8* buffer, | 155 uint8* buffer, |
158 gfx::Rect rect, | 156 gfx::Rect rect, |
159 float contents_scale, | 157 float contents_scale, |
160 const RasterTaskMetadata& metadata, | 158 const RasterTaskMetadata& metadata, |
161 RenderingStatsInstrumentation* stats_instrumentation, | 159 RenderingStatsInstrumentation* stats_instrumentation, |
162 PicturePileImpl* picture_pile); | 160 PicturePileImpl* picture_pile); |
163 static void RunImageDecodeTask( | 161 static void RunImageDecodeTask( |
164 skia::LazyPixelRef* pixel_ref, | 162 skia::LazyPixelRef* pixel_ref, |
165 RenderingStatsInstrumentation* stats_instrumentation); | 163 RenderingStatsInstrumentation* stats_instrumentation); |
166 | 164 |
167 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, | |
168 bool is_actually_cheap); | |
169 static void RecordSolidColorPredictorResults(const SkColor* actual_colors, | 165 static void RecordSolidColorPredictorResults(const SkColor* actual_colors, |
170 size_t color_count, | 166 size_t color_count, |
171 bool is_predicted_solid, | 167 bool is_predicted_solid, |
172 SkColor predicted_color, | 168 SkColor predicted_color, |
173 bool is_predicted_transparent); | 169 bool is_predicted_transparent); |
174 | 170 |
175 TileManagerClient* client_; | 171 TileManagerClient* client_; |
176 scoped_ptr<ResourcePool> resource_pool_; | 172 scoped_ptr<ResourcePool> resource_pool_; |
177 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 173 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
178 bool manage_tiles_pending_; | 174 bool manage_tiles_pending_; |
(...skipping 12 matching lines...) Expand all Loading... |
191 | 187 |
192 typedef std::queue<scoped_refptr<Tile> > TileQueue; | 188 typedef std::queue<scoped_refptr<Tile> > TileQueue; |
193 TileQueue tiles_with_pending_upload_; | 189 TileQueue tiles_with_pending_upload_; |
194 size_t bytes_pending_upload_; | 190 size_t bytes_pending_upload_; |
195 bool has_performed_uploads_since_last_flush_; | 191 bool has_performed_uploads_since_last_flush_; |
196 bool ever_exceeded_memory_budget_; | 192 bool ever_exceeded_memory_budget_; |
197 MemoryHistory::Entry memory_stats_from_last_assign_; | 193 MemoryHistory::Entry memory_stats_from_last_assign_; |
198 | 194 |
199 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 195 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
200 | 196 |
201 bool use_cheapness_estimator_; | |
202 bool use_color_estimator_; | 197 bool use_color_estimator_; |
203 bool prediction_benchmarking_; | 198 bool prediction_benchmarking_; |
204 bool did_initialize_visible_tile_; | 199 bool did_initialize_visible_tile_; |
205 | 200 |
206 size_t pending_tasks_; | 201 size_t pending_tasks_; |
207 size_t max_pending_tasks_; | 202 size_t max_pending_tasks_; |
208 | 203 |
209 base::TimeTicks anticipated_draw_time_; | 204 base::TimeTicks anticipated_draw_time_; |
210 | 205 |
211 DISALLOW_COPY_AND_ASSIGN(TileManager); | 206 DISALLOW_COPY_AND_ASSIGN(TileManager); |
212 }; | 207 }; |
213 | 208 |
214 } // namespace cc | 209 } // namespace cc |
215 | 210 |
216 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 211 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |