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

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

Issue 2710683003: [Android] Add switch to disable native event batching (Closed)
Patch Set: aelias's review: Use @TargetApi and change switch name Created 3 years, 10 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 | « no previous file | content/public/android/java/src/org/chromium/content/common/ContentSwitches.java » ('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 d0bcd486ece4adf008e0e52c3139b536ddb9d1e6..f7d83a9d8c7871561203e95680caf27f2db66f86 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
@@ -40,6 +40,7 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
+import org.chromium.base.CommandLine;
import org.chromium.base.ObserverList;
import org.chromium.base.ObserverList.RewindableIterator;
import org.chromium.base.TraceEvent;
@@ -59,6 +60,7 @@ import org.chromium.content.browser.input.SelectPopup;
import org.chromium.content.browser.input.SelectPopupDialog;
import org.chromium.content.browser.input.SelectPopupDropdown;
import org.chromium.content.browser.input.SelectPopupItem;
+import org.chromium.content.common.ContentSwitches;
import org.chromium.content_public.browser.AccessibilitySnapshotCallback;
import org.chromium.content_public.browser.AccessibilitySnapshotNode;
import org.chromium.content_public.browser.ActionModeCallbackHelper;
@@ -353,6 +355,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
private float mCurrentTouchOffsetX;
private float mCurrentTouchOffsetY;
+ // True if we want to disable Android native event batching and use compositor event queue.
+ private boolean mShouldRequestUnbufferedDispatch;
+
// Whether the ContentViewCore requires the WebContents to be fullscreen in order to lock the
// screen orientation.
private boolean mFullscreenRequiredForOrientationLock = true;
@@ -584,6 +589,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
mSelectionPopupController.setContainerView(getContainerView());
mWebContentsObserver = new ContentViewWebContentsObserver(this);
+
+ mShouldRequestUnbufferedDispatch = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
+ && CommandLine.getInstance().hasSwitch(ContentSwitches.REQUEST_UNBUFFERED_DISPATCH);
}
/**
@@ -996,6 +1004,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
int eventAction = event.getActionMasked();
if (eventAction == MotionEvent.ACTION_DOWN) {
+ if (mShouldRequestUnbufferedDispatch) {
+ requestUnbufferedDispatch(event);
+ }
cancelRequestToScrollFocusedEditableNodeIntoView();
}
@@ -2457,6 +2468,11 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
viewNode.asyncCommit();
}
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
chongz 2017/02/22 23:08:58 No idea why but "Build.VERSION_CODES.L" won't work
+ private void requestUnbufferedDispatch(MotionEvent touchDownEvent) {
+ mContainerView.requestUnbufferedDispatch(touchDownEvent);
+ }
+
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onSystemCaptioningChanged(TextTrackSettings settings) {
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/common/ContentSwitches.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698