Chromium Code Reviews| Index: ui/events/gestures/gesture_sequence.cc |
| diff --git a/ui/events/gestures/gesture_sequence.cc b/ui/events/gestures/gesture_sequence.cc |
| index 83266856e8cecac1dbb3ebdb944a575ea2d684df..47b44c3c7f69964ca295bf8fa660db73d802060b 100644 |
| --- a/ui/events/gestures/gesture_sequence.cc |
| +++ b/ui/events/gestures/gesture_sequence.cc |
| @@ -596,12 +596,7 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( |
| } |
| } |
| - const ui::LatencyInfo* touch_latency = event.latency(); |
| - Gestures::iterator it = gestures->begin(); |
| - for (; it != gestures->end(); it++) { |
| - (*it)->latency()->MergeWith(*touch_latency); |
| - } |
| - |
| + UpdateGestureEventLatencyInfo(event, gestures.get()); |
| return gestures.release(); |
| } |
| @@ -1235,4 +1230,29 @@ void GestureSequence::StopLongPressTimerIfRequired(const TouchEvent& event) { |
| GetLongPressTimer()->Stop(); |
| } |
| +void GestureSequence::UpdateGestureEventLatencyInfo(const TouchEvent& event, |
|
sadrul
2013/10/10 21:58:38
Move this into an independent function in the anon
Yufeng Shen (Slow to review)
2013/10/10 22:52:15
Done.
|
| + Gestures* gestures) { |
| + // If the touch event does not cause any rendering scheduled, then |
| + // 1) If the touch event does not generate any gesture event, its |
| + // LatencyInfo ends here. |
| + // 2) If the touch event generates gesture events, its latencyinfo |
| + // is copied into the gesture events. |
| + if (!event.latency()->FindLatency( |
| + ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
| + if (gestures->empty()) { |
| + ui::LatencyInfo* touch_latency = |
| + const_cast<ui::LatencyInfo*>(event.latency()); |
| + touch_latency->AddLatencyNumber( |
| + ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); |
| + } else { |
| + Gestures::iterator it = gestures->begin(); |
| + for (; it != gestures->end(); it++) { |
| + (*it)->latency()->MergeWith(*event.latency()); |
| + // Inheriting the trace_id from the touch event's LatencyInfo |
| + (*it)->latency()->trace_id = event.latency()->trace_id; |
| + } |
| + } |
| + } |
| +} |
| + |
| } // namespace ui |