| 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 d71649d625a40cc0fd81e60771119e3355d91a24..ca9c5de0fc37d8352027ab73ade49fbc013e4ae5 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
|
| @@ -229,6 +229,8 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
|
|
| @Override
|
| public void onVSync(long frameTimeMicros) {
|
| + animateIfNecessary(frameTimeMicros);
|
| +
|
| if (mDidSignalVSyncUsingInputEvent) {
|
| TraceEvent.instant("ContentViewCore::onVSync ignored");
|
| mDidSignalVSyncUsingInputEvent = false;
|
| @@ -273,12 +275,21 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| while (isVSyncNotificationEnabled()) setVSyncNotificationEnabled(false);
|
| mVSyncSubscriberCount = 0;
|
| mVSyncListenerRegistered = false;
|
| + mNeedAnimate = false;
|
| }
|
|
|
| private boolean isVSyncNotificationEnabled() {
|
| return mVSyncProvider != null && mVSyncListenerRegistered;
|
| }
|
|
|
| + @CalledByNative
|
| + private void setNeedsAnimate() {
|
| + if (!mNeedAnimate) {
|
| + mNeedAnimate = true;
|
| + setVSyncNotificationEnabled(true);
|
| + }
|
| + }
|
| +
|
| private final Context mContext;
|
| private ViewGroup mContainerView;
|
| private InternalAccessDelegate mContainerViewInternals;
|
| @@ -358,6 +369,9 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| // Whether we received a new frame since consumePendingRendererFrame() was last called.
|
| private boolean mPendingRendererFrame = false;
|
|
|
| + // Whether we should animate at the next vsync tick.
|
| + private boolean mNeedAnimate = false;
|
| +
|
| private ViewAndroid mViewAndroid;
|
|
|
| /**
|
| @@ -2744,6 +2758,21 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
| }
|
| }
|
|
|
| + public void animate(long frameTimeMicros) {
|
| + if (mNativeContentViewCore != 0) nativeAnimate(mNativeContentViewCore, frameTimeMicros);
|
| + }
|
| +
|
| + private void animateIfNecessary(long frameTimeMicros) {
|
| + if (mNeedAnimate) {
|
| + // This needs to be false prior to the call to animate(), as the
|
| + // call could trigger a callback to setNeedsAnimate().
|
| + mNeedAnimate = false;
|
| + animate(frameTimeMicros);
|
| + setVSyncNotificationEnabled(false);
|
| + }
|
| + }
|
| +
|
| +
|
| @CalledByNative
|
| private void notifyExternalSurface(
|
| int playerId, boolean isRequest, float x, float y, float width, float height) {
|
| @@ -2911,6 +2940,8 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
|
|
|
| private native void nativeOnVSync(int nativeContentViewCoreImpl, long frameTimeMicros);
|
|
|
| + private native void nativeAnimate(int nativeContentViewCoreImpl, long frameTimeMicros);
|
| +
|
| private native boolean nativePopulateBitmapFromCompositor(int nativeContentViewCoreImpl,
|
| Bitmap bitmap);
|
|
|
|
|