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

Unified Diff: content/browser/renderer_host/touch_event_queue.cc

Issue 11188012: gesture recognizer: Remove the touch-event queue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/touch_event_queue.h ('k') | content/browser/renderer_host/ui_events_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/touch_event_queue.cc
diff --git a/content/browser/renderer_host/touch_event_queue.cc b/content/browser/renderer_host/touch_event_queue.cc
index d66727daa30ba8d06490380bc669dcbcadcb80d3..1eccd2105b91b3665b30662068e6f908b7b4ae70 100644
--- a/content/browser/renderer_host/touch_event_queue.cc
+++ b/content/browser/renderer_host/touch_event_queue.cc
@@ -26,12 +26,39 @@ void TouchEventQueue::QueueEvent(const WebKit::WebTouchEvent& event) {
return;
}
- // TODO(sad): Coalesce with |touch_queue_.back()| if appropriate.
- // http://crbug.com/110231
+ // If the last queued touch-event was a touch-move, and the current event is
+ // also a touch-move, then the events can be coalesced into a single event.
+ if (!empty()) {
+ WebKit::WebTouchEvent& last_event = touch_queue_.back();
+ if (event.type == WebKit::WebInputEvent::TouchMove &&
+ last_event.type == WebKit::WebInputEvent::TouchMove &&
+ event.modifiers == last_event.modifiers &&
+ event.touchesLength == last_event.touchesLength) {
+ // The WebTouchPoints include absolute position information. So it is
+ // sufficient to simply replace the previous event with the new event.
+ touch_queue_.pop_back();
+ }
+ }
touch_queue_.push_back(event);
}
void TouchEventQueue::ProcessTouchAck(bool processed) {
+ PopTouchEventToView(processed);
+ // If there's a queued touch-event, then forward it to the renderer now.
+ if (!touch_queue_.empty())
+ render_widget_host_->ForwardTouchEventImmediately(touch_queue_.front());
+}
+
+void TouchEventQueue::FlushQueue() {
+ while (!touch_queue_.empty())
+ PopTouchEventToView(false);
+}
+
+void TouchEventQueue::Reset() {
+ touch_queue_.clear();
+}
+
+void TouchEventQueue::PopTouchEventToView(bool processed) {
CHECK(!touch_queue_.empty());
WebKit::WebTouchEvent acked_event = touch_queue_.front();
touch_queue_.pop_front();
@@ -41,10 +68,6 @@ void TouchEventQueue::ProcessTouchAck(bool processed) {
RenderWidgetHostViewPort* view = RenderWidgetHostViewPort::FromRWHV(
render_widget_host_->GetView());
view->ProcessAckedTouchEvent(acked_event, processed);
-
- // If there's a queued touch-event, then forward it to the renderer now.
- if (!touch_queue_.empty())
- render_widget_host_->ForwardTouchEventImmediately(touch_queue_.front());
}
} // namespace content
« no previous file with comments | « content/browser/renderer_host/touch_event_queue.h ('k') | content/browser/renderer_host/ui_events_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698