cc: Move timing history to the Scheduler.

BUG=406158
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1184863004

Cr-Commit-Position: refs/heads/master@{#335866}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index ee58f6f3..de54f0d 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -412,6 +412,8 @@
     "scheduler/begin_frame_tracker.cc",
     "scheduler/begin_frame_tracker.h",
     "scheduler/commit_earlyout_reason.h",
+    "scheduler/compositor_timing_history.cc",
+    "scheduler/compositor_timing_history.h",
     "scheduler/delay_based_time_source.cc",
     "scheduler/delay_based_time_source.h",
     "scheduler/draw_result.h",
@@ -480,8 +482,6 @@
     "trees/property_tree_builder.h",
     "trees/proxy.cc",
     "trees/proxy.h",
-    "trees/proxy_timing_history.cc",
-    "trees/proxy_timing_history.h",
     "trees/scoped_abort_remaining_swap_promises.h",
     "trees/single_thread_proxy.cc",
     "trees/single_thread_proxy.h",
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 9c22d555..dc86881 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -469,6 +469,8 @@
         'scheduler/begin_frame_tracker.cc',
         'scheduler/begin_frame_tracker.h',
         'scheduler/commit_earlyout_reason.h',
+        'scheduler/compositor_timing_history.cc',
+        'scheduler/compositor_timing_history.h',
         'scheduler/delay_based_time_source.cc',
         'scheduler/delay_based_time_source.h',
         'scheduler/draw_result.h',
@@ -537,8 +539,6 @@
         'trees/property_tree_builder.h',
         'trees/proxy.cc',
         'trees/proxy.h',
-        'trees/proxy_timing_history.cc',
-        'trees/proxy_timing_history.h',
         'trees/scoped_abort_remaining_swap_promises.h',
         'trees/single_thread_proxy.cc',
         'trees/single_thread_proxy.h',
diff --git a/cc/trees/proxy_timing_history.cc b/cc/scheduler/compositor_timing_history.cc
similarity index 74%
rename from cc/trees/proxy_timing_history.cc
rename to cc/scheduler/compositor_timing_history.cc
index 90abad1..7dcd9eac 100644
--- a/cc/trees/proxy_timing_history.cc
+++ b/cc/scheduler/compositor_timing_history.cc
@@ -2,9 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "cc/trees/proxy_timing_history.h"
+#include "cc/scheduler/compositor_timing_history.h"
 
 #include "base/metrics/histogram.h"
+#include "base/trace_event/trace_event.h"
+#include "cc/debug/rendering_stats_instrumentation.h"
 
 const size_t kDurationHistorySize = 60;
 const double kCommitAndActivationDurationEstimationPercentile = 50.0;
@@ -13,7 +15,7 @@
 
 namespace cc {
 
-ProxyTimingHistory::ProxyTimingHistory(
+CompositorTimingHistory::CompositorTimingHistory(
     RenderingStatsInstrumentation* rendering_stats_instrumentation)
     : draw_duration_history_(kDurationHistorySize),
       begin_main_frame_to_commit_duration_history_(kDurationHistorySize),
@@ -21,9 +23,20 @@
       rendering_stats_instrumentation_(rendering_stats_instrumentation) {
 }
 
-ProxyTimingHistory::~ProxyTimingHistory() {}
+CompositorTimingHistory::~CompositorTimingHistory() {
+}
 
-base::TimeDelta ProxyTimingHistory::DrawDurationEstimate() const {
+void CompositorTimingHistory::AsValueInto(
+    base::trace_event::TracedValue* state) const {
+  state->SetDouble("begin_main_frame_to_commit_duration_estimate_ms",
+                   BeginMainFrameToCommitDurationEstimate().InMillisecondsF());
+  state->SetDouble("commit_to_activate_duration_estimate_ms",
+                   CommitToActivateDurationEstimate().InMillisecondsF());
+  state->SetDouble("draw_duration_estimate_ms",
+                   DrawDurationEstimate().InMillisecondsF());
+}
+
+base::TimeDelta CompositorTimingHistory::DrawDurationEstimate() const {
   base::TimeDelta historical_estimate =
       draw_duration_history_.Percentile(kDrawDurationEstimationPercentile);
   base::TimeDelta padding = base::TimeDelta::FromMicroseconds(
@@ -31,22 +44,23 @@
   return historical_estimate + padding;
 }
 
-base::TimeDelta ProxyTimingHistory::BeginMainFrameToCommitDurationEstimate()
-    const {
+base::TimeDelta
+CompositorTimingHistory::BeginMainFrameToCommitDurationEstimate() const {
   return begin_main_frame_to_commit_duration_history_.Percentile(
       kCommitAndActivationDurationEstimationPercentile);
 }
 
-base::TimeDelta ProxyTimingHistory::CommitToActivateDurationEstimate() const {
+base::TimeDelta CompositorTimingHistory::CommitToActivateDurationEstimate()
+    const {
   return commit_to_activate_duration_history_.Percentile(
       kCommitAndActivationDurationEstimationPercentile);
 }
 
-void ProxyTimingHistory::DidBeginMainFrame() {
+void CompositorTimingHistory::WillBeginMainFrame() {
   begin_main_frame_sent_time_ = base::TimeTicks::Now();
 }
 
-void ProxyTimingHistory::DidCommit() {
+void CompositorTimingHistory::DidCommit() {
   commit_complete_time_ = base::TimeTicks::Now();
   base::TimeDelta begin_main_frame_to_commit_duration =
       commit_complete_time_ - begin_main_frame_sent_time_;
@@ -62,7 +76,7 @@
       begin_main_frame_to_commit_duration);
 }
 
-void ProxyTimingHistory::DidActivateSyncTree() {
+void CompositorTimingHistory::DidActivateSyncTree() {
   base::TimeDelta commit_to_activate_duration =
       base::TimeTicks::Now() - commit_complete_time_;
 
@@ -76,11 +90,11 @@
       commit_to_activate_duration);
 }
 
-void ProxyTimingHistory::DidStartDrawing() {
+void CompositorTimingHistory::DidStartDrawing() {
   start_draw_time_ = base::TimeTicks::Now();
 }
 
-void ProxyTimingHistory::DidFinishDrawing() {
+void CompositorTimingHistory::DidFinishDrawing() {
   base::TimeDelta draw_duration = base::TimeTicks::Now() - start_draw_time_;
 
   // Before adding the new data point to the timing history, see what we would
@@ -95,7 +109,7 @@
   draw_duration_history_.InsertSample(draw_duration);
 }
 
-void ProxyTimingHistory::AddDrawDurationUMA(
+void CompositorTimingHistory::AddDrawDurationUMA(
     base::TimeDelta draw_duration,
     base::TimeDelta draw_duration_estimate) {
   base::TimeDelta draw_duration_overestimate;
@@ -104,21 +118,17 @@
     draw_duration_underestimate = draw_duration - draw_duration_estimate;
   else
     draw_duration_overestimate = draw_duration_estimate - draw_duration;
-  UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDuration",
-                             draw_duration,
+  UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDuration", draw_duration,
                              base::TimeDelta::FromMilliseconds(1),
-                             base::TimeDelta::FromMilliseconds(100),
-                             50);
+                             base::TimeDelta::FromMilliseconds(100), 50);
   UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationUnderestimate",
                              draw_duration_underestimate,
                              base::TimeDelta::FromMilliseconds(1),
-                             base::TimeDelta::FromMilliseconds(100),
-                             50);
+                             base::TimeDelta::FromMilliseconds(100), 50);
   UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.DrawDurationOverestimate",
                              draw_duration_overestimate,
                              base::TimeDelta::FromMilliseconds(1),
-                             base::TimeDelta::FromMilliseconds(100),
-                             50);
+                             base::TimeDelta::FromMilliseconds(100), 50);
 }
 
 }  // namespace cc
diff --git a/cc/scheduler/compositor_timing_history.h b/cc/scheduler/compositor_timing_history.h
new file mode 100644
index 0000000..41a8484
--- /dev/null
+++ b/cc/scheduler/compositor_timing_history.h
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
+#define CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
+
+#include "cc/base/rolling_time_delta_history.h"
+
+namespace base {
+namespace trace_event {
+class TracedValue;
+}  // namespace trace_event
+}  // namespace base
+
+namespace cc {
+
+class RenderingStatsInstrumentation;
+
+class CC_EXPORT CompositorTimingHistory {
+ public:
+  explicit CompositorTimingHistory(
+      RenderingStatsInstrumentation* rendering_stats_instrumentation);
+  virtual ~CompositorTimingHistory();
+
+  void AsValueInto(base::trace_event::TracedValue* state) const;
+
+  virtual base::TimeDelta DrawDurationEstimate() const;
+  virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() const;
+  virtual base::TimeDelta CommitToActivateDurationEstimate() const;
+
+  void WillBeginMainFrame();
+  void DidCommit();
+  void DidActivateSyncTree();
+  void DidStartDrawing();
+  void DidFinishDrawing();
+
+ protected:
+  void AddDrawDurationUMA(base::TimeDelta draw_duration,
+                          base::TimeDelta draw_duration_estimate);
+
+  RollingTimeDeltaHistory draw_duration_history_;
+  RollingTimeDeltaHistory begin_main_frame_to_commit_duration_history_;
+  RollingTimeDeltaHistory commit_to_activate_duration_history_;
+
+  base::TimeTicks begin_main_frame_sent_time_;
+  base::TimeTicks commit_complete_time_;
+  base::TimeTicks start_draw_time_;
+
+  RenderingStatsInstrumentation* rendering_stats_instrumentation_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(CompositorTimingHistory);
+};
+
+}  // namespace cc
+
+#endif  // CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 6d6ab2a..06d7aa11 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -14,6 +14,7 @@
 #include "base/trace_event/trace_event_argument.h"
 #include "cc/debug/devtools_instrumentation.h"
 #include "cc/debug/traced_value.h"
+#include "cc/scheduler/compositor_timing_history.h"
 #include "cc/scheduler/delay_based_time_source.h"
 
 namespace cc {
@@ -23,7 +24,8 @@
     const SchedulerSettings& settings,
     int layer_tree_host_id,
     base::SingleThreadTaskRunner* task_runner,
-    BeginFrameSource* external_frame_source) {
+    BeginFrameSource* external_frame_source,
+    scoped_ptr<CompositorTimingHistory> compositor_timing_history) {
   scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source;
   if (!settings.use_external_begin_frame_source) {
     synthetic_frame_source = SyntheticBeginFrameSource::Create(
@@ -33,7 +35,8 @@
       BackToBackBeginFrameSource::Create(task_runner);
   return make_scoped_ptr(new Scheduler(
       client, settings, layer_tree_host_id, task_runner, external_frame_source,
-      synthetic_frame_source.Pass(), unthrottled_frame_source.Pass()));
+      synthetic_frame_source.Pass(), unthrottled_frame_source.Pass(),
+      compositor_timing_history.Pass()));
 }
 
 Scheduler::Scheduler(
@@ -43,7 +46,8 @@
     base::SingleThreadTaskRunner* task_runner,
     BeginFrameSource* external_frame_source,
     scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source,
-    scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source)
+    scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source,
+    scoped_ptr<CompositorTimingHistory> compositor_timing_history)
     : settings_(settings),
       client_(client),
       layer_tree_host_id_(layer_tree_host_id),
@@ -53,6 +57,7 @@
       unthrottled_frame_source_(unthrottled_frame_source.Pass()),
       frame_source_(BeginFrameSourceMultiplexer::Create()),
       throttle_frame_production_(false),
+      compositor_timing_history_(compositor_timing_history.Pass()),
       begin_impl_frame_deadline_mode_(
           SchedulerStateMachine::BEGIN_IMPL_FRAME_DEADLINE_MODE_NONE),
       begin_impl_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE),
@@ -439,7 +444,7 @@
                  "MainThreadLatency", main_thread_is_in_high_latency_mode);
 
   BeginFrameArgs adjusted_args = args;
-  adjusted_args.deadline -= client_->DrawDurationEstimate();
+  adjusted_args.deadline -= compositor_timing_history_->DrawDurationEstimate();
 
   if (!state_machine_.impl_latency_takes_priority() &&
       main_thread_is_in_high_latency_mode &&
@@ -574,8 +579,16 @@
 }
 
 void Scheduler::DrawAndSwapIfPossible() {
+  compositor_timing_history_->DidStartDrawing();
   DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible();
   state_machine_.DidDrawIfPossibleCompleted(result);
+  compositor_timing_history_->DidFinishDrawing();
+}
+
+void Scheduler::DrawAndSwapForced() {
+  compositor_timing_history_->DidStartDrawing();
+  client_->ScheduledActionDrawAndSwapForced();
+  compositor_timing_history_->DidFinishDrawing();
 }
 
 void Scheduler::SetDeferCommits(bool defer_commits) {
@@ -614,6 +627,7 @@
         client_->ScheduledActionAnimate();
         break;
       case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
+        compositor_timing_history_->WillBeginMainFrame();
         client_->ScheduledActionSendBeginMainFrame();
         break;
       case SchedulerStateMachine::ACTION_COMMIT: {
@@ -623,10 +637,12 @@
             FROM_HERE_WITH_EXPLICIT_FUNCTION(
                 "461509 Scheduler::ProcessScheduledActions4"));
         client_->ScheduledActionCommit();
+        compositor_timing_history_->DidCommit();
         break;
       }
       case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
         client_->ScheduledActionActivateSyncTree();
+        compositor_timing_history_->DidActivateSyncTree();
         break;
       case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: {
         // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
@@ -638,7 +654,7 @@
         break;
       }
       case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED:
-        client_->ScheduledActionDrawAndSwapForced();
+        DrawAndSwapForced();
         break;
       case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT:
         // No action is actually performed, but this allows the state machine to
@@ -703,15 +719,8 @@
   state->EndDictionary();
   state->EndDictionary();
 
-  state->BeginDictionary("client_state");
-  state->SetDouble("draw_duration_estimate_ms",
-                   client_->DrawDurationEstimate().InMillisecondsF());
-  state->SetDouble(
-      "begin_main_frame_to_commit_duration_estimate_ms",
-      client_->BeginMainFrameToCommitDurationEstimate().InMillisecondsF());
-  state->SetDouble(
-      "commit_to_activate_duration_estimate_ms",
-      client_->CommitToActivateDurationEstimate().InMillisecondsF());
+  state->BeginDictionary("compositor_timing_history");
+  compositor_timing_history_->AsValueInto(state);
   state->EndDictionary();
 }
 
