Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Unified Diff: cc/trees/proxy_impl.cc

Issue 1765723002: Hoist begin frame sources out of scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_remove_throttle_flag
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/proxy_impl.h ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/proxy_impl.cc
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc
index 3f5a01eee061add58aca0e8d3f89ef3df147bc05..db52685a8acf1446dc310a9a37a524772ba9926e 100644
--- a/cc/trees/proxy_impl.cc
+++ b/cc/trees/proxy_impl.cc
@@ -79,10 +79,23 @@ ProxyImpl::ProxyImpl(ChannelImpl* channel_impl,
CompositorTimingHistory::RENDERER_UMA,
rendering_stats_instrumentation_));
- 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_ = BackToBackBeginFrameSource::Create(
+ task_runner_provider_->ImplThreadTaskRunner());
+ frame_source = unthrottled_begin_frame_source_.get();
+ }
+ if (!frame_source) {
+ synthetic_begin_frame_source_ = SyntheticBeginFrameSource::Create(
+ task_runner_provider_->ImplThreadTaskRunner(),
+ BeginFrameArgs::DefaultInterval());
+ 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());
}
@@ -99,6 +112,8 @@ ProxyImpl::~ProxyImpl() {
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
@@ -276,7 +291,14 @@ void ProxyImpl::DidLoseOutputSurfaceOnImplThread() {
void ProxyImpl::CommitVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) {
DCHECK(IsImplThread());
- scheduler_->CommitVSyncParameters(timebase, interval);
+ if (!synthetic_begin_frame_source_)
+ return;
+
+ if (interval == base::TimeDelta()) {
+ // TODO(brianderson): We should not be receiving 0 intervals.
+ interval = BeginFrameArgs::DefaultInterval();
+ }
+ synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
}
void ProxyImpl::SetEstimatedParentDrawTime(base::TimeDelta draw_time) {
« no previous file with comments | « cc/trees/proxy_impl.h ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698