| 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 <set> | 10 #include <set> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 enum TileRasterState { | 59 enum TileRasterState { |
| 60 IDLE_STATE = 0, | 60 IDLE_STATE = 0, |
| 61 WAITING_FOR_RASTER_STATE = 1, | 61 WAITING_FOR_RASTER_STATE = 1, |
| 62 RASTER_STATE = 2, | 62 RASTER_STATE = 2, |
| 63 UPLOAD_STATE = 3, | 63 UPLOAD_STATE = 3, |
| 64 NUM_STATES = 4 | 64 NUM_STATES = 4 |
| 65 }; | 65 }; |
| 66 scoped_ptr<base::Value> TileRasterStateAsValue( | 66 scoped_ptr<base::Value> TileRasterStateAsValue( |
| 67 TileRasterState bin); | 67 TileRasterState bin); |
| 68 | 68 |
| 69 // This is state that is specific to a tile that is | |
| 70 // managed by the TileManager. | |
| 71 class CC_EXPORT ManagedTileState { | |
| 72 public: | |
| 73 ManagedTileState(); | |
| 74 ~ManagedTileState(); | |
| 75 scoped_ptr<base::Value> AsValue() const; | |
| 76 | |
| 77 // Persisted state: valid all the time. | |
| 78 bool can_use_gpu_memory; | |
| 79 bool can_be_freed; | |
| 80 scoped_ptr<ResourcePool::Resource> resource; | |
| 81 bool resource_is_being_initialized; | |
| 82 bool contents_swizzled; | |
| 83 bool need_to_gather_pixel_refs; | |
| 84 std::list<skia::LazyPixelRef*> pending_pixel_refs; | |
| 85 TileRasterState raster_state; | |
| 86 | |
| 87 // Ephemeral state, valid only during Manage. | |
| 88 TileManagerBin bin[NUM_BIN_PRIORITIES]; | |
| 89 TileManagerBin tree_bin[NUM_TREES]; | |
| 90 // The bin that the tile would have if the GPU memory manager had a maximally
permissive policy, | |
| 91 // send to the GPU memory manager to determine policy. | |
| 92 TileManagerBin gpu_memmgr_stats_bin; | |
| 93 TileResolution resolution; | |
| 94 float time_to_needed_in_seconds; | |
| 95 float distance_to_visible_in_pixels; | |
| 96 PicturePileImpl::Analysis picture_pile_analysis; | |
| 97 bool picture_pile_analyzed; | |
| 98 }; | |
| 99 | |
| 100 // This class manages tiles, deciding which should get rasterized and which | 69 // This class manages tiles, deciding which should get rasterized and which |
| 101 // should no longer have any memory assigned to them. Tile objects are "owned" | 70 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 102 // by layers; they automatically register with the manager when they are | 71 // by layers; they automatically register with the manager when they are |
| 103 // created, and unregister from the manager when they are deleted. | 72 // created, and unregister from the manager when they are deleted. |
| 104 class CC_EXPORT TileManager : public WorkerPoolClient { | 73 class CC_EXPORT TileManager : public WorkerPoolClient { |
| 105 public: | 74 public: |
| 106 TileManager(TileManagerClient* client, | 75 TileManager(TileManagerClient* client, |
| 107 ResourceProvider *resource_provider, | 76 ResourceProvider *resource_provider, |
| 108 size_t num_raster_threads, | 77 size_t num_raster_threads, |
| 109 bool use_cheapess_estimator, | 78 bool use_cheapess_estimator, |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 220 |
| 252 size_t pending_tasks_; | 221 size_t pending_tasks_; |
| 253 size_t max_pending_tasks_; | 222 size_t max_pending_tasks_; |
| 254 | 223 |
| 255 DISALLOW_COPY_AND_ASSIGN(TileManager); | 224 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 256 }; | 225 }; |
| 257 | 226 |
| 258 } // namespace cc | 227 } // namespace cc |
| 259 | 228 |
| 260 #endif // CC_TILE_MANAGER_H_ | 229 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |