Chromium Code Reviews| Index: ui/events/event.cc |
| diff --git a/ui/events/event.cc b/ui/events/event.cc |
| index e93a0aedf618c3810be06c34b6b253f258c29be3..3248433cc9065a92bbb3f54c8915490758f9ba2f 100644 |
| --- a/ui/events/event.cc |
| +++ b/ui/events/event.cc |
| @@ -517,18 +517,18 @@ TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
| radius_x_(GetTouchRadiusX(native_event)), |
| radius_y_(GetTouchRadiusY(native_event)), |
| rotation_angle_(GetTouchAngle(native_event)), |
| - force_(GetTouchForce(native_event)) { |
| + force_(GetTouchForce(native_event)), |
| + should_remove_native_touch_id_mapping_(false) { |
| latency()->AddLatencyNumberWithTimestamp( |
| INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 0, |
| 0, |
| base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), |
| 1); |
| + if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED) |
| + should_remove_native_touch_id_mapping_ = true; |
|
sadrul
2015/01/14 20:21:35
Do this before or after the latency block.
tdresser
2015/01/23 18:12:34
Done.
|
| latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| - |
| - if (type() == ET_TOUCH_PRESSED) |
| - IncrementTouchIdRefCount(native_event); |
| } |
| TouchEvent::TouchEvent(EventType type, |
| @@ -540,7 +540,8 @@ TouchEvent::TouchEvent(EventType type, |
| radius_x_(0.0f), |
| radius_y_(0.0f), |
| rotation_angle_(0.0f), |
| - force_(0.0f) { |
| + force_(0.0f), |
| + should_remove_native_touch_id_mapping_(false) { |
| latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| } |
| @@ -558,7 +559,8 @@ TouchEvent::TouchEvent(EventType type, |
| radius_x_(radius_x), |
| radius_y_(radius_y), |
| rotation_angle_(angle), |
| - force_(force) { |
| + force_(force), |
| + should_remove_native_touch_id_mapping_(false) { |
| latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| } |
| @@ -566,8 +568,11 @@ TouchEvent::~TouchEvent() { |
| // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
| // platform setups the tracking_id to slot mapping. So in dtor here, |
| // if this touch event is a release event, we clear the mapping accordingly. |
| - if (HasNativeEvent()) |
| - ClearTouchIdIfReleased(native_event()); |
| + if (should_remove_native_touch_id_mapping_) { |
| + DCHECK(type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED); |
| + if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED) |
| + ClearTouchIdIfReleased(native_event()); |
| + } |
| } |
| void TouchEvent::UpdateForRootTransform( |