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_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 <queue> | 8 #include <queue> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 const TileVector& tiles_that_need_to_be_rasterized); | 147 const TileVector& tiles_that_need_to_be_rasterized); |
148 | 148 |
149 void AssignGpuMemoryToTiles( | 149 void AssignGpuMemoryToTiles( |
150 PrioritizedTileSet* tiles, | 150 PrioritizedTileSet* tiles, |
151 TileVector* tiles_that_need_to_be_rasterized); | 151 TileVector* tiles_that_need_to_be_rasterized); |
152 void GetTilesWithAssignedBins(PrioritizedTileSet* tiles); | 152 void GetTilesWithAssignedBins(PrioritizedTileSet* tiles); |
153 | 153 |
154 private: | 154 private: |
155 void OnImageDecodeTaskCompleted( | 155 void OnImageDecodeTaskCompleted( |
156 int layer_id, | 156 int layer_id, |
157 skia::LazyPixelRef* pixel_ref, | 157 SkPixelRef* pixel_ref, |
158 bool was_canceled); | 158 bool was_canceled); |
159 void OnRasterTaskCompleted(Tile::Id tile, | 159 void OnRasterTaskCompleted(Tile::Id tile, |
160 scoped_ptr<ScopedResource> resource, | 160 scoped_ptr<ScopedResource> resource, |
161 RasterMode raster_mode, | 161 RasterMode raster_mode, |
162 const PicturePileImpl::Analysis& analysis, | 162 const PicturePileImpl::Analysis& analysis, |
163 bool was_canceled); | 163 bool was_canceled); |
164 | 164 |
165 inline size_t BytesConsumedIfAllocated(const Tile* tile) const { | 165 inline size_t BytesConsumedIfAllocated(const Tile* tile) const { |
166 return Resource::MemorySizeBytes(tile->size(), | 166 return Resource::MemorySizeBytes(tile->size(), |
167 raster_worker_pool_->GetResourceFormat()); | 167 raster_worker_pool_->GetResourceFormat()); |
168 } | 168 } |
169 | 169 |
170 RasterMode DetermineRasterMode(const Tile* tile) const; | 170 RasterMode DetermineRasterMode(const Tile* tile) const; |
171 void FreeResourceForTile(Tile* tile, RasterMode mode); | 171 void FreeResourceForTile(Tile* tile, RasterMode mode); |
172 void FreeResourcesForTile(Tile* tile); | 172 void FreeResourcesForTile(Tile* tile); |
173 void FreeUnusedResourcesForTile(Tile* tile); | 173 void FreeUnusedResourcesForTile(Tile* tile); |
174 RasterWorkerPool::Task CreateImageDecodeTask( | 174 RasterWorkerPool::Task CreateImageDecodeTask( |
175 Tile* tile, skia::LazyPixelRef* pixel_ref); | 175 Tile* tile, SkPixelRef* pixel_ref); |
176 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); | 176 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); |
177 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; | 177 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
178 void UpdatePrioritizedTileSetIfNeeded(); | 178 void UpdatePrioritizedTileSetIfNeeded(); |
179 | 179 |
180 TileManagerClient* client_; | 180 TileManagerClient* client_; |
181 scoped_ptr<ResourcePool> resource_pool_; | 181 scoped_ptr<ResourcePool> resource_pool_; |
182 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 182 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
183 GlobalStateThatImpactsTilePriority global_state_; | 183 GlobalStateThatImpactsTilePriority global_state_; |
184 | 184 |
185 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 185 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
(...skipping 30 matching lines...) Expand all Loading... |
216 RasterTaskCompletionStats update_visible_tiles_stats_; | 216 RasterTaskCompletionStats update_visible_tiles_stats_; |
217 | 217 |
218 std::vector<Tile*> released_tiles_; | 218 std::vector<Tile*> released_tiles_; |
219 | 219 |
220 DISALLOW_COPY_AND_ASSIGN(TileManager); | 220 DISALLOW_COPY_AND_ASSIGN(TileManager); |
221 }; | 221 }; |
222 | 222 |
223 } // namespace cc | 223 } // namespace cc |
224 | 224 |
225 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 225 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |