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

Unified Diff: cc/scheduler/scheduler.cc

Issue 2418593002: Fix scheduler bug in skipping main frames (Closed)
Patch Set: Rename expected draw function after danakj changes Created 4 years, 2 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/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('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 9e18e88d75eae634a473027f632efdc9d5f79d50..14d5e69e6a0b6521be64398bb0755aca1ce5e559 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -317,9 +317,11 @@ void Scheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) {
// before the missed frame task runs.
missed_begin_frame_task_.Cancel();
+ base::TimeTicks now = Now();
+
// Discard missed begin frames if they are too late.
if (adjusted_args.type == BeginFrameArgs::MISSED &&
- Now() > adjusted_args.deadline) {
+ now > adjusted_args.deadline) {
begin_frame_source_->DidFinishFrame(this, 0);
return;
}
@@ -379,7 +381,7 @@ void Scheduler::BeginImplFrameWithDeadline(const BeginFrameArgs& args) {
bool can_activate_before_deadline =
CanBeginMainFrameAndActivateBeforeDeadline(adjusted_args,
- bmf_to_activate_estimate);
+ bmf_to_activate_estimate, now);
if (ShouldRecoverMainLatency(adjusted_args, can_activate_before_deadline)) {
TRACE_EVENT_INSTANT0("cc", "SkipBeginMainFrameToReduceLatency",
@@ -739,11 +741,11 @@ bool Scheduler::ShouldRecoverImplLatency(
bool Scheduler::CanBeginMainFrameAndActivateBeforeDeadline(
const BeginFrameArgs& args,
- base::TimeDelta bmf_to_activate_estimate) const {
+ base::TimeDelta bmf_to_activate_estimate,
+ base::TimeTicks now) const {
// Check if the main thread computation and commit can be finished before the
// impl thread's deadline.
- base::TimeTicks estimated_draw_time =
- args.frame_time + bmf_to_activate_estimate;
+ base::TimeTicks estimated_draw_time = now + bmf_to_activate_estimate;
return estimated_draw_time < args.deadline;
}
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698