Chromium Code Reviews| Index: content/browser/renderer_host/input/motion_event_android.cc |
| diff --git a/content/browser/renderer_host/input/motion_event_android.cc b/content/browser/renderer_host/input/motion_event_android.cc |
| index 7316a405f49939f3d5c3de88234aac687af5cddd..d545f3ad8feffcd21d785876669c865ec8ada78b 100644 |
| --- a/content/browser/renderer_host/input/motion_event_android.cc |
| +++ b/content/browser/renderer_host/input/motion_event_android.cc |
| @@ -146,7 +146,8 @@ MotionEventAndroid::MotionEventAndroid(float pix_to_dip, |
| MotionEventAndroid::MotionEventAndroid(float pix_to_dip, |
| JNIEnv* env, |
| - jobject event) |
| + jobject event, |
| + bool should_recycle) |
|
cjhopman
2014/07/09 22:29:12
So this constructor makes like ~16 jni calls (and
jdduke (slow)
2014/07/10 02:08:39
Agreed, I'll take a closer look at this. I think
|
| : cached_time_(FromAndroidTime(Java_MotionEvent_getEventTime(env, event))), |
| cached_action_( |
| FromAndroidAction(Java_MotionEvent_getActionMasked(env, event))), |
| @@ -156,7 +157,7 @@ MotionEventAndroid::MotionEventAndroid(float pix_to_dip, |
| cached_button_state_( |
| FromAndroidButtonState(Java_MotionEvent_getButtonState(env, event))), |
| pix_to_dip_(pix_to_dip), |
| - should_recycle_(true) { |
| + should_recycle_(should_recycle) { |
| event_.Reset(env, event); |
| DCHECK(event_.obj()); |
| @@ -325,6 +326,7 @@ scoped_ptr<ui::MotionEvent> MotionEventAndroid::Cancel() const { |
| // but the cached coordinates are in DIPs. |
| const gfx::PointF position_pixels = |
| gfx::ScalePoint(cached_positions_[0], 1.f / pix_to_dip_); |
| + const bool recycle = true; |
| return scoped_ptr<MotionEvent>( |
| new MotionEventAndroid(pix_to_dip_, |
| AttachCurrentThread(), |
| @@ -332,7 +334,8 @@ scoped_ptr<ui::MotionEvent> MotionEventAndroid::Cancel() const { |
| GetEventTime(), |
| MotionEventAndroid::ACTION_CANCEL, |
| position_pixels.x(), |
| - position_pixels.y()).obj())); |
| + position_pixels.y()).obj(), |
| + recycle)); |
| } |
| float MotionEventAndroid::GetTouchMinor(size_t pointer_index) const { |