Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index 0dcb09010c68197f7f73ef0ffcbf31a8b702c7e9..64ac3293e0b6a1b1d0735e99b09bec8ecdce3f8b 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -1473,7 +1473,9 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { |
} |
void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { |
- if (output_surface_) |
+ if (begin_frame_source_) |
+ begin_frame_source_->SetActive(enable); |
+ else if (output_surface_) |
output_surface_->SetNeedsBeginImplFrame(enable); |
} |
@@ -1522,6 +1524,8 @@ float LayerTreeHostImpl::VerticalAdjust() const { |
void LayerTreeHostImpl::DidLoseOutputSurface() { |
if (resource_provider_) |
resource_provider_->DidLoseOutputSurface(); |
+ if (begin_frame_source_) |
+ begin_frame_source_->SetActive(false); |
// TODO(jamesr): The renderer_ check is needed to make some of the |
// LayerTreeHostContextTest tests pass, but shouldn't be necessary (or |
// important) in production. We should adjust the test to not need this. |
@@ -1835,24 +1839,31 @@ bool LayerTreeHostImpl::InitializeRenderer( |
GetRendererCapabilities().allow_rasterize_on_demand); |
} |
- // Setup BeginImplFrameEmulation if it's not supported natively |
- if (!settings_.begin_impl_frame_scheduling_enabled) { |
+ if (!settings_.throttle_frame_production) { |
+ // Disable VSync |
+ output_surface->SetThrottleFrameProduction(false); |
Sami
2014/03/14 15:34:58
Should this also disable the swap limit in the sch
|
+ } else if (!settings_.begin_impl_frame_scheduling_enabled) { |
+ // Setup BeginImplFrameEmulation if it's not supported natively |
const base::TimeDelta display_refresh_interval = |
base::TimeDelta::FromMicroseconds( |
base::Time::kMicrosecondsPerSecond / |
settings_.refresh_rate); |
- output_surface->InitializeBeginImplFrameEmulation( |
- proxy_->ImplThreadTaskRunner(), |
- settings_.throttle_frame_production, |
- display_refresh_interval); |
+ begin_frame_source_.reset(new BeginFrameSource( |
+ display_refresh_interval, proxy_->ImplThreadTaskRunner())); |
+ |
+ begin_frame_source_->SetClient(this); |
+ begin_frame_source_->SetDeadlineAdjustment( |
+ capabilities_.adjust_deadline_for_parent |
+ ? BeginFrameArgs::DefaultDeadlineAdjustment() |
+ : base::TimeDelta()); |
} |
int max_frames_pending = |
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_->SetMaxSwapsPending(max_frames_pending); |
resource_provider_ = resource_provider.Pass(); |
output_surface_ = output_surface.Pass(); |
@@ -1862,6 +1873,12 @@ bool LayerTreeHostImpl::InitializeRenderer( |
return true; |
} |
+bool LayerTreeHostImpl::CommitVSyncParameters(base::TimeTicks timebase, |
+ base::TimeDelta interval) { |
+ if (begin_frame_source_) |
+ begin_frame_source_->SetTimebaseAndInterval(timebase, interval); |
+} |
+ |
bool LayerTreeHostImpl::DeferredInitialize( |
scoped_refptr<ContextProvider> offscreen_context_provider) { |
DCHECK(output_surface_->capabilities().deferred_gl_initialization); |