cc: Throttle swaps in Scheduler instead of OutputSurface

This doesn't represent a functional change and only moves
the swap throttling logic from the OutputSurface to the
Scheduler.

BUG=311213

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264732 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 84cf31d..9fac004 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1300,8 +1300,8 @@
   client_->DidSwapBuffersOnImplThread();
 }
 
-void LayerTreeHostImpl::OnSwapBuffersComplete() {
-  client_->OnSwapBuffersCompleteOnImplThread();
+void LayerTreeHostImpl::DidSwapBuffersComplete() {
+  client_->DidSwapBuffersCompleteOnImplThread();
 }
 
 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) {
@@ -1900,8 +1900,11 @@
         GetRendererCapabilities().allow_rasterize_on_demand);
   }
 
-  // Setup BeginFrameEmulation if it's not supported natively
-  if (!settings_.begin_impl_frame_scheduling_enabled) {
+  if (!settings_.throttle_frame_production) {
+    // Disable VSync
+    output_surface->SetThrottleFrameProduction(false);
+  } else if (!settings_.begin_impl_frame_scheduling_enabled) {
+    // Setup BeginFrameEmulation if it's not supported natively
     const base::TimeDelta display_refresh_interval =
       base::TimeDelta::FromMicroseconds(
           base::Time::kMicrosecondsPerSecond /
@@ -1909,7 +1912,6 @@
 
     output_surface->InitializeBeginFrameEmulation(
         proxy_->ImplThreadTaskRunner(),
-        settings_.throttle_frame_production,
         display_refresh_interval);
   }
 
@@ -1917,7 +1919,7 @@
       output_surface->capabilities().max_frames_pending;
   if (max_frames_pending <= 0)
     max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
-  output_surface->SetMaxFramesPending(max_frames_pending);
+  client_->SetMaxSwapsPendingOnImplThread(max_frames_pending);
 
   resource_provider_ = resource_provider.Pass();
   output_surface_ = output_surface.Pass();