Chromium Code Reviews| Index: cc/output/output_surface.cc |
| diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc |
| index 092042ca61d245e8cff5c9a8a3ca8d52afb0e08c..f575d21e7a7d65401f2626f66cad585e0e647b9d 100644 |
| --- a/cc/output/output_surface.cc |
| +++ b/cc/output/output_surface.cc |
| @@ -4,6 +4,7 @@ |
| #include "cc/output/output_surface.h" |
| +#include <algorithm> |
| #include <set> |
| #include <string> |
| #include <vector> |
| @@ -160,8 +161,13 @@ void OutputSurface::BeginFrame(const BeginFrameArgs& args) { |
| } |
| } |
| -base::TimeDelta OutputSurface::AlternateRetroactiveBeginFramePeriod() { |
| - return BeginFrameArgs::DefaultRetroactiveBeginFramePeriod(); |
| +base::TimeTicks OutputSurface::RetroactiveBeginFrameDeadline() { |
| + // TODO(brianderson): Remove the alternative deadline once we have better |
| + // deadline estimations. |
| + base::TimeTicks alternative_deadline = |
| + skipped_begin_frame_args_.frame_time + |
| + BeginFrameArgs::DefaultRetroactiveBeginFramePeriod(); |
| + return std::max(skipped_begin_frame_args_.deadline, alternative_deadline); |
| } |
| void OutputSurface::PostCheckForRetroactiveBeginFrame() { |
| @@ -179,16 +185,8 @@ void OutputSurface::PostCheckForRetroactiveBeginFrame() { |
| void OutputSurface::CheckForRetroactiveBeginFrame() { |
| TRACE_EVENT0("cc", "OutputSurface::CheckForRetroactiveBeginFrame"); |
| check_for_retroactive_begin_frame_pending_ = false; |
| - base::TimeTicks now = base::TimeTicks::Now(); |
| - // TODO(brianderson): Remove the alternative deadline once we have better |
| - // deadline estimations. |
| - base::TimeTicks alternative_deadline = |
| - skipped_begin_frame_args_.frame_time + |
| - AlternateRetroactiveBeginFramePeriod(); |
| - if (now < skipped_begin_frame_args_.deadline || |
| - now < alternative_deadline) { |
| + if (base::TimeTicks::Now() < RetroactiveBeginFrameDeadline()) |
| BeginFrame(skipped_begin_frame_args_); |
| - } |
| } |
| void OutputSurface::DidSwapBuffers() { |
| @@ -214,6 +212,9 @@ void OutputSurface::DidLoseOutputSurface() { |
| TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); |
| client_ready_for_begin_frame_ = true; |
| pending_swap_buffers_ = 0; |
| + skipped_begin_frame_args_ = BeginFrameArgs(); |
|
danakj
2013/09/17 20:26:19
Are these changes covered by a unit test?
brianderson
2013/09/17 21:08:24
No I will add one.
|
| + if (frame_rate_controller_) |
| + frame_rate_controller_->SetActive(false); |
| client_->DidLoseOutputSurface(); |
| } |