| Index: cc/scheduler/vsync_time_source.cc
|
| diff --git a/cc/scheduler/vsync_time_source.cc b/cc/scheduler/vsync_time_source.cc
|
| index 75314fbeff76e7a9477239d69d7292ab6c491f4e..206e2376675156e36cd20ee0d284a7dc40b5f7ab 100644
|
| --- a/cc/scheduler/vsync_time_source.cc
|
| +++ b/cc/scheduler/vsync_time_source.cc
|
| @@ -4,18 +4,22 @@
|
|
|
| #include "cc/scheduler/vsync_time_source.h"
|
|
|
| +#include "base/logging.h"
|
| +
|
| namespace cc {
|
|
|
| scoped_refptr<VSyncTimeSource> VSyncTimeSource::Create(
|
| - VSyncProvider* vsync_provider) {
|
| - return make_scoped_refptr(new VSyncTimeSource(vsync_provider));
|
| + VSyncProvider* vsync_provider, NotificationDisableOption option) {
|
| + return make_scoped_refptr(new VSyncTimeSource(vsync_provider, option));
|
| }
|
|
|
| -VSyncTimeSource::VSyncTimeSource(VSyncProvider* vsync_provider)
|
| +VSyncTimeSource::VSyncTimeSource(
|
| + VSyncProvider* vsync_provider, NotificationDisableOption option)
|
| : active_(false),
|
| notification_requested_(false),
|
| vsync_provider_(vsync_provider),
|
| - client_(NULL) {}
|
| + client_(NULL),
|
| + disable_option_(option) {}
|
|
|
| VSyncTimeSource::~VSyncTimeSource() {}
|
|
|
| @@ -27,13 +31,14 @@ void VSyncTimeSource::SetActive(bool active) {
|
| if (active_ == active)
|
| return;
|
| active_ = active;
|
| - // The notification will be lazily disabled in the callback to ensure
|
| - // we get notified of the frame immediately following a quick on-off-on
|
| - // transition.
|
| if (active_ && !notification_requested_) {
|
| notification_requested_ = true;
|
| vsync_provider_->RequestVSyncNotification(this);
|
| }
|
| + if (!active_ && disable_option_ == DISABLE_SYNCHRONOUSLY) {
|
| + notification_requested_ = false;
|
| + vsync_provider_->RequestVSyncNotification(NULL);
|
| + }
|
| }
|
|
|
| bool VSyncTimeSource::Active() const {
|
| @@ -55,7 +60,9 @@ void VSyncTimeSource::SetTimebaseAndInterval(base::TimeTicks,
|
|
|
| void VSyncTimeSource::DidVSync(base::TimeTicks frame_time) {
|
| last_tick_time_ = frame_time;
|
| - if (!active_) {
|
| + if (disable_option_ == DISABLE_SYNCHRONOUSLY) {
|
| + DCHECK(active_);
|
| + } else if (!active_) {
|
| if (notification_requested_) {
|
| notification_requested_ = false;
|
| vsync_provider_->RequestVSyncNotification(NULL);
|
|
|