@@ -722,8 +731,9 @@
   // Check if the main thread computation and commit can be finished before the
   // impl thread's deadline.
   base::TimeTicks estimated_draw_time =
-      args.frame_time + client_->BeginMainFrameToCommitDurationEstimate() +
-      client_->CommitToActivateDurationEstimate();
+      args.frame_time +
+      compositor_timing_history_->BeginMainFrameToCommitDurationEstimate() +
+      compositor_timing_history_->CommitToActivateDurationEstimate();
 
   TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
                "CanCommitAndActivateBeforeDeadline",
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 6ffdf3f..3bf4f7f 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -30,6 +30,8 @@
 
 namespace cc {
 
+class CompositorTimingHistory;
+
 class SchedulerClient {
  public:
   virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0;
@@ -42,9 +44,6 @@
   virtual void ScheduledActionBeginOutputSurfaceCreation() = 0;
   virtual void ScheduledActionPrepareTiles() = 0;
   virtual void ScheduledActionInvalidateOutputSurface() = 0;
-  virtual base::TimeDelta DrawDurationEstimate() = 0;
-  virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0;
-  virtual base::TimeDelta CommitToActivateDurationEstimate() = 0;
   virtual void DidFinishImplFrame() = 0;
   virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) = 0;
   virtual void SendBeginMainFrameNotExpectedSoon() = 0;
@@ -60,7 +59,8 @@
       const SchedulerSettings& scheduler_settings,
       int layer_tree_host_id,
       base::SingleThreadTaskRunner* task_runner,
-      BeginFrameSource* external_frame_source);
+      BeginFrameSource* external_frame_source,
+      scoped_ptr<CompositorTimingHistory> compositor_timing_history);
 
   ~Scheduler() override;
 
