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

Side by Side Diff: cc/resources/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: Updated all 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
« no previous file with comments | « cc/resources/raster_worker_pool.cc ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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/base/worker_pool.h" 16 #include "cc/base/worker_pool.h"
17 #include "cc/debug/rendering_stats.h" 17 #include "cc/debug/rendering_stats_instrumentation.h"
18 #include "cc/resources/memory_history.h" 18 #include "cc/resources/memory_history.h"
19 #include "cc/resources/picture_pile_impl.h" 19 #include "cc/resources/picture_pile_impl.h"
20 #include "cc/resources/resource_pool.h" 20 #include "cc/resources/resource_pool.h"
21 #include "cc/resources/tile_priority.h" 21 #include "cc/resources/tile_priority.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;
(...skipping 43 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 SetAnticipatedDrawTime(base::TimeTicks time); 94 void SetAnticipatedDrawTime(base::TimeTicks time);
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* memory_required_bytes, 98 void GetMemoryStats(size_t* memoryRequiredBytes,
98 size_t* memory_nice_to_have_bytes, 99 size_t* memoryNiceToHaveBytes,
99 size_t* memory_used_bytes) 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 scoped_refptr<Tile> tile, 157 scoped_refptr<Tile> tile,
159 scoped_ptr<ResourcePool::Resource> resource, 158 scoped_ptr<ResourcePool::Resource> resource,
160 int manage_tiles_call_count_when_dispatched); 159 int manage_tiles_call_count_when_dispatched);
161 void DidFinishTileInitialization(Tile* tile); 160 void DidFinishTileInitialization(Tile* tile);
162 void DidTileRasterStateChange(Tile* tile, TileRasterState state); 161 void DidTileRasterStateChange(Tile* tile, TileRasterState state);
163 void DidTileTreeBinChange(Tile* tile, 162 void DidTileTreeBinChange(Tile* tile,
164 TileManagerBin new_tree_bin, 163 TileManagerBin new_tree_bin,
165 WhichTree tree); 164 WhichTree tree);
166 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; 165 scoped_ptr<Value> GetMemoryRequirementsAsValue() const;
167 166
168 static void RunRasterTask(uint8* buffer, 167 static void RunRasterTask(
169 const gfx::Rect& rect, 168 uint8* buffer,
170 float contents_scale, 169 const gfx::Rect& rect,
171 const RasterTaskMetadata& metadata, 170 float contents_scale,
172 PicturePileImpl* picture_pile, 171 const RasterTaskMetadata& metadata,
173 RenderingStats* stats); 172 RenderingStatsInstrumentation* stats_instrumentation,
174 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, 173 PicturePileImpl* picture_pile);
175 RenderingStats* stats); 174 static void RunImageDecodeTask(
175 skia::LazyPixelRef* pixel_ref,
176 RenderingStatsInstrumentation* stats_instrumentation);
176 177
177 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, 178 static void RecordCheapnessPredictorResults(bool is_predicted_cheap,
178 bool is_actually_cheap); 179 bool is_actually_cheap);
179 static void RecordSolidColorPredictorResults(const SkColor* actual_colors, 180 static void RecordSolidColorPredictorResults(const SkColor* actual_colors,
180 size_t color_count, 181 size_t color_count,
181 bool is_predicted_solid, 182 bool is_predicted_solid,
182 SkColor predicted_color, 183 SkColor predicted_color,
183 bool is_predicted_transparent); 184 bool is_predicted_transparent);
184 185
185 TileManagerClient* client_; 186 TileManagerClient* client_;
(...skipping 18 matching lines...) Expand all
204 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; 205 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap;
205 PixelRefMap pending_decode_tasks_; 206 PixelRefMap pending_decode_tasks_;
206 207
207 typedef std::queue<scoped_refptr<Tile> > TileQueue; 208 typedef std::queue<scoped_refptr<Tile> > TileQueue;
208 TileQueue tiles_with_pending_upload_; 209 TileQueue tiles_with_pending_upload_;
209 size_t bytes_pending_upload_; 210 size_t bytes_pending_upload_;
210 bool has_performed_uploads_since_last_flush_; 211 bool has_performed_uploads_since_last_flush_;
211 bool ever_exceeded_memory_budget_; 212 bool ever_exceeded_memory_budget_;
212 MemoryHistory::Entry memory_stats_from_last_assign_; 213 MemoryHistory::Entry memory_stats_from_last_assign_;
213 214
214 bool record_rendering_stats_; 215 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
215 RenderingStats rendering_stats_;
216 216
217 bool use_cheapness_estimator_; 217 bool use_cheapness_estimator_;
218 bool use_color_estimator_; 218 bool use_color_estimator_;
219 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; 219 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS];
220 bool prediction_benchmarking_; 220 bool prediction_benchmarking_;
221 221
222 size_t pending_tasks_; 222 size_t pending_tasks_;
223 size_t max_pending_tasks_; 223 size_t max_pending_tasks_;
224 224
225 base::TimeTicks anticipated_draw_time_; 225 base::TimeTicks anticipated_draw_time_;
226 226
227 DISALLOW_COPY_AND_ASSIGN(TileManager); 227 DISALLOW_COPY_AND_ASSIGN(TileManager);
228 }; 228 };
229 229
230 } // namespace cc 230 } // namespace cc
231 231
232 #endif // CC_RESOURCES_TILE_MANAGER_H_ 232 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_worker_pool.cc ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698