Index: ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
index 424b566ed2430ff1863b524d0c67ca69aafd8a7a..18a4409201269719d29346b85bf2d2815c02d17d 100644 |
--- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
+++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
@@ -33,6 +33,8 @@ public class WindowAndroid { |
private long mNativeWindowAndroid = 0; |
private final VSyncMonitor mVSyncMonitor; |
+ private boolean mInsideVSync = false; |
boliu
2014/08/20 02:54:17
I think this logic should be moved to VSyncMonitor
hush (inactive)
2014/08/20 03:47:21
Yes.. I thought about this too...
I will change th
|
+ |
// A string used as a key to store intent errors in a bundle |
static final String WINDOW_CALLBACK_ERRORS = "window_callback_errors"; |
@@ -50,13 +52,26 @@ public class WindowAndroid { |
private final VSyncMonitor.Listener mVSyncListener = new VSyncMonitor.Listener() { |
@Override |
public void onVSync(VSyncMonitor monitor, long vsyncTimeMicros) { |
+ mInsideVSync = true; |
if (mNativeWindowAndroid != 0) { |
nativeOnVSync(mNativeWindowAndroid, vsyncTimeMicros); |
} |
+ mInsideVSync = false; |
boliu
2014/08/20 02:54:17
you want to set it to false in finally, ie same pa
hush (inactive)
2014/08/20 03:47:21
good point. Will do.
On 2014/08/20 02:54:17, boliu
|
} |
}; |
/** |
+ * @return true if onVSync handler is executing. If onVSync handler |
+ * introduces invalidations, postInvalidate should be called. If |
+ * postInvalidateOnAnimation is called instead, the corresponding onDraw |
+ * will be delayed by one frame. The embedder of WindowAndroid should check |
+ * this value if it wants to post an invalidation. |
+ */ |
+ public boolean isInsideVSync() { |
+ return mInsideVSync; |
+ } |
+ |
+ /** |
* @param context The application context. |
*/ |
@SuppressLint("UseSparseArrays") |