Roll src/third_party/WebKit ab95326:36dc91c (svn 201244:201246)
[chromium-blink-merge.git] / cc / scheduler / compositor_timing_history.h
blobf846d8f7ea1e2c1fa427846e5ef905539850b7f6
1 // Copyright 2014 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.
5 #ifndef CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
6 #define CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/rolling_time_delta_history.h"
11 namespace base {
12 namespace trace_event {
13 class TracedValue;
14 } // namespace trace_event
15 } // namespace base
17 namespace cc {
19 class RenderingStatsInstrumentation;
21 class CC_EXPORT CompositorTimingHistory {
22 public:
23 enum UMACategory {
24 RENDERER_UMA,
25 BROWSER_UMA,
26 NULL_UMA,
28 class UMAReporter;
30 CompositorTimingHistory(
31 UMACategory uma_category,
32 RenderingStatsInstrumentation* rendering_stats_instrumentation);
33 virtual ~CompositorTimingHistory();
35 void AsValueInto(base::trace_event::TracedValue* state) const;
37 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() const;
38 virtual base::TimeDelta CommitToReadyToActivateDurationEstimate() const;
39 virtual base::TimeDelta PrepareTilesDurationEstimate() const;
40 virtual base::TimeDelta ActivateDurationEstimate() const;
41 virtual base::TimeDelta DrawDurationEstimate() const;
43 void SetRecordingEnabled(bool enabled);
45 void WillBeginMainFrame();
46 void BeginMainFrameAborted();
47 void DidCommit();
48 void WillPrepareTiles();
49 void DidPrepareTiles();
50 void ReadyToActivate();
51 void WillActivate();
52 void DidActivate();
53 void WillDraw();
54 void DidDraw();
56 protected:
57 static scoped_ptr<UMAReporter> CreateUMAReporter(UMACategory category);
58 virtual base::TimeTicks Now() const;
60 bool AffectsEstimate() const;
62 bool enabled_;
63 int draws_left_before_estimates_affected_;
65 RollingTimeDeltaHistory begin_main_frame_to_commit_duration_history_;
66 RollingTimeDeltaHistory commit_to_ready_to_activate_duration_history_;
67 RollingTimeDeltaHistory prepare_tiles_duration_history_;
68 RollingTimeDeltaHistory activate_duration_history_;
69 RollingTimeDeltaHistory draw_duration_history_;
71 base::TimeTicks begin_main_frame_sent_time_;
72 base::TimeTicks commit_time_;
73 base::TimeTicks start_prepare_tiles_time_;
74 base::TimeTicks start_activate_time_;
75 base::TimeTicks start_draw_time_;
77 scoped_ptr<UMAReporter> uma_reporter_;
78 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
80 private:
81 DISALLOW_COPY_AND_ASSIGN(CompositorTimingHistory);
84 } // namespace cc
86 #endif // CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_