| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Be sure to update TileManagerBinAsValue when adding new fields. | 42 // Be sure to update TileManagerBinAsValue when adding new fields. |
| 43 }; | 43 }; |
| 44 scoped_ptr<base::Value> TileManagerBinAsValue( | 44 scoped_ptr<base::Value> TileManagerBinAsValue( |
| 45 TileManagerBin bin); | 45 TileManagerBin bin); |
| 46 | 46 |
| 47 enum TileManagerBinPriority { | 47 enum TileManagerBinPriority { |
| 48 HIGH_PRIORITY_BIN = 0, | 48 HIGH_PRIORITY_BIN = 0, |
| 49 LOW_PRIORITY_BIN = 1, | 49 LOW_PRIORITY_BIN = 1, |
| 50 NUM_BIN_PRIORITIES = 2 | 50 NUM_BIN_PRIORITIES = 2 |
| 51 }; | 51 }; |
| 52 scoped_ptr<base::Value> TileManagerBinPriorityAsValue( |
| 53 TileManagerBinPriority bin); |
| 52 | 54 |
| 53 enum TileRasterState { | 55 enum TileRasterState { |
| 54 IDLE_STATE = 0, | 56 IDLE_STATE = 0, |
| 55 WAITING_FOR_RASTER_STATE = 1, | 57 WAITING_FOR_RASTER_STATE = 1, |
| 56 RASTER_STATE = 2, | 58 RASTER_STATE = 2, |
| 57 SET_PIXELS_STATE = 3, | 59 SET_PIXELS_STATE = 3, |
| 58 NUM_STATES = 4 | 60 NUM_STATES = 4 |
| 59 }; | 61 }; |
| 62 scoped_ptr<base::Value> TileRasterStateAsValue( |
| 63 TileRasterState bin); |
| 60 | 64 |
| 61 // This is state that is specific to a tile that is | 65 // This is state that is specific to a tile that is |
| 62 // managed by the TileManager. | 66 // managed by the TileManager. |
| 63 class CC_EXPORT ManagedTileState { | 67 class CC_EXPORT ManagedTileState { |
| 64 public: | 68 public: |
| 65 ManagedTileState(); | 69 ManagedTileState(); |
| 66 ~ManagedTileState(); | 70 ~ManagedTileState(); |
| 71 scoped_ptr<base::Value> AsValue() const; |
| 67 | 72 |
| 68 // Persisted state: valid all the time. | 73 // Persisted state: valid all the time. |
| 69 bool can_use_gpu_memory; | 74 bool can_use_gpu_memory; |
| 70 bool can_be_freed; | 75 bool can_be_freed; |
| 71 scoped_ptr<ResourcePool::Resource> resource; | 76 scoped_ptr<ResourcePool::Resource> resource; |
| 72 bool resource_is_being_initialized; | 77 bool resource_is_being_initialized; |
| 73 bool contents_swizzled; | 78 bool contents_swizzled; |
| 74 bool need_to_gather_pixel_refs; | 79 bool need_to_gather_pixel_refs; |
| 75 std::list<skia::LazyPixelRef*> pending_pixel_refs; | 80 std::list<skia::LazyPixelRef*> pending_pixel_refs; |
| 76 TileRasterState raster_state; | 81 TileRasterState raster_state; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 | 103 |
| 99 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 104 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
| 100 return global_state_; | 105 return global_state_; |
| 101 } | 106 } |
| 102 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 107 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
| 103 | 108 |
| 104 void ManageTiles(); | 109 void ManageTiles(); |
| 105 void CheckForCompletedTileUploads(); | 110 void CheckForCompletedTileUploads(); |
| 106 | 111 |
| 107 scoped_ptr<base::Value> AsValue() const; | 112 scoped_ptr<base::Value> AsValue() const; |
| 113 scoped_ptr<base::Value> AllTilesAsValue() const; |
| 108 void GetMemoryStats(size_t* memoryRequiredBytes, | 114 void GetMemoryStats(size_t* memoryRequiredBytes, |
| 109 size_t* memoryNiceToHaveBytes, | 115 size_t* memoryNiceToHaveBytes, |
| 110 size_t* memoryUsedBytes) const; | 116 size_t* memoryUsedBytes) const; |
| 111 void GetRenderingStats(RenderingStats* stats); | 117 void GetRenderingStats(RenderingStats* stats); |
| 112 bool HasPendingWorkScheduled(WhichTree tree) const; | 118 bool HasPendingWorkScheduled(WhichTree tree) const; |
| 113 | 119 |
| 114 protected: | 120 protected: |
| 115 // Methods called by Tile | 121 // Methods called by Tile |
| 116 friend class Tile; | 122 friend class Tile; |
| 117 void RegisterTile(Tile* tile); | 123 void RegisterTile(Tile* tile); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 RenderingStats rendering_stats_; | 186 RenderingStats rendering_stats_; |
| 181 | 187 |
| 182 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 188 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
| 183 | 189 |
| 184 DISALLOW_COPY_AND_ASSIGN(TileManager); | 190 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 185 }; | 191 }; |
| 186 | 192 |
| 187 } // namespace cc | 193 } // namespace cc |
| 188 | 194 |
| 189 #endif // CC_TILE_MANAGER_H_ | 195 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |