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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 14268004: Add overscroll edge effect animations for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use LazyInstance for overscroll resources Created 7 years, 7 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
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3e8c6e019cb49ddf80d38e829629cb3848c77277..7bbf3ed3450b5110ee67e40cd175e2819ab6bf6b 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;
/**
@@ -2774,6 +2788,18 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
}
}
+ private boolean onAnimate(long frameTimeMicros) {
+ if (mNativeContentViewCore == 0) return false;
+ return nativeOnAnimate(mNativeContentViewCore, frameTimeMicros);
+ }
+
+ private void animateIfNecessary(long frameTimeMicros) {
+ if (mNeedAnimate) {
+ mNeedAnimate = onAnimate(frameTimeMicros);
+ if (!mNeedAnimate) setVSyncNotificationEnabled(false);
+ }
+ }
+
@CalledByNative
private void notifyExternalSurface(
int playerId, boolean isRequest, float x, float y, float width, float height) {
@@ -2944,6 +2970,8 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
private native void nativeOnVSync(int nativeContentViewCoreImpl, long frameTimeMicros);
+ private native boolean nativeOnAnimate(int nativeContentViewCoreImpl, long frameTimeMicros);
+
private native boolean nativePopulateBitmapFromCompositor(int nativeContentViewCoreImpl,
Bitmap bitmap);
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698