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

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: rebase on master 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
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/scheduler.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index b190988e8571ec8ec38978309b73df7caf700dd5..3e6f6c6a8dd77b9328e5000d22c75599f8208375 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -393,6 +393,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".
@@ -428,6 +443,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() {
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_state_machine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698