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

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

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/touch_event_queue.h
diff --git a/content/browser/renderer_host/touch_event_queue.h b/content/browser/renderer_host/touch_event_queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..2301fbd0f12441fc6d669381f4555df7e5442f1d
--- /dev/null
+++ b/content/browser/renderer_host/touch_event_queue.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_
+#define CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_
+
+#include <deque>
+
+#include "base/basictypes.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
+
+namespace content {
+
+class RenderWidgetHostImpl;
+
+// A queue for throttling and coalescing touch-events.
+class TouchEventQueue {
+ public:
+ explicit TouchEventQueue(RenderWidgetHostImpl* host);
+ virtual ~TouchEventQueue();
+
+ // Adds an event to the queue. The event may be coalesced with previously
+ // queued events (e.g. consecutive touch-move events can be coalesced into a
+ // single touch-move event). The event may also be immediately forwarded to
+ // the renderer (e.g. when there are no other queued touch event).
+ void QueueEvent(const WebKit::WebTouchEvent& event);
+
+ // Notifies the queue that a touch-event has been processed by the renderer.
+ // At this point, the queue may send one or more gesture events and/or
+ // additional queued touch-events to the renderer.
+ void ProcessTouchAck(bool processed);
+
+ private:
+ // The RenderWidgetHost that owns this event-queue.
+ RenderWidgetHostImpl* render_widget_host_;
+
+ typedef std::deque<WebKit::WebTouchEvent> TouchQueue;
+ TouchQueue touch_queue_;
+
+ DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_TOUCH_EVENT_QUEUE_H_

Powered by Google App Engine
This is Rietveld 408576698