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

Unified Diff: cc/scheduler/vsync_time_source.cc

Issue 14898002: Add LayerTreeHostSettings for synchronous compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 8 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
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"
Sami 2013/05/03 17:55:33 Not needed?
boliu 2013/05/03 17:59:39 For DCHECK in DidVSync.
+
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);

Powered by Google App Engine
This is Rietveld 408576698