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

Unified Diff: ui/android/java/src/org/chromium/ui/VSyncMonitor.java

Issue 236193013: Android: Consolidate and simplify VSync logic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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: ui/android/java/src/org/chromium/ui/VSyncMonitor.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/VSyncMonitor.java b/ui/android/java/src/org/chromium/ui/VSyncMonitor.java
similarity index 92%
rename from content/public/android/java/src/org/chromium/content/browser/VSyncMonitor.java
rename to ui/android/java/src/org/chromium/ui/VSyncMonitor.java
index ce9f36dfd45b08e18b8ff184894575ac105f6f47..527b831fd2620937db1cbaf112c2e40e3e799128 100644
--- a/content/public/android/java/src/org/chromium/content/browser/VSyncMonitor.java
+++ b/ui/android/java/src/org/chromium/ui/VSyncMonitor.java
@@ -1,8 +1,8 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.content.browser;
+package org.chromium.ui;
import android.content.Context;
import android.os.Build;
@@ -61,11 +61,22 @@ public class VSyncMonitor {
private final Runnable mSyntheticVSyncRunnable;
private long mLastVSyncCpuTimeNano;
+ /**
+ * Constructs a VSyncMonitor
+ * @param context The application context.
+ * @param listener The listener receiving VSync notifications.
+ */
public VSyncMonitor(Context context, VSyncMonitor.Listener listener) {
this(context, listener, true);
}
- VSyncMonitor(Context context, VSyncMonitor.Listener listener, boolean enableJBVSync) {
+ /**
+ * Constructs a VSyncMonitor
+ * @param context The application context.
+ * @param listener The listener receiving VSync notifications.
+ * @param enableJBVsync Whether to allow Choreographer-based notifications on JB and up.
+ */
+ public VSyncMonitor(Context context, VSyncMonitor.Listener listener, boolean enableJBVSync) {
mListener = listener;
float refreshRate = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay().getRefreshRate();
@@ -123,7 +134,7 @@ public class VSyncMonitor {
/**
* Determine whether a true vsync signal is available on this platform.
*/
- public boolean isVSyncSignalAvailable() {
+ private boolean isVSyncSignalAvailable() {
return mChoreographer != null;
}
@@ -136,15 +147,6 @@ public class VSyncMonitor {
}
/**
- * Unregister the listener.
- * No vsync events will be reported afterwards.
- */
- public void unregisterListener() {
- stop();
- mListener = null;
- }
-
- /**
* Request to be notified of the closest display vsync events.
* Listener.onVSync() will be called soon after the upcoming vsync pulses.
* It will be called at most MAX_AUTO_ONVSYNC_COUNT times unless requestUpdate() is called.

Powered by Google App Engine
This is Rietveld 408576698