@@ -153,10 +153,10 @@
             base::SingleThreadTaskRunner* task_runner,
             BeginFrameSource* external_frame_source,
             scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source,
-            scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source);
+            scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source,
+            scoped_ptr<CompositorTimingHistory> compositor_timing_history);
 
-  // virtual for testing - Don't call these in the constructor or
-  // destructor!
+  // Virtual for testing.
   virtual base::TimeTicks Now() const;
 
   const SchedulerSettings settings_;
@@ -173,6 +173,7 @@
   base::TimeDelta authoritative_vsync_interval_;
   base::TimeTicks last_vsync_timebase_;
 
+  scoped_ptr<CompositorTimingHistory> compositor_timing_history_;
   base::TimeDelta estimated_parent_draw_time_;
 
   std::deque<BeginFrameArgs> begin_retro_frame_args_;
@@ -195,6 +196,7 @@
   void SetupNextBeginFrameIfNeeded();
   void PostBeginRetroFrameIfNeeded();
   void DrawAndSwapIfPossible();
+  void DrawAndSwapForced();
   void ProcessScheduledActions();
   bool CanCommitAndActivateBeforeDeadline() const;
   void AdvanceCommitStateIfPossible();
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index af083034..beeb767 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -141,13 +141,6 @@
     actions_.push_back("ScheduledActionInvalidateOutputSurface");
     states_.push_back(scheduler_->AsValue());
   }
