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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 size_t* memoryUsedBytes) const; | 110 size_t* memoryUsedBytes) const; |
111 void GetRenderingStats(RenderingStats* stats); | 111 void GetRenderingStats(RenderingStats* stats); |
112 bool HasPendingWorkScheduled(WhichTree tree) const; | 112 bool HasPendingWorkScheduled(WhichTree tree) const; |
113 | 113 |
114 protected: | 114 protected: |
115 // Methods called by Tile | 115 // Methods called by Tile |
116 friend class Tile; | 116 friend class Tile; |
117 void RegisterTile(Tile* tile); | 117 void RegisterTile(Tile* tile); |
118 void UnregisterTile(Tile* tile); | 118 void UnregisterTile(Tile* tile); |
119 void WillModifyTilePriority( | 119 void WillModifyTilePriority( |
120 Tile* tile, WhichTree tree, const TilePriority& new_priority); | 120 Tile* tile, WhichTree tree, const TilePriority& new_priority) { |
| 121 // TODO(nduca): Do something smarter if reprioritization turns out to be |
| 122 // costly. |
| 123 ScheduleManageTiles(); |
| 124 } |
121 | 125 |
122 private: | 126 private: |
123 void SortTiles(); | 127 void SortTiles(); |
124 void AssignGpuMemoryToTiles(); | 128 void AssignGpuMemoryToTiles(); |
125 void FreeResourcesForTile(Tile* tile); | 129 void FreeResourcesForTile(Tile* tile); |
126 void ScheduleManageTiles(); | 130 void ScheduleManageTiles() { |
| 131 if (manage_tiles_pending_) |
| 132 return; |
| 133 client_->ScheduleManageTiles(); |
| 134 manage_tiles_pending_ = true; |
| 135 } |
127 void DispatchMoreTasks(); | 136 void DispatchMoreTasks(); |
128 void GatherPixelRefsForTile(Tile* tile); | 137 void GatherPixelRefsForTile(Tile* tile); |
129 void DispatchImageDecodeTasksForTile(Tile* tile); | 138 void DispatchImageDecodeTasksForTile(Tile* tile); |
130 void DispatchOneImageDecodeTask( | 139 void DispatchOneImageDecodeTask( |
131 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); | 140 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); |
132 void OnImageDecodeTaskCompleted( | 141 void OnImageDecodeTaskCompleted( |
133 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); | 142 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); |
134 bool CanDispatchRasterTask(Tile* tile); | 143 bool CanDispatchRasterTask(Tile* tile); |
135 void DispatchOneRasterTask(scoped_refptr<Tile> tile); | 144 void DispatchOneRasterTask(scoped_refptr<Tile> tile); |
136 void OnRasterTaskCompleted( | 145 void OnRasterTaskCompleted( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 RenderingStats rendering_stats_; | 189 RenderingStats rendering_stats_; |
181 | 190 |
182 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 191 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
183 | 192 |
184 DISALLOW_COPY_AND_ASSIGN(TileManager); | 193 DISALLOW_COPY_AND_ASSIGN(TileManager); |
185 }; | 194 }; |
186 | 195 |
187 } // namespace cc | 196 } // namespace cc |
188 | 197 |
189 #endif // CC_TILE_MANAGER_H_ | 198 #endif // CC_TILE_MANAGER_H_ |
OLD | NEW |