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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const TileVector& tiles_that_need_to_be_rasterized); | 160 const TileVector& tiles_that_need_to_be_rasterized); |
161 | 161 |
162 void AssignGpuMemoryToTiles( | 162 void AssignGpuMemoryToTiles( |
163 PrioritizedTileSet* tiles, | 163 PrioritizedTileSet* tiles, |
164 TileVector* tiles_that_need_to_be_rasterized); | 164 TileVector* tiles_that_need_to_be_rasterized); |
165 void GetTilesWithAssignedBins(PrioritizedTileSet* tiles); | 165 void GetTilesWithAssignedBins(PrioritizedTileSet* tiles); |
166 | 166 |
167 private: | 167 private: |
168 void OnImageDecodeTaskCompleted( | 168 void OnImageDecodeTaskCompleted( |
169 int layer_id, | 169 int layer_id, |
170 skia::LazyPixelRef* pixel_ref, | 170 SkPixelRef* pixel_ref, |
171 bool was_canceled); | 171 bool was_canceled); |
172 void OnRasterTaskCompleted(Tile::Id tile, | 172 void OnRasterTaskCompleted(Tile::Id tile, |
173 scoped_ptr<ScopedResource> resource, | 173 scoped_ptr<ScopedResource> resource, |
174 RasterMode raster_mode, | 174 RasterMode raster_mode, |
175 const PicturePileImpl::Analysis& analysis, | 175 const PicturePileImpl::Analysis& analysis, |
176 bool was_canceled); | 176 bool was_canceled); |
177 | 177 |
178 inline size_t BytesConsumedIfAllocated(const Tile* tile) const { | 178 inline size_t BytesConsumedIfAllocated(const Tile* tile) const { |
179 return Resource::MemorySizeBytes(tile->size(), | 179 return Resource::MemorySizeBytes(tile->size(), |
180 raster_worker_pool_->GetResourceFormat()); | 180 raster_worker_pool_->GetResourceFormat()); |
181 } | 181 } |
182 | 182 |
183 RasterMode DetermineRasterMode(const Tile* tile) const; | 183 RasterMode DetermineRasterMode(const Tile* tile) const; |
184 void FreeResourceForTile(Tile* tile, RasterMode mode); | 184 void FreeResourceForTile(Tile* tile, RasterMode mode); |
185 void FreeResourcesForTile(Tile* tile); | 185 void FreeResourcesForTile(Tile* tile); |
186 void FreeUnusedResourcesForTile(Tile* tile); | 186 void FreeUnusedResourcesForTile(Tile* tile); |
187 RasterWorkerPool::Task CreateImageDecodeTask( | 187 RasterWorkerPool::Task CreateImageDecodeTask( |
188 Tile* tile, skia::LazyPixelRef* pixel_ref); | 188 Tile* tile, SkPixelRef* pixel_ref); |
189 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); | 189 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); |
190 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; | 190 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
191 void UpdatePrioritizedTileSetIfNeeded(); | 191 void UpdatePrioritizedTileSetIfNeeded(); |
192 | 192 |
193 TileManagerClient* client_; | 193 TileManagerClient* client_; |
194 scoped_ptr<ResourcePool> resource_pool_; | 194 scoped_ptr<ResourcePool> resource_pool_; |
195 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 195 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
196 GlobalStateThatImpactsTilePriority global_state_; | 196 GlobalStateThatImpactsTilePriority global_state_; |
197 | 197 |
198 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 198 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 std::vector<Tile*> released_tiles_; | 234 std::vector<Tile*> released_tiles_; |
235 std::vector<TileBundle*> released_tile_bundles_; | 235 std::vector<TileBundle*> released_tile_bundles_; |
236 | 236 |
237 DISALLOW_COPY_AND_ASSIGN(TileManager); | 237 DISALLOW_COPY_AND_ASSIGN(TileManager); |
238 }; | 238 }; |
239 | 239 |
240 } // namespace cc | 240 } // namespace cc |
241 | 241 |
242 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 242 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |