Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: cc/resources/tile_manager.h

Issue 18581004: cc: Remove tile ref counting in tile manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 friend class Tile; 103 friend class Tile;
104 void RegisterTile(Tile* tile); 104 void RegisterTile(Tile* tile);
105 void UnregisterTile(Tile* tile); 105 void UnregisterTile(Tile* tile);
106 106
107 // Overriden from RasterWorkerPoolClient: 107 // Overriden from RasterWorkerPoolClient:
108 virtual bool ShouldForceTasksRequiredForActivationToComplete() const 108 virtual bool ShouldForceTasksRequiredForActivationToComplete() const
109 OVERRIDE; 109 OVERRIDE;
110 virtual void DidFinishedRunningTasks() OVERRIDE; 110 virtual void DidFinishedRunningTasks() OVERRIDE;
111 virtual void DidFinishedRunningTasksRequiredForActivation() OVERRIDE; 111 virtual void DidFinishedRunningTasksRequiredForActivation() OVERRIDE;
112 112
113 typedef std::vector<Tile*> TileVector;
114
113 // Virtual for test 115 // Virtual for test
114 virtual void ScheduleTasks(); 116 virtual void ScheduleTasks(
117 const TileVector& tiles_that_need_to_be_rasterized);
115 118
116 const std::vector<Tile*>& tiles_that_need_to_be_rasterized() const { 119 void ReassignGpuMemoryToOOMTilesRequiredForActivation(
117 return tiles_that_need_to_be_rasterized_; 120 TileVector* tiles_that_need_to_be_rasterized);
118 } 121 void AssignGpuMemoryToTiles(
119 122 TileVector* tiles_that_need_to_be_rasterized);
120 void ReassignGpuMemoryToOOMTilesRequiredForActivation(); 123 void AssignBinsToTiles();
124 void SortTiles();
121 125
122 private: 126 private:
127 // TODO(vmpstr): Make this be Tile::Id once crbug.com/253972 is fixed.
128 typedef uint64 ManagedTileId;
123 void OnImageDecodeTaskCompleted( 129 void OnImageDecodeTaskCompleted(
124 int layer_id, 130 int layer_id,
125 skia::LazyPixelRef* pixel_ref, 131 skia::LazyPixelRef* pixel_ref,
126 bool was_canceled); 132 bool was_canceled);
127 void OnRasterTaskCompleted( 133 void OnRasterTaskCompleted(
128 scoped_refptr<Tile> tile, 134 ManagedTileId tile,
129 scoped_ptr<ResourcePool::Resource> resource, 135 scoped_ptr<ResourcePool::Resource> resource,
130 RasterMode raster_mode, 136 RasterMode raster_mode,
131 const PicturePileImpl::Analysis& analysis, 137 const PicturePileImpl::Analysis& analysis,
132 bool was_canceled); 138 bool was_canceled);
133 139
134 void AssignBinsToTiles();
135 void SortTiles();
136 RasterMode DetermineRasterMode(const Tile* tile) const; 140 RasterMode DetermineRasterMode(const Tile* tile) const;
137 void CleanUpUnusedImageDecodeTasks(); 141 void CleanUpUnusedImageDecodeTasks();
138 void AssignGpuMemoryToTiles();
139 void FreeResourceForTile(Tile* tile, RasterMode mode); 142 void FreeResourceForTile(Tile* tile, RasterMode mode);
140 void FreeResourcesForTile(Tile* tile); 143 void FreeResourcesForTile(Tile* tile);
141 void FreeUnusedResourcesForTile(Tile* tile); 144 void FreeUnusedResourcesForTile(Tile* tile);
142 RasterWorkerPool::Task CreateImageDecodeTask( 145 RasterWorkerPool::Task CreateImageDecodeTask(
143 Tile* tile, skia::LazyPixelRef* pixel_ref); 146 Tile* tile, skia::LazyPixelRef* pixel_ref);
144 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; 147 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const;
145 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); 148 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile);
146 void DidFinishTileInitialization(Tile* tile); 149 void DidFinishTileInitialization(Tile* tile);
147 void DidTileTreeBinChange(Tile* tile, 150 void DidTileTreeBinChange(Tile* tile,
148 TileManagerBin new_tree_bin, 151 TileManagerBin new_tree_bin,
149 WhichTree tree); 152 WhichTree tree);
150 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; 153 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const;
151 void AddRequiredTileForActivation(Tile* tile); 154 void AddRequiredTileForActivation(Tile* tile);
152 155
153 TileManagerClient* client_; 156 TileManagerClient* client_;
154 scoped_ptr<ResourcePool> resource_pool_; 157 scoped_ptr<ResourcePool> resource_pool_;
155 scoped_ptr<RasterWorkerPool> raster_worker_pool_; 158 scoped_ptr<RasterWorkerPool> raster_worker_pool_;
156 GlobalStateThatImpactsTilePriority global_state_; 159 GlobalStateThatImpactsTilePriority global_state_;
157 160
158 typedef std::vector<Tile*> TileVector; 161 typedef std::set<Tile*> TileSet;
reveman 2013/07/03 20:20:06 move this below TileVector tiles_;
vmpstr 2013/07/03 23:47:51 Done.
159 TileVector tiles_; 162 TileVector tiles_;
reveman 2013/07/03 20:20:06 how about sorted_tiles_?
vmpstr 2013/07/03 23:47:51 Done.
160 TileVector tiles_that_need_to_be_rasterized_;
161 typedef std::set<Tile*> TileSet;
162 TileSet tiles_that_need_to_be_initialized_for_activation_; 163 TileSet tiles_that_need_to_be_initialized_for_activation_;
163 TileSet oom_tiles_that_need_to_be_initialized_for_activation_; 164 TileSet oom_tiles_that_need_to_be_initialized_for_activation_;
reveman 2013/07/03 20:20:06 |oom_tiles_that_need_to_be_initialized_for_activat
vmpstr 2013/07/03 23:47:51 Done.
164 165
165 bool ever_exceeded_memory_budget_; 166 bool ever_exceeded_memory_budget_;
166 MemoryHistory::Entry memory_stats_from_last_assign_; 167 MemoryHistory::Entry memory_stats_from_last_assign_;
167 168
168 RenderingStatsInstrumentation* rendering_stats_instrumentation_; 169 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
169 170
170 bool did_initialize_visible_tile_; 171 bool did_initialize_visible_tile_;
171 172
172 GLenum texture_format_; 173 GLenum texture_format_;
173 174
174 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; 175 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap;
175 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; 176 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap;
176 LayerPixelRefTaskMap image_decode_tasks_; 177 LayerPixelRefTaskMap image_decode_tasks_;
177 178
179 typedef base::hash_map<ManagedTileId, Tile*> TileMap;
180 TileMap managed_tiles_;
reveman 2013/07/03 20:20:06 This is now the most important container of this c
vmpstr 2013/07/03 23:47:51 Done.
181
178 DISALLOW_COPY_AND_ASSIGN(TileManager); 182 DISALLOW_COPY_AND_ASSIGN(TileManager);
179 }; 183 };
180 184
181 } // namespace cc 185 } // namespace cc
182 186
183 #endif // CC_RESOURCES_TILE_MANAGER_H_ 187 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/resources/tile.cc ('k') | cc/resources/tile_manager.cc » ('j') | cc/resources/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698