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

Unified Diff: content/browser/renderer_host/input/legacy_touch_event_queue.h

Issue 2663493003: Move the TouchEventQueue to be completely virtual. (Closed)
Patch Set: Fix nits Created 3 years, 11 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/input/legacy_touch_event_queue.h
diff --git a/content/browser/renderer_host/input/touch_event_queue.h b/content/browser/renderer_host/input/legacy_touch_event_queue.h
similarity index 78%
copy from content/browser/renderer_host/input/touch_event_queue.h
copy to content/browser/renderer_host/input/legacy_touch_event_queue.h
index f039e14aec21a6dfe58449f9e35174f9e4bdf2a7..16ab57ad030af9d04eb591787adb11b2f135cfe3 100644
--- a/content/browser/renderer_host/input/touch_event_queue.h
+++ b/content/browser/renderer_host/input/legacy_touch_event_queue.h
@@ -2,8 +2,8 @@
// 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_INPUT_TOUCH_EVENT_QUEUE_H_
-#define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_
#include <stddef.h>
#include <stdint.h>
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "base/time/time.h"
#include "content/browser/renderer_host/event_with_latency_info.h"
+#include "content/browser/renderer_host/input/touch_event_queue.h"
#include "content/common/content_export.h"
#include "content/common/input/input_event_ack_state.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
@@ -24,56 +25,23 @@ namespace content {
class CoalescedWebTouchEvent;
-// Interface with which TouchEventQueue can forward touch events, and dispatch
-// touch event responses.
-class CONTENT_EXPORT TouchEventQueueClient {
- public:
- virtual ~TouchEventQueueClient() {}
-
- virtual void SendTouchEventImmediately(
- const TouchEventWithLatencyInfo& event) = 0;
-
- virtual void OnTouchEventAck(
- const TouchEventWithLatencyInfo& event,
- InputEventAckState ack_result) = 0;
-
- virtual void OnFilteringTouchEvent(
- const blink::WebTouchEvent& touch_event) = 0;
-};
-
// A queue for throttling and coalescing touch-events.
-class CONTENT_EXPORT TouchEventQueue {
+class CONTENT_EXPORT LegacyTouchEventQueue : public TouchEventQueue {
public:
- struct CONTENT_EXPORT Config {
- Config();
-
- // Touch ack timeout delay for desktop sites. If zero, timeout behavior
- // is disabled for such sites. Defaults to 200ms.
- base::TimeDelta desktop_touch_ack_timeout_delay;
+ // The |client| must outlive the LegacyTouchEventQueue.
+ LegacyTouchEventQueue(TouchEventQueueClient* client, const Config& config);
- // Touch ack timeout delay for mobile sites. If zero, timeout behavior
- // is disabled for such sites. Defaults to 1000ms.
- base::TimeDelta mobile_touch_ack_timeout_delay;
-
- // Whether the platform supports touch ack timeout behavior.
- // Defaults to false (disabled).
- bool touch_ack_timeout_supported;
- };
-
- // The |client| must outlive the TouchEventQueue.
- TouchEventQueue(TouchEventQueueClient* client, const Config& config);
-
- ~TouchEventQueue();
+ ~LegacyTouchEventQueue() override;
// 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 TouchEventWithLatencyInfo& event);
+ void QueueEvent(const TouchEventWithLatencyInfo& event) override;
// Insert a TouchScrollStarted event in the queue ahead of all not-in-flight
// events.
- void PrependTouchScrollNotification();
+ void PrependTouchScrollNotification() override;
// Notifies the queue that a touch-event has been processed by the renderer.
// At this point, if the ack is for async touchmove, remove the uncancelable
@@ -82,45 +50,43 @@ class CONTENT_EXPORT TouchEventQueue {
// more gesture events and/or additional queued touch-events to the renderer.
void ProcessTouchAck(InputEventAckState ack_result,
const ui::LatencyInfo& latency_info,
- const uint32_t unique_touch_event_id);
+ const uint32_t unique_touch_event_id) override;
// When GestureScrollBegin is received, we send a touch cancel to renderer,
// route all the following touch events directly to client, and ignore the
// ack for the touch cancel. When Gesture{ScrollEnd,FlingStart} is received,
// resume the normal flow of sending touch events to the renderer.
- void OnGestureScrollEvent(const GestureEventWithLatencyInfo& gesture_event);
+ void OnGestureScrollEvent(
+ const GestureEventWithLatencyInfo& gesture_event) override;
- void OnGestureEventAck(
- const GestureEventWithLatencyInfo& event,
- InputEventAckState ack_result);
+ void OnGestureEventAck(const GestureEventWithLatencyInfo& event,
+ InputEventAckState ack_result) override;
// Notifies the queue whether the renderer has at least one touch handler.
- void OnHasTouchEventHandlers(bool has_handlers);
+ void OnHasTouchEventHandlers(bool has_handlers) override;
// Returns whether the currently pending touch event (waiting ACK) is for
// a touch start event.
- bool IsPendingAckTouchStart() const;
+ bool IsPendingAckTouchStart() const override;
// Sets whether a delayed touch ack will cancel and flush the current
// touch sequence. Note that, if the timeout was previously disabled, enabling
// it will take effect only for the following touch sequence.
- void SetAckTimeoutEnabled(bool enabled);
+ void SetAckTimeoutEnabled(bool enabled) override;
// Sets whether the current site has a mobile friendly viewport. This
// determines which ack timeout delay will be used for *future* touch events.
// The default assumption is that the site is *not* mobile-optimized.
- void SetIsMobileOptimizedSite(bool mobile_optimized_site);
+ void SetIsMobileOptimizedSite(bool mobile_optimized_site) override;
// Whether ack timeout behavior is supported and enabled for the current site.
- bool IsAckTimeoutEnabled() const;
+ bool IsAckTimeoutEnabled() const override;
- bool empty() const WARN_UNUSED_RESULT {
- return touch_queue_.empty();
- }
+ bool Empty() const override;
- size_t size() const {
- return touch_queue_.size();
- }
+ bool empty() const WARN_UNUSED_RESULT { return Empty(); }
+
+ size_t size() const { return touch_queue_.size(); }
bool has_handlers() const { return has_handlers_; }
@@ -242,9 +208,9 @@ class CONTENT_EXPORT TouchEventQueue {
// Event is saved to compare pointer positions for new touchmove events.
std::unique_ptr<blink::WebTouchEvent> last_sent_touchevent_;
- DISALLOW_COPY_AND_ASSIGN(TouchEventQueue);
+ DISALLOW_COPY_AND_ASSIGN(LegacyTouchEventQueue);
};
} // namespace content
-#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EVENT_QUEUE_H_
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_LEGACY_TOUCH_EVENT_QUEUE_H_

Powered by Google App Engine
This is Rietveld 408576698