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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Be sure to update TileManagerBinAsValue when adding new fields. | 43 // Be sure to update TileManagerBinAsValue when adding new fields. |
44 }; | 44 }; |
45 scoped_ptr<base::Value> TileManagerBinAsValue( | 45 scoped_ptr<base::Value> TileManagerBinAsValue( |
46 TileManagerBin bin); | 46 TileManagerBin bin); |
47 | 47 |
48 enum TileManagerBinPriority { | 48 enum TileManagerBinPriority { |
49 HIGH_PRIORITY_BIN = 0, | 49 HIGH_PRIORITY_BIN = 0, |
50 LOW_PRIORITY_BIN = 1, | 50 LOW_PRIORITY_BIN = 1, |
51 NUM_BIN_PRIORITIES = 2 | 51 NUM_BIN_PRIORITIES = 2 |
52 }; | 52 }; |
| 53 scoped_ptr<base::Value> TileManagerBinPriorityAsValue( |
| 54 TileManagerBinPriority bin); |
53 | 55 |
54 enum TileRasterState { | 56 enum TileRasterState { |
55 IDLE_STATE = 0, | 57 IDLE_STATE = 0, |
56 WAITING_FOR_RASTER_STATE = 1, | 58 WAITING_FOR_RASTER_STATE = 1, |
57 RASTER_STATE = 2, | 59 RASTER_STATE = 2, |
58 SET_PIXELS_STATE = 3, | 60 SET_PIXELS_STATE = 3, |
59 NUM_STATES = 4 | 61 NUM_STATES = 4 |
60 }; | 62 }; |
| 63 scoped_ptr<base::Value> TileRasterStateAsValue( |
| 64 TileRasterState bin); |
61 | 65 |
62 // This is state that is specific to a tile that is | 66 // This is state that is specific to a tile that is |
63 // managed by the TileManager. | 67 // managed by the TileManager. |
64 class CC_EXPORT ManagedTileState { | 68 class CC_EXPORT ManagedTileState { |
65 public: | 69 public: |
66 ManagedTileState(); | 70 ManagedTileState(); |
67 ~ManagedTileState(); | 71 ~ManagedTileState(); |
| 72 scoped_ptr<base::Value> AsValue() const; |
68 | 73 |
69 // Persisted state: valid all the time. | 74 // Persisted state: valid all the time. |
70 bool can_use_gpu_memory; | 75 bool can_use_gpu_memory; |
71 bool can_be_freed; | 76 bool can_be_freed; |
72 scoped_ptr<ResourcePool::Resource> resource; | 77 scoped_ptr<ResourcePool::Resource> resource; |
73 bool resource_is_being_initialized; | 78 bool resource_is_being_initialized; |
74 bool contents_swizzled; | 79 bool contents_swizzled; |
75 bool need_to_gather_pixel_refs; | 80 bool need_to_gather_pixel_refs; |
76 std::list<skia::LazyPixelRef*> pending_pixel_refs; | 81 std::list<skia::LazyPixelRef*> pending_pixel_refs; |
77 TileRasterState raster_state; | 82 TileRasterState raster_state; |
(...skipping 21 matching lines...) Expand all Loading... |
99 virtual ~TileManager(); | 104 virtual ~TileManager(); |
100 | 105 |
101 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 106 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
102 return global_state_; | 107 return global_state_; |
103 } | 108 } |
104 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 109 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
105 | 110 |
106 void ManageTiles(); | 111 void ManageTiles(); |
107 void CheckForCompletedTileUploads(); | 112 void CheckForCompletedTileUploads(); |
108 | 113 |
109 scoped_ptr<base::Value> AsValue() const; | 114 scoped_ptr<base::Value> BasicStateAsValue() const; |
| 115 scoped_ptr<base::Value> AllTilesAsValue() const; |
110 void GetMemoryStats(size_t* memoryRequiredBytes, | 116 void GetMemoryStats(size_t* memoryRequiredBytes, |
111 size_t* memoryNiceToHaveBytes, | 117 size_t* memoryNiceToHaveBytes, |
112 size_t* memoryUsedBytes) const; | 118 size_t* memoryUsedBytes) const; |
113 void SetRecordRenderingStats(bool record_rendering_stats); | 119 void SetRecordRenderingStats(bool record_rendering_stats); |
114 void GetRenderingStats(RenderingStats* stats); | 120 void GetRenderingStats(RenderingStats* stats); |
115 bool HasPendingWorkScheduled(WhichTree tree) const; | 121 bool HasPendingWorkScheduled(WhichTree tree) const; |
116 | 122 |
117 const MemoryHistory::Entry& memory_stats_from_last_assign() const { return mem
ory_stats_from_last_assign_; } | 123 const MemoryHistory::Entry& memory_stats_from_last_assign() const { return mem
ory_stats_from_last_assign_; } |
118 | 124 |
119 protected: | 125 protected: |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 213 |
208 bool use_cheapness_estimator_; | 214 bool use_cheapness_estimator_; |
209 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 215 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
210 | 216 |
211 DISALLOW_COPY_AND_ASSIGN(TileManager); | 217 DISALLOW_COPY_AND_ASSIGN(TileManager); |
212 }; | 218 }; |
213 | 219 |
214 } // namespace cc | 220 } // namespace cc |
215 | 221 |
216 #endif // CC_TILE_MANAGER_H_ | 222 #endif // CC_TILE_MANAGER_H_ |
OLD | NEW |