-  base::TimeDelta DrawDurationEstimate() override { return base::TimeDelta(); }
-  base::TimeDelta BeginMainFrameToCommitDurationEstimate() override {
-    return base::TimeDelta();
-  }
-  base::TimeDelta CommitToActivateDurationEstimate() override {
-    return base::TimeDelta();
-  }
 
   void SendBeginFramesToChildren(const BeginFrameArgs& args) override {
     begin_frame_args_sent_to_children_ = args;
@@ -193,31 +186,6 @@
   TestScheduler* scheduler_;
 };
 
-class SchedulerClientWithFixedEstimates : public FakeSchedulerClient {
- public:
-  SchedulerClientWithFixedEstimates(
-      base::TimeDelta draw_duration,
-      base::TimeDelta begin_main_frame_to_commit_duration,
-      base::TimeDelta commit_to_activate_duration)
-      : draw_duration_(draw_duration),
-        begin_main_frame_to_commit_duration_(
-            begin_main_frame_to_commit_duration),
-        commit_to_activate_duration_(commit_to_activate_duration) {}
-
-  base::TimeDelta DrawDurationEstimate() override { return draw_duration_; }
-  base::TimeDelta BeginMainFrameToCommitDurationEstimate() override {
-    return begin_main_frame_to_commit_duration_;
-  }
-  base::TimeDelta CommitToActivateDurationEstimate() override {
-    return commit_to_activate_duration_;
-  }
-
- private:
-  base::TimeDelta draw_duration_;
-  base::TimeDelta begin_main_frame_to_commit_duration_;
-  base::TimeDelta commit_to_activate_duration_;
-};
-
 class FakeExternalBeginFrameSource : public BeginFrameSourceBase {
  public:
   explicit FakeExternalBeginFrameSource(FakeSchedulerClient* client)
@@ -262,9 +230,15 @@
       fake_external_begin_frame_source_.reset(
           new FakeExternalBeginFrameSource(client_.get()));
     }
+
+    scoped_ptr<FakeCompositorTimingHistory> fake_compositor_timing_history =
+        FakeCompositorTimingHistory::Create();
+    fake_compositor_timing_history_ = fake_compositor_timing_history.get();
+
     scheduler_ = TestScheduler::Create(
         now_src_.get(), client_.get(), scheduler_settings_, 0,
-        task_runner_.get(), fake_external_begin_frame_source_.get());
+        task_runner_.get(), fake_external_begin_frame_source_.get(),
+        fake_compositor_timing_history.Pass());
     DCHECK(scheduler_);
     client_->set_scheduler(scheduler_.get());
     return scheduler_.get();
@@ -422,6 +396,7 @@
   SchedulerSettings scheduler_settings_;
   scoped_ptr<FakeSchedulerClient> client_;
   scoped_ptr<TestScheduler> scheduler_;
+  FakeCompositorTimingHistory* fake_compositor_timing_history_;
 };
 
 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) {
@@ -473,13 +448,14 @@
 
 TEST_F(SchedulerTest, SendBeginFramesToChildrenDeadlineNotAdjusted) {
   // Set up client with specified estimates.
-  SchedulerClientWithFixedEstimates* client =
-      new SchedulerClientWithFixedEstimates(
-          base::TimeDelta::FromMilliseconds(1),
-          base::TimeDelta::FromMilliseconds(2),
-          base::TimeDelta::FromMilliseconds(4));
   scheduler_settings_.use_external_begin_frame_source = true;
-  SetUpScheduler(make_scoped_ptr(client).Pass(), true);
+  SetUpScheduler(true);
+  fake_compositor_timing_history_->SetDrawDurationEstimate(
+      base::TimeDelta::FromMilliseconds(1));
+  fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
+      base::TimeDelta::FromMilliseconds(2));
+  fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+      base::TimeDelta::FromMilliseconds(4));
 
   EXPECT_FALSE(client_->needs_begin_frames());
   scheduler_->SetChildrenNeedBeginFrames(true);
@@ -1318,16 +1294,16 @@
     int64 commit_to_activate_estimate_in_ms,
     bool impl_latency_takes_priority,
     bool should_send_begin_main_frame) {
-  // Set up client with specified estimates (draw duration is set to 1).
-  SchedulerClientWithFixedEstimates* client =
-      new SchedulerClientWithFixedEstimates(
-          base::TimeDelta::FromMilliseconds(1),
-          base::TimeDelta::FromMilliseconds(
-              begin_main_frame_to_commit_estimate_in_ms),
-          base::TimeDelta::FromMilliseconds(commit_to_activate_estimate_in_ms));
-
   scheduler_settings_.use_external_begin_frame_source = true;
-  SetUpScheduler(make_scoped_ptr(client).Pass(), true);
+  SetUpScheduler(true);
+
+  fake_compositor_timing_history_->SetDrawDurationEstimate(
+      base::TimeDelta::FromMilliseconds(1));
+  fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
+      base::TimeDelta::FromMilliseconds(
+          begin_main_frame_to_commit_estimate_in_ms));
+  fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+      base::TimeDelta::FromMilliseconds(commit_to_activate_estimate_in_ms));
 
   scheduler_->SetImplLatencyTakesPriority(impl_latency_takes_priority);
 
@@ -1342,9 +1318,9 @@
   scheduler_->NotifyReadyToCommit();
   scheduler_->NotifyReadyToActivate();
   EXPECT_TRUE(scheduler_->MainThreadIsInHighLatencyMode());
