Commit 14e88d0d authored by Aldo Culquicondor's avatar Aldo Culquicondor Committed by Commit Bot

Remove default source from MotionEventSynthetizerImpl

The used source class was causing several performance regressions.

Bug: 874363, 874365
Change-Id: I697f4380c978aa6c7dbc6d41759bfbbdae0878db
Reviewed-on: https://chromium-review.googlesource.com/1176379Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584442}
parent ef958bff
......@@ -4,7 +4,6 @@
package org.chromium.content.browser;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.MotionEvent.PointerCoords;
import android.view.MotionEvent.PointerProperties;
......@@ -17,7 +16,6 @@ import org.chromium.content_public.browser.MotionEventSynthesizer;
*/
public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
private static final int MAX_NUM_POINTERS = 16;
private static final int SOURCE = InputDevice.SOURCE_CLASS_POINTER;
private final PointerProperties[] mPointerProperties;
private final PointerCoords[] mPointerCoords;
......@@ -100,7 +98,7 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
mDownTimeInMs = timeInMs;
MotionEvent event =
MotionEvent.obtain(mDownTimeInMs, timeInMs, MotionEvent.ACTION_DOWN, 1,
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, SOURCE, 0);
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchTouchEvent(event);
event.recycle();
......@@ -111,7 +109,7 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
int pointerIndex = 1 << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
event = MotionEvent.obtain(mDownTimeInMs, timeInMs,
MotionEvent.ACTION_POINTER_DOWN | pointerIndex, pointerCount,
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, SOURCE, 0);
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchTouchEvent(event);
event.recycle();
}
......@@ -120,7 +118,7 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
case MotionEventAction.MOVE: {
MotionEvent event = MotionEvent.obtain(mDownTimeInMs, timeInMs,
MotionEvent.ACTION_MOVE, pointerCount, mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, SOURCE, 0);
0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchTouchEvent(event);
event.recycle();
break;
......@@ -128,7 +126,7 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
case MotionEventAction.CANCEL: {
MotionEvent event =
MotionEvent.obtain(mDownTimeInMs, timeInMs, MotionEvent.ACTION_CANCEL, 1,
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, SOURCE, 0);
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchTouchEvent(event);
event.recycle();
break;
......@@ -141,14 +139,14 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
int pointerIndex = 1 << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
MotionEvent event = MotionEvent.obtain(mDownTimeInMs, timeInMs,
MotionEvent.ACTION_POINTER_UP | pointerIndex, pointerCount,
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, SOURCE, 0);
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchTouchEvent(event);
event.recycle();
}
MotionEvent event =
MotionEvent.obtain(mDownTimeInMs, timeInMs, MotionEvent.ACTION_UP, 1,
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, SOURCE, 0);
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchTouchEvent(event);
event.recycle();
break;
......@@ -157,7 +155,7 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
assert pointerCount == 1;
MotionEvent event = MotionEvent.obtain(mDownTimeInMs, timeInMs,
MotionEvent.ACTION_SCROLL, pointerCount, mPointerProperties, mPointerCoords,
0, 0, 1, 1, 0, 0, SOURCE, 0);
0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchGenericMotionEvent(event);
event.recycle();
break;
......@@ -181,7 +179,7 @@ public class MotionEventSynthesizerImpl implements MotionEventSynthesizer {
if (MotionEventAction.HOVER_EXIT == action) androidAction = MotionEvent.ACTION_HOVER_EXIT;
if (MotionEventAction.HOVER_MOVE == action) androidAction = MotionEvent.ACTION_HOVER_MOVE;
MotionEvent event = MotionEvent.obtain(mDownTimeInMs, timeInMs, androidAction, pointerCount,
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, SOURCE, 0);
mPointerProperties, mPointerCoords, 0, 0, 1, 1, 0, 0, 0, 0);
mTarget.dispatchGenericMotionEvent(event);
event.recycle();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment