Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_RENDERING_STATS_RECORDER_H_ | |
| 6 #define CC_RENDERING_STATS_RECORDER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/synchronization/lock.h" | |
| 10 #include "cc/rendering_stats.h" | |
| 11 | |
| 12 namespace cc { | |
| 13 | |
| 14 // RenderingStatsRecorder is shared among threads and manages conditional | |
| 15 // recording of rendering stats into a private RenderingStats instance. | |
| 16 class CC_EXPORT RenderingStatsRecorder { | |
|
egraether
2013/03/12 19:31:42
Nat suggested to name the class RenderingStatsInst
danakj
2013/03/13 17:25:41
I'm okay with either, so I think go with Nat's pre
egraether
2013/03/14 18:58:07
Done.
| |
| 17 public: | |
| 18 static scoped_ptr<RenderingStatsRecorder> create(); | |
| 19 | |
| 20 RenderingStats GetRenderingStats(); | |
| 21 | |
| 22 // Read and write access to the record_rendering_stats_ flag is not locked to | |
| 23 // improve performance. The flag is commonly turned off and hardly changes | |
| 24 // it's value during runtime. | |
| 25 bool record_rendering_stats() const; | |
| 26 void set_record_rendering_stats(bool record_rendering_stats); | |
| 27 | |
| 28 base::TimeTicks StartRecording() const; | |
| 29 base::TimeDelta EndRecording(base::TimeTicks start_time) const; | |
| 30 | |
| 31 // TODO: Remove after switching Layer::update() to use this class. | |
| 32 // Used in LayerTreeHost::paintLayerContents(). | |
| 33 void AddStats(const RenderingStats& other); | |
| 34 | |
| 35 void IncrementAnimationFrameCount(); | |
| 36 void SetScreenAndDroppedFrameCount(int64 screen_total, int64 dropped_total); | |
| 37 | |
| 38 void AddCommit(base::TimeDelta duration); | |
| 39 void AddPaint(base::TimeDelta duration, int64 pixels); | |
| 40 void AddRaster(base::TimeDelta duration, | |
| 41 int64 pixels, | |
| 42 bool is_in_pending_tree_now_bin); | |
| 43 | |
| 44 void IncrementImplThreadScrolls(); | |
| 45 void IncrementMainThreadScrolls(); | |
| 46 | |
| 47 void AddLayersDrawn(int64 amount); | |
| 48 void AddMissingTiles(int64 amount); | |
| 49 | |
| 50 void AddDeferredImageDecode(base::TimeDelta duration); | |
| 51 void AddImageGathering(base::TimeDelta duration); | |
| 52 | |
| 53 void IncrementDeferredImageCacheHitCount(); | |
| 54 | |
| 55 private: | |
| 56 RenderingStatsRecorder(); | |
| 57 | |
| 58 RenderingStats rendering_stats_; | |
| 59 bool record_rendering_stats_; | |
| 60 | |
| 61 base::Lock lock_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(RenderingStatsRecorder); | |
| 64 }; | |
| 65 | |
| 66 } // namespace cc | |
| 67 | |
| 68 #endif // CC_RENDERING_STATS_RECORDER_H_ | |
| OLD | NEW |