-  EXPECT_TRUE(client->HasAction("ScheduledActionSendBeginMainFrame"));
+  EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame"));
 
-  client->Reset();
+  client_->Reset();
   scheduler_->SetNeedsCommit();
   EXPECT_TRUE(scheduler_->MainThreadIsInHighLatencyMode());
   EXPECT_SCOPED(AdvanceFrame());
@@ -1352,7 +1328,7 @@
   task_runner().RunPendingTasks();  // Run posted deadline.
   EXPECT_EQ(scheduler_->MainThreadIsInHighLatencyMode(),
             should_send_begin_main_frame);
-  EXPECT_EQ(client->HasAction("ScheduledActionSendBeginMainFrame"),
+  EXPECT_EQ(client_->HasAction("ScheduledActionSendBeginMainFrame"),
             should_send_begin_main_frame);
 }
 
@@ -1390,14 +1366,16 @@
 
   // Since we are simulating a long commit, set up a client with draw duration
   // estimates that prevent skipping main frames to get to low latency mode.
-  SchedulerClientWithFixedEstimates* client =
-      new SchedulerClientWithFixedEstimates(
-          base::TimeDelta::FromMilliseconds(1),
-          base::TimeDelta::FromMilliseconds(32),
-          base::TimeDelta::FromMilliseconds(32));
   scheduler_settings_.use_external_begin_frame_source = true;
   scheduler_settings_.main_frame_while_swap_throttled_enabled = true;
-  SetUpScheduler(make_scoped_ptr(client).Pass(), true);
+  SetUpScheduler(true);
+
+  fake_compositor_timing_history_->SetDrawDurationEstimate(
+      base::TimeDelta::FromMilliseconds(1));
+  fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
+      base::TimeDelta::FromMilliseconds(32));
+  fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+      base::TimeDelta::FromMilliseconds(32));
 
   // Disables automatic swap acks so this test can force swap ack throttling
   // to simulate a blocked Browser ui thread.
@@ -1467,15 +1445,17 @@
 
   // Since we are simulating a long commit, set up a client with draw duration
   // estimates that prevent skipping main frames to get to low latency mode.
-  SchedulerClientWithFixedEstimates* client =
-      new SchedulerClientWithFixedEstimates(
-          base::TimeDelta::FromMilliseconds(1),
-          base::TimeDelta::FromMilliseconds(32),
-          base::TimeDelta::FromMilliseconds(32));
   scheduler_settings_.use_external_begin_frame_source = true;
   scheduler_settings_.main_frame_while_swap_throttled_enabled = true;
   scheduler_settings_.main_frame_before_activation_enabled = true;
-  SetUpScheduler(make_scoped_ptr(client).Pass(), true);
+  SetUpScheduler(true);
+
+  fake_compositor_timing_history_->SetDrawDurationEstimate(
+      base::TimeDelta::FromMilliseconds(1));
+  fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
+      base::TimeDelta::FromMilliseconds(32));
+  fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+      base::TimeDelta::FromMilliseconds(32));
 
   // Disables automatic swap acks so this test can force swap ack throttling
   // to simulate a blocked Browser ui thread.
@@ -1553,15 +1533,17 @@
 
   // Since we are simulating a long commit, set up a client with draw duration
   // estimates that prevent skipping main frames to get to low latency mode.
-  SchedulerClientWithFixedEstimates* client =
-      new SchedulerClientWithFixedEstimates(
-          base::TimeDelta::FromMilliseconds(1),
-          base::TimeDelta::FromMilliseconds(32),
-          base::TimeDelta::FromMilliseconds(32));
   scheduler_settings_.use_external_begin_frame_source = true;
   scheduler_settings_.main_frame_while_swap_throttled_enabled = true;
   scheduler_settings_.main_frame_before_activation_enabled = true;
-  SetUpScheduler(make_scoped_ptr(client).Pass(), true);
+  SetUpScheduler(true);
+
+  fake_compositor_timing_history_->SetDrawDurationEstimate(
+      base::TimeDelta::FromMilliseconds(1));
+  fake_compositor_timing_history_->SetBeginMainFrameToCommitDurationEstimate(
+      base::TimeDelta::FromMilliseconds(32));
+  fake_compositor_timing_history_->SetCommitToActivateDurationEstimate(
+      base::TimeDelta::FromMilliseconds(32));
 
   // Disables automatic swap acks so this test can force swap ack throttling
   // to simulate a blocked Browser ui thread.
diff --git a/cc/test/scheduler_test_common.cc b/cc/test/scheduler_test_common.cc
index 31272dd..b0461ec3 100644
--- a/cc/test/scheduler_test_common.cc
+++ b/cc/test/scheduler_test_common.cc
@@ -7,6 +7,7 @@
 #include <string>
 
 #include "base/logging.h"
