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

Side by Side Diff: cc/tile_manager.h

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed tests Created 7 years, 9 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_TILE_MANAGER_H_ 5 #ifndef CC_TILE_MANAGER_H_
6 #define CC_TILE_MANAGER_H_ 6 #define CC_TILE_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/hash_tables.h" 13 #include "base/hash_tables.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "cc/memory_history.h" 16 #include "cc/memory_history.h"
17 #include "cc/picture_pile_impl.h" 17 #include "cc/picture_pile_impl.h"
18 #include "cc/rendering_stats.h" 18 #include "cc/rendering_stats_instrumentation.h"
19 #include "cc/resource_pool.h" 19 #include "cc/resource_pool.h"
20 #include "cc/tile_priority.h" 20 #include "cc/tile_priority.h"
21 #include "cc/worker_pool.h" 21 #include "cc/worker_pool.h"
22 22
23 namespace cc { 23 namespace cc {
24 class RasterWorkerPool; 24 class RasterWorkerPool;
25 class ResourceProvider; 25 class ResourceProvider;
26 class Tile; 26 class Tile;
27 class TileVersion; 27 class TileVersion;
28 28
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // should no longer have any memory assigned to them. Tile objects are "owned" 71 // should no longer have any memory assigned to them. Tile objects are "owned"
72 // by layers; they automatically register with the manager when they are 72 // by layers; they automatically register with the manager when they are
73 // created, and unregister from the manager when they are deleted. 73 // created, and unregister from the manager when they are deleted.
74 class CC_EXPORT TileManager : public WorkerPoolClient { 74 class CC_EXPORT TileManager : public WorkerPoolClient {
75 public: 75 public:
76 TileManager(TileManagerClient* client, 76 TileManager(TileManagerClient* client,
77 ResourceProvider *resource_provider, 77 ResourceProvider *resource_provider,
78 size_t num_raster_threads, 78 size_t num_raster_threads,
79 bool use_cheapess_estimator, 79 bool use_cheapess_estimator,
80 bool use_color_estimator, 80 bool use_color_estimator,
81 bool prediction_benchmarking); 81 bool prediction_benchmarking,
82 RenderingStatsInstrumentation* rendering_stats_instrumentation);
82 virtual ~TileManager(); 83 virtual ~TileManager();
83 84
84 const GlobalStateThatImpactsTilePriority& GlobalState() const { 85 const GlobalStateThatImpactsTilePriority& GlobalState() const {
85 return global_state_; 86 return global_state_;
86 } 87 }
87 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); 88 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state);
88 89
89 void ManageTiles(); 90 void ManageTiles();
90 void CheckForCompletedTileUploads(); 91 void CheckForCompletedTileUploads();
91 void AbortPendingTileUploads(); 92 void AbortPendingTileUploads();
92 void ForceTileUploadToComplete(Tile* tile); 93 void ForceTileUploadToComplete(Tile* tile);
93 void DidCompleteFrame(); 94 void DidCompleteFrame();
94 95
95 scoped_ptr<base::Value> BasicStateAsValue() const; 96 scoped_ptr<base::Value> BasicStateAsValue() const;
96 scoped_ptr<base::Value> AllTilesAsValue() const; 97 scoped_ptr<base::Value> AllTilesAsValue() const;
97 void GetMemoryStats(size_t* memoryRequiredBytes, 98 void GetMemoryStats(size_t* memoryRequiredBytes,
98 size_t* memoryNiceToHaveBytes, 99 size_t* memoryNiceToHaveBytes,
99 size_t* memoryUsedBytes) const; 100 size_t* memoryUsedBytes) const;
100 void SetRecordRenderingStats(bool record_rendering_stats);
101 void GetRenderingStats(RenderingStats* stats);
102 bool HasPendingWorkScheduled(WhichTree tree) const; 101 bool HasPendingWorkScheduled(WhichTree tree) const;
103 102
104 const MemoryHistory::Entry& memory_stats_from_last_assign() const { 103 const MemoryHistory::Entry& memory_stats_from_last_assign() const {
105 return memory_stats_from_last_assign_; 104 return memory_stats_from_last_assign_;
106 } 105 }
107 106
108 // Overridden from WorkerPoolClient: 107 // Overridden from WorkerPoolClient:
109 virtual void DidFinishDispatchingWorkerPoolCompletionCallbacks() OVERRIDE; 108 virtual void DidFinishDispatchingWorkerPoolCompletionCallbacks() OVERRIDE;
110 109
111 protected: 110 protected:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 scoped_refptr<Tile> tile, 156 scoped_refptr<Tile> tile,
158 scoped_ptr<ResourcePool::Resource> resource, 157 scoped_ptr<ResourcePool::Resource> resource,
159 int manage_tiles_call_count_when_dispatched); 158 int manage_tiles_call_count_when_dispatched);
160 void DidFinishTileInitialization(Tile* tile); 159 void DidFinishTileInitialization(Tile* tile);
161 void DidTileRasterStateChange(Tile* tile, TileRasterState state); 160 void DidTileRasterStateChange(Tile* tile, TileRasterState state);
162 void DidTileTreeBinChange(Tile* tile, 161 void DidTileTreeBinChange(Tile* tile,
163 TileManagerBin new_tree_bin, 162 TileManagerBin new_tree_bin,
164 WhichTree tree); 163 WhichTree tree);
165 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; 164 scoped_ptr<Value> GetMemoryRequirementsAsValue() const;
166 165
167 static void RunRasterTask(uint8* buffer, 166 static void RunRasterTask(
168 const gfx::Rect& rect, 167 uint8* buffer,
169 float contents_scale, 168 const gfx::Rect& rect,
170 const RasterTaskMetadata& metadata, 169 float contents_scale,
171 PicturePileImpl* picture_pile, 170 const RasterTaskMetadata& metadata,
172 RenderingStats* stats); 171 RenderingStatsInstrumentation* stats_instrumentation,
173 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, 172 PicturePileImpl* picture_pile);
174 RenderingStats* stats); 173 static void RunImageDecodeTask(
174 skia::LazyPixelRef* pixel_ref,
175 RenderingStatsInstrumentation* stats_instrumentation);
175 176
176 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, 177 static void RecordCheapnessPredictorResults(bool is_predicted_cheap,
177 bool is_actually_cheap); 178 bool is_actually_cheap);
178 static void RecordSolidColorPredictorResults(const SkColor* actual_colors, 179 static void RecordSolidColorPredictorResults(const SkColor* actual_colors,
179 size_t color_count, 180 size_t color_count,
180 bool is_predicted_solid, 181 bool is_predicted_solid,
181 SkColor predicted_color, 182 SkColor predicted_color,
182 bool is_predicted_transparent); 183 bool is_predicted_transparent);
183 184
184 TileManagerClient* client_; 185 TileManagerClient* client_;
(...skipping 18 matching lines...) Expand all
203 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; 204 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap;
204 PixelRefMap pending_decode_tasks_; 205 PixelRefMap pending_decode_tasks_;
205 206
206 typedef std::queue<scoped_refptr<Tile> > TileQueue; 207 typedef std::queue<scoped_refptr<Tile> > TileQueue;
207 TileQueue tiles_with_pending_upload_; 208 TileQueue tiles_with_pending_upload_;
208 size_t bytes_pending_upload_; 209 size_t bytes_pending_upload_;
209 bool has_performed_uploads_since_last_flush_; 210 bool has_performed_uploads_since_last_flush_;
210 bool ever_exceeded_memory_budget_; 211 bool ever_exceeded_memory_budget_;
211 MemoryHistory::Entry memory_stats_from_last_assign_; 212 MemoryHistory::Entry memory_stats_from_last_assign_;
212 213
213 bool record_rendering_stats_; 214 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
214 RenderingStats rendering_stats_;
215 215
216 bool use_cheapness_estimator_; 216 bool use_cheapness_estimator_;
217 bool use_color_estimator_; 217 bool use_color_estimator_;
218 bool did_schedule_cheap_tasks_; 218 bool did_schedule_cheap_tasks_;
219 bool allow_cheap_tasks_; 219 bool allow_cheap_tasks_;
220 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; 220 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS];
221 bool prediction_benchmarking_; 221 bool prediction_benchmarking_;
222 222
223 size_t pending_tasks_; 223 size_t pending_tasks_;
224 size_t max_pending_tasks_; 224 size_t max_pending_tasks_;
225 225
226 DISALLOW_COPY_AND_ASSIGN(TileManager); 226 DISALLOW_COPY_AND_ASSIGN(TileManager);
227 }; 227 };
228 228
229 } // namespace cc 229 } // namespace cc
230 230
231 #endif // CC_TILE_MANAGER_H_ 231 #endif // CC_TILE_MANAGER_H_
OLDNEW
« cc/layer_tree_host.cc ('K') | « cc/thread_proxy.cc ('k') | cc/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698