diff options
Diffstat (limited to 'cc/scheduler')
-rw-r--r-- | cc/scheduler/frame_rate_controller.cc | 13 | ||||
-rw-r--r-- | cc/scheduler/frame_rate_controller.h | 5 |
2 files changed, 15 insertions, 3 deletions
diff --git a/cc/scheduler/frame_rate_controller.cc b/cc/scheduler/frame_rate_controller.cc index 811892d..c2294ea 100644 --- a/cc/scheduler/frame_rate_controller.cc +++ b/cc/scheduler/frame_rate_controller.cc @@ -65,10 +65,11 @@ FrameRateController::~FrameRateController() { time_source_->SetActive(false); } -void FrameRateController::SetActive(bool active) { +BeginFrameArgs FrameRateController::SetActive(bool active) { if (active_ == active) - return; + return BeginFrameArgs(); TRACE_EVENT1("cc", "FrameRateController::SetActive", "active", active); + bool just_activated = active && !active_; active_ = active; if (is_time_source_throttling_) { @@ -79,6 +80,14 @@ void FrameRateController::SetActive(bool active) { else weak_factory_.InvalidateWeakPtrs(); } + + if (just_activated) { + // TODO(brianderson): Use an adaptive parent compositor deadline. + base::TimeTicks frame_time = NextTickTime() - interval_; + base::TimeTicks deadline = NextTickTime(); + return BeginFrameArgs::Create(frame_time, deadline, interval_); + } + return BeginFrameArgs(); } void FrameRateController::SetMaxSwapsPending(int max_swaps_pending) { diff --git a/cc/scheduler/frame_rate_controller.h b/cc/scheduler/frame_rate_controller.h index 32e757b..0cfca0f 100644 --- a/cc/scheduler/frame_rate_controller.h +++ b/cc/scheduler/frame_rate_controller.h @@ -42,7 +42,10 @@ class CC_EXPORT FrameRateController { void SetClient(FrameRateControllerClient* client) { client_ = client; } - void SetActive(bool active); + // Returns a valid BeginFrame on activation to potentially be used + // retroactively. + BeginFrameArgs SetActive(bool active); + bool IsActive() { return active_; } // Use the following methods to adjust target frame rate. |