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

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

Issue 17351017: Re-land: cc: Add raster finished signals to RasterWorkerPool. (Closed) Base URL: http://git.chromium.org/chromium/src.git@new-graph-build
Patch Set: vmpstr's review Created 7 years, 6 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 scoped_ptr<base::Value> AllTilesAsValue() const; 83 scoped_ptr<base::Value> AllTilesAsValue() const;
84 void GetMemoryStats(size_t* memory_required_bytes, 84 void GetMemoryStats(size_t* memory_required_bytes,
85 size_t* memory_nice_to_have_bytes, 85 size_t* memory_nice_to_have_bytes,
86 size_t* memory_used_bytes) const; 86 size_t* memory_used_bytes) const;
87 87
88 const MemoryHistory::Entry& memory_stats_from_last_assign() const { 88 const MemoryHistory::Entry& memory_stats_from_last_assign() const {
89 return memory_stats_from_last_assign_; 89 return memory_stats_from_last_assign_;
90 } 90 }
91 91
92 bool AreTilesRequiredForActivationReady() const { 92 bool AreTilesRequiredForActivationReady() const {
93 return tiles_that_need_to_be_initialized_for_activation_.empty(); 93 return tiles_that_need_to_be_initialized_for_activation_.empty() &&
94 oom_tiles_that_need_to_be_initialized_for_activation_.empty();
94 } 95 }
95 96
96 protected: 97 protected:
97 TileManager(TileManagerClient* client, 98 TileManager(TileManagerClient* client,
98 ResourceProvider* resource_provider, 99 ResourceProvider* resource_provider,
99 scoped_ptr<RasterWorkerPool> raster_worker_pool, 100 scoped_ptr<RasterWorkerPool> raster_worker_pool,
100 size_t num_raster_threads, 101 size_t num_raster_threads,
101 bool use_color_estimator, 102 bool use_color_estimator,
102 RenderingStatsInstrumentation* rendering_stats_instrumentation, 103 RenderingStatsInstrumentation* rendering_stats_instrumentation,
103 GLenum texture_format); 104 GLenum texture_format);
104 105
105 // Methods called by Tile 106 // Methods called by Tile
106 friend class Tile; 107 friend class Tile;
107 void RegisterTile(Tile* tile); 108 void RegisterTile(Tile* tile);
108 void UnregisterTile(Tile* tile); 109 void UnregisterTile(Tile* tile);
109 110
110 // Overriden from RasterWorkerPoolClient: 111 // Overriden from RasterWorkerPoolClient:
111 virtual bool ShouldForceTasksRequiredForActivationToComplete() const 112 virtual bool ShouldForceTasksRequiredForActivationToComplete() const
112 OVERRIDE; 113 OVERRIDE;
114 virtual void DidFinishedRunningTasks() OVERRIDE;
115 virtual void DidFinishedRunningTasksRequiredForActivation() OVERRIDE;
113 116
114 // Virtual for test 117 // Virtual for test
115 virtual void ScheduleTasks(); 118 virtual void ScheduleTasks();
116 119
120 const std::vector<Tile*>& tiles_that_need_to_be_rasterized() const {
121 return tiles_that_need_to_be_rasterized_;
122 }
123
124 void ReassignGpuMemoryToOOMTilesRequiredForActivation();
125
117 private: 126 private:
118 void OnImageDecodeTaskCompleted( 127 void OnImageDecodeTaskCompleted(
119 int layer_id, 128 int layer_id,
120 skia::LazyPixelRef* pixel_ref, 129 skia::LazyPixelRef* pixel_ref,
121 bool was_canceled); 130 bool was_canceled);
122 void OnRasterTaskCompleted( 131 void OnRasterTaskCompleted(
123 scoped_refptr<Tile> tile, 132 scoped_refptr<Tile> tile,
124 scoped_ptr<ResourcePool::Resource> resource, 133 scoped_ptr<ResourcePool::Resource> resource,
125 RasterMode raster_mode, 134 RasterMode raster_mode,
126 const PicturePileImpl::Analysis& analysis, 135 const PicturePileImpl::Analysis& analysis,
(...skipping 21 matching lines...) Expand all
148 TileManagerClient* client_; 157 TileManagerClient* client_;
149 scoped_ptr<ResourcePool> resource_pool_; 158 scoped_ptr<ResourcePool> resource_pool_;
150 scoped_ptr<RasterWorkerPool> raster_worker_pool_; 159 scoped_ptr<RasterWorkerPool> raster_worker_pool_;
151 GlobalStateThatImpactsTilePriority global_state_; 160 GlobalStateThatImpactsTilePriority global_state_;
152 161
153 typedef std::vector<Tile*> TileVector; 162 typedef std::vector<Tile*> TileVector;
154 TileVector tiles_; 163 TileVector tiles_;
155 TileVector tiles_that_need_to_be_rasterized_; 164 TileVector tiles_that_need_to_be_rasterized_;
156 typedef std::set<Tile*> TileSet; 165 typedef std::set<Tile*> TileSet;
157 TileSet tiles_that_need_to_be_initialized_for_activation_; 166 TileSet tiles_that_need_to_be_initialized_for_activation_;
167 TileSet oom_tiles_that_need_to_be_initialized_for_activation_;
158 168
159 bool ever_exceeded_memory_budget_; 169 bool ever_exceeded_memory_budget_;
160 MemoryHistory::Entry memory_stats_from_last_assign_; 170 MemoryHistory::Entry memory_stats_from_last_assign_;
161 171
162 RenderingStatsInstrumentation* rendering_stats_instrumentation_; 172 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
163 173
164 bool use_color_estimator_; 174 bool use_color_estimator_;
165 bool did_initialize_visible_tile_; 175 bool did_initialize_visible_tile_;
166 176
167 GLenum texture_format_; 177 GLenum texture_format_;
168 178
169 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; 179 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap;
170 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; 180 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap;
171 LayerPixelRefTaskMap image_decode_tasks_; 181 LayerPixelRefTaskMap image_decode_tasks_;
172 182
173 DISALLOW_COPY_AND_ASSIGN(TileManager); 183 DISALLOW_COPY_AND_ASSIGN(TileManager);
174 }; 184 };
175 185
176 } // namespace cc 186 } // namespace cc
177 187
178 #endif // CC_RESOURCES_TILE_MANAGER_H_ 188 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698