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

Side by Side Diff: content/browser/renderer_host/touch_event_queue.cc

Issue 11148008: touch-event queue: Add a touch-event queue for all platforms. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/touch_event_queue.h"
6
7 #include "content/browser/renderer_host/render_widget_host_impl.h"
8 #include "content/public/browser/render_widget_host_view.h"
9 #include "content/port/browser/render_widget_host_view_port.h"
10
11 namespace content {
12
13 TouchEventQueue::TouchEventQueue(RenderWidgetHostImpl* host)
14 : render_widget_host_(host) {
15 }
16
17 TouchEventQueue::~TouchEventQueue() {
18 }
19
20 void TouchEventQueue::QueueEvent(const WebKit::WebTouchEvent& event) {
21 if (touch_queue_.empty()) {
22 // There is no touch event in the queue. Forward it to the renderer
23 // immediately.
24 touch_queue_.push_back(event);
25 render_widget_host_->ForwardTouchEventImmediately(event);
26 return;
27 }
28
29 // TODO(sad): Coalesce with |touch_queue_.back()| if appropriate.
30 // http://crbug.com/110231
31 touch_queue_.push_back(event);
32 }
33
34 void TouchEventQueue::ProcessTouchAck(bool processed) {
35 CHECK(!touch_queue_.empty());
36 WebKit::WebTouchEvent acked_event = touch_queue_.front();
37 touch_queue_.pop_front();
38
39 // Note that acking the touch-event may result in multiple gestures being sent
40 // to the renderer.
41 RenderWidgetHostViewPort* view = RenderWidgetHostViewPort::FromRWHV(
42 render_widget_host_->GetView());
43 view->ProcessAckedTouchEvent(acked_event, processed);
44
45 // If there's a queued touch-event, then forward it to the renderer now.
46 if (!touch_queue_.empty())
47 render_widget_host_->ForwardTouchEventImmediately(touch_queue_.front());
48 }
49
50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698