+#include "cc/debug/rendering_stats_instrumentation.h"
 
 namespace cc {
 
@@ -65,13 +66,60 @@
 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() {
 }
 
+scoped_ptr<FakeCompositorTimingHistory> FakeCompositorTimingHistory::Create() {
+  scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation =
+      RenderingStatsInstrumentation::Create();
+  return make_scoped_ptr(
+      new FakeCompositorTimingHistory(rendering_stats_instrumentation.Pass()));
+}
+
+FakeCompositorTimingHistory::FakeCompositorTimingHistory(
+    scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation)
+    : CompositorTimingHistory(rendering_stats_instrumentation.get()),
+      rendering_stats_instrumentation_owned_(
+          rendering_stats_instrumentation.Pass()) {
+}
+
+FakeCompositorTimingHistory::~FakeCompositorTimingHistory() {
+}
+
+void FakeCompositorTimingHistory::SetDrawDurationEstimate(
+    base::TimeDelta duration) {
+  draw_duration_ = duration;
+}
+
+void FakeCompositorTimingHistory::SetBeginMainFrameToCommitDurationEstimate(
+    base::TimeDelta duration) {
+  begin_main_frame_to_commit_duration_ = duration;
+}
+
+void FakeCompositorTimingHistory::SetCommitToActivateDurationEstimate(
+    base::TimeDelta duration) {
+  commit_to_activate_duration_ = duration;
+}
+
+base::TimeDelta FakeCompositorTimingHistory::DrawDurationEstimate() const {
+  return draw_duration_;
+}
+
+base::TimeDelta
+FakeCompositorTimingHistory::BeginMainFrameToCommitDurationEstimate() const {
+  return begin_main_frame_to_commit_duration_;
+}
+
+base::TimeDelta FakeCompositorTimingHistory::CommitToActivateDurationEstimate()
+    const {
+  return commit_to_activate_duration_;
+}
+
 scoped_ptr<TestScheduler> TestScheduler::Create(
     base::SimpleTestTickClock* now_src,
     SchedulerClient* client,
     const SchedulerSettings& settings,
     int layer_tree_host_id,
     OrderedSimpleTaskRunner* task_runner,
-    BeginFrameSource* external_frame_source) {
+    BeginFrameSource* external_frame_source,
+    scoped_ptr<CompositorTimingHistory> compositor_timing_history) {
   scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source;
   if (!settings.use_external_begin_frame_source) {
     synthetic_frame_source = TestSyntheticBeginFrameSource::Create(
@@ -82,7 +130,7 @@
   return make_scoped_ptr(new TestScheduler(
       now_src, client, settings, layer_tree_host_id, task_runner,
       external_frame_source, synthetic_frame_source.Pass(),
-      unthrottled_frame_source.Pass()));
+      unthrottled_frame_source.Pass(), compositor_timing_history.Pass()));
 }
 
 TestScheduler::TestScheduler(
@@ -93,14 +141,16 @@
     OrderedSimpleTaskRunner* task_runner,
     BeginFrameSource* external_frame_source,
     scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source,
-    scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source)
+    scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source,
+    scoped_ptr<CompositorTimingHistory> compositor_timing_history)
     : Scheduler(client,
                 scheduler_settings,
                 layer_tree_host_id,
                 task_runner,
                 external_frame_source,
                 synthetic_frame_source.Pass(),
-                unthrottled_frame_source.Pass()),
+                unthrottled_frame_source.Pass(),
+                compositor_timing_history.Pass()),
       now_src_(now_src) {
 }
 
diff --git a/cc/test/scheduler_test_common.h b/cc/test/scheduler_test_common.h
index a1ab922e..c66b162 100644
--- a/cc/test/scheduler_test_common.h
+++ b/cc/test/scheduler_test_common.h
@@ -10,13 +10,15 @@
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
-#include "cc/scheduler/delay_based_time_source.h"
+#include "cc/scheduler/compositor_timing_history.h"
 #include "cc/scheduler/scheduler.h"
 #include "cc/test/ordered_simple_task_runner.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace cc {
 
+class RenderingStatsInstrumentation;
+
 class FakeTimeSourceClient : public TimeSourceClient {
  public:
   FakeTimeSourceClient() : tick_called_(false) {}
@@ -159,6 +161,34 @@
   DISALLOW_COPY_AND_ASSIGN(TestSyntheticBeginFrameSource);
 };
 
+class FakeCompositorTimingHistory : public CompositorTimingHistory {
+ public:
+  static scoped_ptr<FakeCompositorTimingHistory> Create();
+  ~FakeCompositorTimingHistory() override;
+
+  void SetDrawDurationEstimate(base::TimeDelta duration);
+  void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration);
+  void SetCommitToActivateDurationEstimate(base::TimeDelta duration);
+
+  base::TimeDelta DrawDurationEstimate() const override;
+  base::TimeDelta BeginMainFrameToCommitDurationEstimate() const override;
+  base::TimeDelta CommitToActivateDurationEstimate() const override;
+
+ protected:
+  FakeCompositorTimingHistory(scoped_ptr<RenderingStatsInstrumentation>
+                                  rendering_stats_instrumentation_owned);
+
+  scoped_ptr<RenderingStatsInstrumentation>
+      rendering_stats_instrumentation_owned_;
+
+  base::TimeDelta draw_duration_;
+  base::TimeDelta begin_main_frame_to_commit_duration_;
+  base::TimeDelta commit_to_activate_duration_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(FakeCompositorTimingHistory);
+};
+
 class TestScheduler : public Scheduler {
  public:
   static scoped_ptr<TestScheduler> Create(
@@ -167,7 +197,8 @@
       const SchedulerSettings& scheduler_settings,
       int layer_tree_host_id,
       OrderedSimpleTaskRunner* task_runner,
-      BeginFrameSource* external_frame_source);
+      BeginFrameSource* external_frame_source,
+      scoped_ptr<CompositorTimingHistory> compositor_timing_history);
 
   // Extra test helper functionality
   bool IsBeginRetroFrameArgsEmpty() const {
@@ -198,9 +229,9 @@
       OrderedSimpleTaskRunner* task_runner,
       BeginFrameSource* external_frame_source,
       scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source,
-      scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source);
+      scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source,
+      scoped_ptr<CompositorTimingHistory> compositor_timing_history);
 
-  // Not owned.
   base::SimpleTestTickClock* now_src_;
 
   DISALLOW_COPY_AND_ASSIGN(TestScheduler);
