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

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: Created 4 years, 10 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
Index: cc/trees/proxy_impl.cc
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc
index 3f5a01eee061add58aca0e8d3f89ef3df147bc05..395092fe91bc0dc8865a8f5ece969bde83da8207 100644
--- a/cc/trees/proxy_impl.cc
+++ b/cc/trees/proxy_impl.cc
@@ -60,7 +60,7 @@ ProxyImpl::ProxyImpl(ChannelImpl* channel_impl,
base::Bind(&ProxyImpl::RenewTreePriority, base::Unretained(this)),
base::TimeDelta::FromSecondsD(
kSmoothnessTakesPriorityExpirationDelay)),
- external_begin_frame_source_(std::move(external_begin_frame_source)),
+ begin_frame_source_(std::move(external_begin_frame_source)),
rendering_stats_instrumentation_(
layer_tree_host->rendering_stats_instrumentation()),
channel_impl_(channel_impl) {
@@ -79,10 +79,22 @@ 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));
+ if (!scheduler_settings.throttle_frame_production) {
+ // Unthrottled source takes precedence over external sources.
+ begin_frame_source_ = BackToBackBeginFrameSource::Create(
+ task_runner_provider_->ImplThreadTaskRunner());
+ }
+ BeginFrameSource* frame_source = begin_frame_source_.get();
+ if (!frame_source) {
+ synthetic_frame_source_ = SyntheticBeginFrameSource::Create(
+ task_runner_provider_->ImplThreadTaskRunner(),
+ BeginFrameArgs::DefaultInterval());
+ frame_source = synthetic_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());
}
@@ -98,7 +110,8 @@ ProxyImpl::~ProxyImpl() {
DCHECK(IsMainThreadBlocked());
scheduler_ = nullptr;
- external_begin_frame_source_ = nullptr;
+ begin_frame_source_ = nullptr;
+ synthetic_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 +289,14 @@ void ProxyImpl::DidLoseOutputSurfaceOnImplThread() {
void ProxyImpl::CommitVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) {
DCHECK(IsImplThread());
- scheduler_->CommitVSyncParameters(timebase, interval);
+ if (!synthetic_frame_source_)
+ return;
+
+ if (interval == base::TimeDelta()) {
+ // TODO(brianderson): We should not be receiving 0 intervals.
+ interval = BeginFrameArgs::DefaultInterval();
+ }
+ synthetic_frame_source_->OnUpdateVSyncParameters(timebase, interval);
}
void ProxyImpl::SetEstimatedParentDrawTime(base::TimeDelta draw_time) {

Powered by Google App Engine
This is Rietveld 408576698