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

Side by Side Diff: ui/events/gesture_detection/motion_event_buffer.cc

Issue 999423003: Set the unique_event_id when converting from TouchEvent to WebTouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/gesture_detection/motion_event_buffer.h" 5 #include "ui/events/gesture_detection/motion_event_buffer.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "ui/events/gesture_detection/motion_event_generic.h" 8 #include "ui/events/gesture_detection/motion_event_generic.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 if (event0_i == 0) { 140 if (event0_i == 0) {
141 event.reset(new MotionEventGeneric( 141 event.reset(new MotionEventGeneric(
142 MotionEvent::ACTION_MOVE, resample_time, pointer)); 142 MotionEvent::ACTION_MOVE, resample_time, pointer));
143 } else { 143 } else {
144 event->PushPointer(pointer); 144 event->PushPointer(pointer);
145 } 145 }
146 } 146 }
147 147
148 DCHECK(event); 148 DCHECK(event);
149 event->set_id(event0.GetId());
150 event->set_button_state(event0.GetButtonState()); 149 event->set_button_state(event0.GetButtonState());
151 return event.Pass(); 150 return event.Pass();
152 } 151 }
153 152
154 // Synthesize a compound MotionEventGeneric event from a sequence of events. 153 // Synthesize a compound MotionEventGeneric event from a sequence of events.
155 // Events must be in non-decreasing (time) order. 154 // Events must be in non-decreasing (time) order.
156 scoped_ptr<MotionEventGeneric> ConsumeSamples(MotionEventVector events) { 155 scoped_ptr<MotionEventGeneric> ConsumeSamples(MotionEventVector events) {
157 DCHECK(!events.empty()); 156 DCHECK(!events.empty());
158 scoped_ptr<MotionEventGeneric> event(events.back()); 157 scoped_ptr<MotionEventGeneric> event(events.back());
159 for (size_t i = 0; i + 1 < events.size(); ++i) 158 for (size_t i = 0; i + 1 < events.size(); ++i)
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 331
333 void MotionEventBuffer::FlushWithoutResampling(MotionEventVector events) { 332 void MotionEventBuffer::FlushWithoutResampling(MotionEventVector events) {
334 last_extrapolated_event_time_ = base::TimeTicks(); 333 last_extrapolated_event_time_ = base::TimeTicks();
335 if (events.empty()) 334 if (events.empty())
336 return; 335 return;
337 336
338 client_->ForwardMotionEvent(*ConsumeSamples(events.Pass())); 337 client_->ForwardMotionEvent(*ConsumeSamples(events.Pass()));
339 } 338 }
340 339
341 } // namespace ui 340 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/motion_event.h ('k') | ui/events/gesture_detection/motion_event_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698