diff --git a/cc/trees/proxy_timing_history.h b/cc/trees/proxy_timing_history.h
deleted file mode 100644
index aa213b6..0000000
--- a/cc/trees/proxy_timing_history.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_TREES_PROXY_TIMING_HISTORY_H_
-#define CC_TREES_PROXY_TIMING_HISTORY_H_
-
-#include "cc/base/rolling_time_delta_history.h"
-#include "cc/debug/rendering_stats_instrumentation.h"
-
-namespace cc {
-
-class ProxyTimingHistory {
- public:
-  explicit ProxyTimingHistory(
-      RenderingStatsInstrumentation* rendering_stats_instrumentation);
-  ~ProxyTimingHistory();
-
-  base::TimeDelta DrawDurationEstimate() const;
-  base::TimeDelta BeginMainFrameToCommitDurationEstimate() const;
-  base::TimeDelta CommitToActivateDurationEstimate() const;
-
-  void DidBeginMainFrame();
-  void DidCommit();
-  void DidActivateSyncTree();
-  void DidStartDrawing();
-  void DidFinishDrawing();
-
- protected:
-  void AddDrawDurationUMA(base::TimeDelta draw_duration,
-                          base::TimeDelta draw_duration_estimate);
-
-  RollingTimeDeltaHistory draw_duration_history_;
-  RollingTimeDeltaHistory begin_main_frame_to_commit_duration_history_;
-  RollingTimeDeltaHistory commit_to_activate_duration_history_;
-
-  base::TimeTicks begin_main_frame_sent_time_;
-  base::TimeTicks commit_complete_time_;
-  base::TimeTicks start_draw_time_;
-
-  RenderingStatsInstrumentation* rendering_stats_instrumentation_;
-};
-
-}  // namespace cc
-
-#endif  // CC_TREES_PROXY_TIMING_HISTORY_H_
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 5ff1c768..2bbf75c8 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -13,6 +13,8 @@
 #include "cc/output/output_surface.h"
 #include "cc/quads/draw_quad.h"
 #include "cc/scheduler/commit_earlyout_reason.h"
+#include "cc/scheduler/compositor_timing_history.h"
+#include "cc/scheduler/scheduler.h"
 #include "cc/trees/layer_tree_host.h"
 #include "cc/trees/layer_tree_host_single_thread_client.h"
 #include "cc/trees/layer_tree_impl.h"
@@ -41,7 +43,6 @@
       layer_tree_host_(layer_tree_host),
       client_(client),
       external_begin_frame_source_(external_begin_frame_source.Pass()),
-      timing_history_(layer_tree_host->rendering_stats_instrumentation()),
       next_frame_is_newly_committed_frame_(false),
 #if DCHECK_IS_ON()
       inside_impl_frame_(false),
@@ -62,9 +63,15 @@
     SchedulerSettings scheduler_settings(
         layer_tree_host->settings().ToSchedulerSettings());
     scheduler_settings.commit_to_active_tree = CommitToActiveTree();
+
+    scoped_ptr<CompositorTimingHistory> compositor_timing_history(
+        new CompositorTimingHistory(
+            layer_tree_host->rendering_stats_instrumentation()));
+
     scheduler_on_impl_thread_ = Scheduler::Create(
         this, scheduler_settings, layer_tree_host_->id(),
-        MainThreadTaskRunner(), external_begin_frame_source_.get());
+        MainThreadTaskRunner(), external_begin_frame_source_.get(),
+        compositor_timing_history.Pass());
   }
 }
 
@@ -291,7 +298,6 @@
   commit_blocking_task_runner_.reset();
   layer_tree_host_->CommitComplete();
   layer_tree_host_->DidBeginMainFrame();
-  timing_history_.DidCommit();
 
   next_frame_is_newly_committed_frame_ = true;
 }
@@ -447,8 +453,6 @@
   // |commit_blocking_task_runner| would make sure all tasks posted during
   // commit/activation before CommitComplete.
   CommitComplete();
-
-  timing_history_.DidActivateSyncTree();
 }
 
 void SingleThreadProxy::DidPrepareTiles() {
@@ -638,8 +642,6 @@
       return DRAW_ABORTED_CANT_DRAW;
     }
 
-    timing_history_.DidStartDrawing();
-
     // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
     // is fixed.
     tracked_objects::ScopedTracker tracking_profile2(
@@ -675,7 +677,6 @@
     tracked_objects::ScopedTracker tracking_profile7(
         FROM_HERE_WITH_EXPLICIT_FUNCTION(
             "461509 SingleThreadProxy::DoComposite7"));
-    timing_history_.DidFinishDrawing();
   }
 
   if (draw_frame) {
@@ -822,8 +823,6 @@
 
   layer_tree_host_->UpdateLayers();
 
-  timing_history_.DidBeginMainFrame();
-
   // TODO(enne): SingleThreadProxy does not support cancelling commits yet,
   // search for CommitEarlyOutReason::FINISHED_NO_UPDATES inside
   // thread_proxy.cc
@@ -894,18 +893,6 @@
   NOTREACHED();
 }
 
-base::TimeDelta SingleThreadProxy::DrawDurationEstimate() {
-  return timing_history_.DrawDurationEstimate();
-}
-
-base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() {
-  return timing_history_.BeginMainFrameToCommitDurationEstimate();
-}
-
-base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
-  return timing_history_.CommitToActivateDurationEstimate();
-}
-
 void SingleThreadProxy::DidFinishImplFrame() {
   layer_tree_host_impl_->DidFinishImplFrame();
 #if DCHECK_IS_ON()
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 4e6be80a..da8cc264 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -15,7 +15,6 @@
 #include "cc/trees/blocking_task_runner.h"
 #include "cc/trees/layer_tree_host_impl.h"
 #include "cc/trees/proxy.h"
-#include "cc/trees/proxy_timing_history.h"
 
 namespace cc {
 
@@ -74,9 +73,6 @@
   void ScheduledActionBeginOutputSurfaceCreation() override;
   void ScheduledActionPrepareTiles() override;
   void ScheduledActionInvalidateOutputSurface() override;
-  base::TimeDelta DrawDurationEstimate() override;
-  base::TimeDelta BeginMainFrameToCommitDurationEstimate() override;
-  base::TimeDelta CommitToActivateDurationEstimate() override;
   void SendBeginFramesToChildren(const BeginFrameArgs& args) override;
   void SendBeginMainFrameNotExpectedSoon() override;
 
@@ -153,7 +149,6 @@
   // Accessed from both threads.
   scoped_ptr<BeginFrameSource> external_begin_frame_source_;
   scoped_ptr<Scheduler> scheduler_on_impl_thread_;
-  ProxyTimingHistory timing_history_;
 
   scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_;
   bool next_frame_is_newly_committed_frame_;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 0af13823..248e6ae 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -20,7 +20,7 @@
 #include "cc/output/swap_promise.h"
 #include "cc/quads/draw_quad.h"
 #include "cc/scheduler/commit_earlyout_reason.h"
-#include "cc/scheduler/delay_based_time_source.h"
+#include "cc/scheduler/compositor_timing_history.h"
 #include "cc/scheduler/scheduler.h"
 #include "cc/trees/blocking_task_runner.h"
 #include "cc/trees/layer_tree_host.h"
@@ -112,8 +112,8 @@
           base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)),
           base::TimeDelta::FromMilliseconds(
               kSmoothnessTakesPriorityExpirationDelay * 1000)),
