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

Unified Diff: cc/scheduler/scheduler.cc

Issue 723713003: cc: Add SetChildrenNeedBeginFrames() & SendBeginFramesToChildren() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/scheduler/scheduler.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 5c515b2512e210919d95dcd82593359861777cdf..ae83120403887a2336f4b3a73adf30be8fa5f3c2 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -398,6 +398,21 @@ void Scheduler::SetupPollingMechanisms(bool needs_begin_frame) {
bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) {
TRACE_EVENT1("cc", "Scheduler::BeginFrame", "args", args.AsValue());
+ // Deliver BeginFrames to children.
+ if (settings_.forward_begin_frames_to_children &&
+ state_machine_.children_need_begin_frames()) {
+ BeginFrameArgs adjusted_args_for_children(args);
+ // Adjust a deadline for child schedulers.
+ // TODO(simonhong): Once we have commitless update, we can get rid of
+ // BeginMainFrameToCommitDurationEstimate() +
+ // CommitToActivateDurationEstimate().
+ adjusted_args_for_children.deadline -=
+ (client_->BeginMainFrameToCommitDurationEstimate() +
+ client_->CommitToActivateDurationEstimate() +
+ client_->DrawDurationEstimate() + EstimatedParentDrawTime());
+ client_->SendBeginFramesToChildren(adjusted_args_for_children);
+ }
+
// We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has
// sent us the last BeginFrame we have missed. As we might not be able to
// actually make rendering for this call, handle it like a "retro frame".
@@ -433,6 +448,12 @@ bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) {
return true;
}
+void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) {
+ DCHECK(settings_.forward_begin_frames_to_children);
+ state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames);
+ DCHECK_EQ(state_machine_.NextAction(), SchedulerStateMachine::ACTION_NONE);
+}
+
// BeginRetroFrame is called for BeginFrames that we've deferred because
// the scheduler was in the middle of processing a previous BeginFrame.
void Scheduler::BeginRetroFrame() {

Powered by Google App Engine
This is Rietveld 408576698