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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 tile_version.resource_ = make_scoped_ptr( | 87 tile_version.resource_ = make_scoped_ptr( |
88 new ResourcePool::Resource(resource_provider, | 88 new ResourcePool::Resource(resource_provider, |
89 gfx::Size(1, 1), | 89 gfx::Size(1, 1), |
90 resource_provider->best_texture_format())); | 90 resource_provider->best_texture_format())); |
91 | 91 |
92 bytes_releasable_ += tiles[i]->bytes_consumed_if_allocated(); | 92 bytes_releasable_ += tiles[i]->bytes_consumed_if_allocated(); |
93 ++resources_releasable_; | 93 ++resources_releasable_; |
94 } | 94 } |
95 } | 95 } |
| 96 RasterWorkerPool* RasterWorkerPoolForTesting() { |
| 97 return raster_worker_pool_.get(); |
| 98 } |
96 | 99 |
97 protected: | 100 protected: |
98 TileManager(TileManagerClient* client, | 101 TileManager(TileManagerClient* client, |
99 ResourceProvider* resource_provider, | 102 ResourceProvider* resource_provider, |
100 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 103 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
101 size_t num_raster_threads, | 104 size_t num_raster_threads, |
102 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 105 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
103 | 106 |
104 // Methods called by Tile | 107 // Methods called by Tile |
105 friend class Tile; | 108 friend class Tile; |
(...skipping 25 matching lines...) Expand all Loading... |
131 skia::LazyPixelRef* pixel_ref, | 134 skia::LazyPixelRef* pixel_ref, |
132 bool was_canceled); | 135 bool was_canceled); |
133 void OnRasterTaskCompleted( | 136 void OnRasterTaskCompleted( |
134 Tile::Id tile, | 137 Tile::Id tile, |
135 scoped_ptr<ResourcePool::Resource> resource, | 138 scoped_ptr<ResourcePool::Resource> resource, |
136 RasterMode raster_mode, | 139 RasterMode raster_mode, |
137 const PicturePileImpl::Analysis& analysis, | 140 const PicturePileImpl::Analysis& analysis, |
138 bool was_canceled); | 141 bool was_canceled); |
139 | 142 |
140 RasterMode DetermineRasterMode(const Tile* tile) const; | 143 RasterMode DetermineRasterMode(const Tile* tile) const; |
141 void CleanUpUnusedImageDecodeTasks(); | |
142 void FreeResourceForTile(Tile* tile, RasterMode mode); | 144 void FreeResourceForTile(Tile* tile, RasterMode mode); |
143 void FreeResourcesForTile(Tile* tile); | 145 void FreeResourcesForTile(Tile* tile); |
144 void FreeUnusedResourcesForTile(Tile* tile); | 146 void FreeUnusedResourcesForTile(Tile* tile); |
145 RasterWorkerPool::Task CreateImageDecodeTask( | 147 RasterWorkerPool::Task CreateImageDecodeTask( |
146 Tile* tile, skia::LazyPixelRef* pixel_ref); | 148 Tile* tile, skia::LazyPixelRef* pixel_ref); |
147 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); | 149 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); |
148 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; | 150 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
149 PrioritizedTileSet* GetPrioritizedTileSet(); | 151 PrioritizedTileSet* GetPrioritizedTileSet(); |
150 | 152 |
151 TileManagerClient* client_; | 153 TileManagerClient* client_; |
(...skipping 17 matching lines...) Expand all Loading... |
169 MemoryHistory::Entry memory_stats_from_last_assign_; | 171 MemoryHistory::Entry memory_stats_from_last_assign_; |
170 | 172 |
171 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 173 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
172 | 174 |
173 bool did_initialize_visible_tile_; | 175 bool did_initialize_visible_tile_; |
174 | 176 |
175 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; | 177 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; |
176 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; | 178 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; |
177 LayerPixelRefTaskMap image_decode_tasks_; | 179 LayerPixelRefTaskMap image_decode_tasks_; |
178 | 180 |
| 181 typedef base::hash_map<int, int> LayerCountMap; |
| 182 LayerCountMap used_layer_counts_; |
| 183 |
179 RasterTaskCompletionStats update_visible_tiles_stats_; | 184 RasterTaskCompletionStats update_visible_tiles_stats_; |
180 | 185 |
181 DISALLOW_COPY_AND_ASSIGN(TileManager); | 186 DISALLOW_COPY_AND_ASSIGN(TileManager); |
182 }; | 187 }; |
183 | 188 |
184 } // namespace cc | 189 } // namespace cc |
185 | 190 |
186 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 191 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |