| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| index 9d157ae697f967b87f21c444b38c2c87db0d3619..e47c5af636c58fc87ab3f8906c98587569034afb 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| @@ -167,6 +167,35 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| void onContentSizeChanged(int contentWidthPix, int contentHeightPix);
|
| }
|
|
|
| + /**
|
| + * Interface for requesting notification of the display vsync signal.
|
| + * The provider will call ContentViewCore.sendVSync() to notify about vsync.
|
| + */
|
| + public static interface VSyncProvider {
|
| + void setVSyncNotificationEnabled(ContentViewCore contentViewCore, boolean enable);
|
| + }
|
| +
|
| + private VSyncProvider mVSyncProvider;
|
| + private int mVSyncSubscriberCount;
|
| +
|
| + public void setVSyncProvider(VSyncProvider vsyncProvider) {
|
| + mVSyncProvider = vsyncProvider;
|
| + }
|
| +
|
| + @CalledByNative
|
| + void setVSyncNotificationEnabled(boolean enabled) {
|
| + mVSyncSubscriberCount += enabled ? 1 : -1;
|
| + assert mVSyncSubscriberCount >= 0;
|
| + if (mVSyncProvider != null) {
|
| + mVSyncProvider.setVSyncNotificationEnabled(this, mVSyncSubscriberCount > 0);
|
| + }
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void resetVSyncNotification() {
|
| + while (mVSyncSubscriberCount > 0) setVSyncNotificationEnabled(false);
|
| + }
|
| +
|
| private final Context mContext;
|
| private ViewGroup mContainerView;
|
| private InternalAccessDelegate mContainerViewInternals;
|
| @@ -633,6 +662,7 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| if (mNativeContentViewCore != 0) {
|
| nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore);
|
| }
|
| + resetVSyncNotification();
|
| mNativeContentViewCore = 0;
|
| mContentSettings = null;
|
| mJavaScriptInterfaces.clear();
|
| @@ -2614,6 +2644,16 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| }
|
|
|
| /**
|
| + * Send a vsync signal to the renderer.
|
| + * @param frameTimeMicros The latest vsync frame time in microseconds.
|
| + */
|
| + public void sendVSync(long frameTimeMicros) {
|
| + if (mNativeContentViewCore != 0) {
|
| + nativeSendVSync(mNativeContentViewCore, frameTimeMicros);
|
| + }
|
| + }
|
| +
|
| + /**
|
| * @return The cached copy of render positions and scales.
|
| */
|
| public RenderCoordinates getRenderCoordinates() {
|
| @@ -2793,6 +2833,8 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImpl,
|
| long timebaseMicros, long intervalMicros);
|
|
|
| + private native void nativeSendVSync(int nativeContentViewCoreImpl, long frameTimeMicros);
|
| +
|
| private native boolean nativePopulateBitmapFromCompositor(int nativeContentViewCoreImpl,
|
| Bitmap bitmap);
|
|
|
|
|