Index: cc/trees/proxy_impl.cc |
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc |
index 80adffbe0697a61a90e1932ea0fb8b0515dd947e..3a6f2db319847a10c0e1d43e28c366f80a0bb220 100644 |
--- a/cc/trees/proxy_impl.cc |
+++ b/cc/trees/proxy_impl.cc |
@@ -77,20 +77,24 @@ |
CompositorTimingHistory::RENDERER_UMA, |
rendering_stats_instrumentation_)); |
- // BFS must either be external or come from the output surface. If |
- // external, it must be provided. If from the output surface, it must |
- // not be provided. |
- // TODO(enne): Make all BFS come from the output surface. |
- DCHECK(layer_tree_host->settings().use_external_begin_frame_source ^ |
- layer_tree_host->settings().use_output_surface_begin_frame_source); |
- DCHECK(!layer_tree_host->settings().use_external_begin_frame_source || |
- external_begin_frame_source_); |
- DCHECK(!layer_tree_host->settings().use_output_surface_begin_frame_source || |
- !external_begin_frame_source_); |
- scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, |
- task_runner_provider_->ImplThreadTaskRunner(), |
- external_begin_frame_source_.get(), |
- std::move(compositor_timing_history)); |
+ BeginFrameSource* frame_source = external_begin_frame_source_.get(); |
+ if (!scheduler_settings.throttle_frame_production) { |
+ // Unthrottled source takes precedence over external sources. |
+ unthrottled_begin_frame_source_.reset( |
+ new BackToBackBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>( |
+ task_runner_provider_->ImplThreadTaskRunner()))); |
+ frame_source = unthrottled_begin_frame_source_.get(); |
+ } |
+ if (!frame_source) { |
+ synthetic_begin_frame_source_.reset( |
+ new DelayBasedBeginFrameSource(base::MakeUnique<DelayBasedTimeSource>( |
+ task_runner_provider_->ImplThreadTaskRunner()))); |
+ frame_source = synthetic_begin_frame_source_.get(); |
+ } |
+ scheduler_ = |
+ Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, |
+ task_runner_provider_->ImplThreadTaskRunner(), |
+ frame_source, std::move(compositor_timing_history)); |
DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); |
} |
@@ -112,6 +116,8 @@ |
scheduler_ = nullptr; |
external_begin_frame_source_ = nullptr; |
+ unthrottled_begin_frame_source_ = nullptr; |
+ synthetic_begin_frame_source_ = nullptr; |
layer_tree_host_impl_ = nullptr; |
// We need to explicitly shutdown the notifier to destroy any weakptrs it is |
// holding while still on the compositor thread. This also ensures any |
@@ -269,6 +275,13 @@ |
DCHECK(IsImplThread()); |
channel_impl_->DidLoseOutputSurface(); |
scheduler_->DidLoseOutputSurface(); |
+} |
+ |
+void ProxyImpl::CommitVSyncParameters(base::TimeTicks timebase, |
+ base::TimeDelta interval) { |
+ DCHECK(IsImplThread()); |
+ if (synthetic_begin_frame_source_) |
+ synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval); |
} |
void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) { |