Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: cc/resources/tile_manager.h

Issue 287643004: Re-land: cc: Examine layers to determine if we're ready to activate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 std::vector<PairedPictureLayerIterator> paired_iterators_; 148 std::vector<PairedPictureLayerIterator> paired_iterators_;
149 std::vector<PairedPictureLayerIterator*> iterator_heap_; 149 std::vector<PairedPictureLayerIterator*> iterator_heap_;
150 TreePriority tree_priority_; 150 TreePriority tree_priority_;
151 EvictionOrderComparator comparator_; 151 EvictionOrderComparator comparator_;
152 152
153 DISALLOW_COPY_AND_ASSIGN(EvictionTileIterator); 153 DISALLOW_COPY_AND_ASSIGN(EvictionTileIterator);
154 }; 154 };
155 155
156 static scoped_ptr<TileManager> Create( 156 static scoped_ptr<TileManager> Create(
157 TileManagerClient* client, 157 TileManagerClient* client,
158 base::SequencedTaskRunner* task_runner,
158 ResourcePool* resource_pool, 159 ResourcePool* resource_pool,
159 Rasterizer* rasterizer, 160 Rasterizer* rasterizer,
160 Rasterizer* gpu_rasterizer, 161 Rasterizer* gpu_rasterizer,
161 bool use_rasterize_on_demand,
162 RenderingStatsInstrumentation* rendering_stats_instrumentation); 162 RenderingStatsInstrumentation* rendering_stats_instrumentation);
163 virtual ~TileManager(); 163 virtual ~TileManager();
164 164
165 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); 165 void ManageTiles(const GlobalStateThatImpactsTilePriority& state);
166 166
167 // Returns true when visible tiles have been initialized. 167 // Returns true when visible tiles have been initialized.
168 bool UpdateVisibleTiles(); 168 bool UpdateVisibleTiles();
169 169
170 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, 170 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile,
171 const gfx::Size& tile_size, 171 const gfx::Size& tile_size,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Soft limit is used for resource pool such that 219 // Soft limit is used for resource pool such that
220 // memory returns to soft limit after going over. 220 // memory returns to soft limit after going over.
221 if (state != global_state_) { 221 if (state != global_state_) {
222 global_state_ = state; 222 global_state_ = state;
223 prioritized_tiles_dirty_ = true; 223 prioritized_tiles_dirty_ = true;
224 } 224 }
225 } 225 }
226 226
227 protected: 227 protected:
228 TileManager(TileManagerClient* client, 228 TileManager(TileManagerClient* client,
229 base::SequencedTaskRunner* task_runner,
229 ResourcePool* resource_pool, 230 ResourcePool* resource_pool,
230 Rasterizer* rasterizer, 231 Rasterizer* rasterizer,
231 Rasterizer* gpu_rasterizer, 232 Rasterizer* gpu_rasterizer,
232 bool use_rasterize_on_demand,
233 RenderingStatsInstrumentation* rendering_stats_instrumentation); 233 RenderingStatsInstrumentation* rendering_stats_instrumentation);
234 234
235 // Methods called by Tile 235 // Methods called by Tile
236 friend class Tile; 236 friend class Tile;
237 void DidChangeTilePriority(Tile* tile); 237 void DidChangeTilePriority(Tile* tile);
238 238
239 void CleanUpReleasedTiles(); 239 void CleanUpReleasedTiles();
240 240
241 // Overriden from RefCountedManager<Tile>: 241 // Overriden from RefCountedManager<Tile>:
242 virtual void Release(Tile* tile) OVERRIDE; 242 virtual void Release(Tile* tile) OVERRIDE;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 void FreeResourceForTile(Tile* tile, RasterMode mode); 281 void FreeResourceForTile(Tile* tile, RasterMode mode);
282 void FreeResourcesForTile(Tile* tile); 282 void FreeResourcesForTile(Tile* tile);
283 void FreeUnusedResourcesForTile(Tile* tile); 283 void FreeUnusedResourcesForTile(Tile* tile);
284 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, 284 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile,
285 SkPixelRef* pixel_ref); 285 SkPixelRef* pixel_ref);
286 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); 286 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile);
287 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; 287 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const;
288 void UpdatePrioritizedTileSetIfNeeded(); 288 void UpdatePrioritizedTileSetIfNeeded();
289 289
290 bool IsReadyToActivate() const;
291 void ScheduleCheckIfReadyToActivate();
292 void CheckIfReadyToActivate();
293
290 TileManagerClient* client_; 294 TileManagerClient* client_;
295 scoped_refptr<base::SequencedTaskRunner> task_runner_;
291 ResourcePool* resource_pool_; 296 ResourcePool* resource_pool_;
292 scoped_ptr<RasterizerDelegate> rasterizer_delegate_; 297 scoped_ptr<RasterizerDelegate> rasterizer_delegate_;
293 GlobalStateThatImpactsTilePriority global_state_; 298 GlobalStateThatImpactsTilePriority global_state_;
294 299
295 typedef base::hash_map<Tile::Id, Tile*> TileMap; 300 typedef base::hash_map<Tile::Id, Tile*> TileMap;
296 TileMap tiles_; 301 TileMap tiles_;
297 302
298 PrioritizedTileSet prioritized_tiles_; 303 PrioritizedTileSet prioritized_tiles_;
299 bool prioritized_tiles_dirty_; 304 bool prioritized_tiles_dirty_;
300 305
(...skipping 19 matching lines...) Expand all
320 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; 325 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap;
321 LayerPixelRefTaskMap image_decode_tasks_; 326 LayerPixelRefTaskMap image_decode_tasks_;
322 327
323 typedef base::hash_map<int, int> LayerCountMap; 328 typedef base::hash_map<int, int> LayerCountMap;
324 LayerCountMap used_layer_counts_; 329 LayerCountMap used_layer_counts_;
325 330
326 RasterTaskCompletionStats update_visible_tiles_stats_; 331 RasterTaskCompletionStats update_visible_tiles_stats_;
327 332
328 std::vector<Tile*> released_tiles_; 333 std::vector<Tile*> released_tiles_;
329 334
330 bool use_rasterize_on_demand_;
331
332 ResourceFormat resource_format_; 335 ResourceFormat resource_format_;
333 336
334 // Queues used when scheduling raster tasks. 337 // Queues used when scheduling raster tasks.
335 RasterTaskQueue raster_queue_[NUM_RASTERIZER_TYPES]; 338 RasterTaskQueue raster_queue_[NUM_RASTERIZER_TYPES];
336 339
337 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; 340 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_;
338 341
339 std::vector<PictureLayerImpl*> layers_; 342 std::vector<PictureLayerImpl*> layers_;
340 343
344 bool check_if_ready_to_activate_pending_;
345
346 base::WeakPtrFactory<TileManager> weak_ptr_factory_;
347
341 DISALLOW_COPY_AND_ASSIGN(TileManager); 348 DISALLOW_COPY_AND_ASSIGN(TileManager);
342 }; 349 };
343 350
344 } // namespace cc 351 } // namespace cc
345 352
346 #endif // CC_RESOURCES_TILE_MANAGER_H_ 353 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698