-      timing_history(rendering_stats_instrumentation),
       external_begin_frame_source(external_begin_frame_source.Pass()),
+      rendering_stats_instrumentation(rendering_stats_instrumentation),
       weak_factory(proxy) {
 }
 
@@ -665,7 +665,6 @@
                  base::Passed(&begin_main_frame_state)));
   devtools_instrumentation::DidRequestMainThreadFrame(
       impl().layer_tree_host_id);
-  impl().timing_history.DidBeginMainFrame();
 }
 
 void ThreadProxy::SendBeginMainFrameNotExpectedSoon() {
@@ -920,8 +919,6 @@
   SetInputThrottledUntilCommitOnImplThread(false);
 
   impl().next_frame_is_newly_committed_frame = true;
-
-  impl().timing_history.DidCommit();
 }
 
 void ThreadProxy::ScheduledActionActivateSyncTree() {
@@ -945,7 +942,6 @@
   DCHECK(IsImplThread());
   DCHECK(impl().layer_tree_host_impl.get());
 
-  impl().timing_history.DidStartDrawing();
   base::AutoReset<bool> mark_inside(&impl().inside_draw, true);
 
   if (impl().layer_tree_host_impl->pending_tree()) {
@@ -997,9 +993,6 @@
         base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_));
   }
 
-  if (result == DRAW_SUCCESS)
-    impl().timing_history.DidFinishDrawing();
-
   DCHECK_NE(INVALID_RESULT, result);
   return result;
 }
@@ -1033,18 +1026,6 @@
   impl().layer_tree_host_impl->output_surface()->Invalidate();
 }
 
-base::TimeDelta ThreadProxy::DrawDurationEstimate() {
-  return impl().timing_history.DrawDurationEstimate();
-}
-
-base::TimeDelta ThreadProxy::BeginMainFrameToCommitDurationEstimate() {
-  return impl().timing_history.BeginMainFrameToCommitDurationEstimate();
-}
-
-base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() {
-  return impl().timing_history.CommitToActivateDurationEstimate();
-}
-
 void ThreadProxy::DidFinishImplFrame() {
   impl().layer_tree_host_impl->DidFinishImplFrame();
 }
@@ -1079,11 +1060,18 @@
   DCHECK(IsImplThread());
   impl().layer_tree_host_impl =
       layer_tree_host()->CreateLayerTreeHostImpl(this);
+
   SchedulerSettings scheduler_settings(
       layer_tree_host()->settings().ToSchedulerSettings());
+
+  scoped_ptr<CompositorTimingHistory> compositor_timing_history(
+      new CompositorTimingHistory(impl().rendering_stats_instrumentation));
+
   impl().scheduler = Scheduler::Create(
       this, scheduler_settings, impl().layer_tree_host_id,
-      ImplThreadTaskRunner(), impl().external_begin_frame_source.get());
+      ImplThreadTaskRunner(), impl().external_begin_frame_source.get(),
+      compositor_timing_history.Pass());
+
   impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible());
   impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr();
   completion->Signal();
@@ -1246,7 +1234,6 @@
     impl().completion_event_for_commit_held_on_tree_activation = NULL;
   }
 
-  impl().timing_history.DidActivateSyncTree();
   impl().last_processed_begin_main_frame_args =
       impl().last_begin_main_frame_args;
 }
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index cad86953..672fca50 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -17,7 +17,6 @@
 #include "cc/scheduler/scheduler.h"
 #include "cc/trees/layer_tree_host_impl.h"
 #include "cc/trees/proxy.h"
-#include "cc/trees/proxy_timing_history.h"
 
 namespace base {
 class SingleThreadTaskRunner;
@@ -126,10 +125,10 @@
 
     DelayedUniqueNotifier smoothness_priority_expiration_notifier;
 
-    ProxyTimingHistory timing_history;
-
     scoped_ptr<BeginFrameSource> external_begin_frame_source;
 
+    RenderingStatsInstrumentation* rendering_stats_instrumentation;
+
     // Values used to keep track of frame durations. Used only in frame timing.
     BeginFrameArgs last_begin_main_frame_args;
     BeginFrameArgs last_processed_begin_main_frame_args;
@@ -219,9 +218,6 @@
   void ScheduledActionBeginOutputSurfaceCreation() override;
   void ScheduledActionPrepareTiles() override;
   void ScheduledActionInvalidateOutputSurface() override;
-  base::TimeDelta DrawDurationEstimate() override;
-  base::TimeDelta BeginMainFrameToCommitDurationEstimate() override;
-  base::TimeDelta CommitToActivateDurationEstimate() override;
   void SendBeginFramesToChildren(const BeginFrameArgs& args) override;
   void SendBeginMainFrameNotExpectedSoon() override;