OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ | 5 #ifndef CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ |
6 #define CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ | 6 #define CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "third_party/WebKit/public/platform/CoalescedWebInputEvent.h" |
11 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 12 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
12 #include "third_party/WebKit/public/platform/WebInputEvent.h" | |
13 #include "ui/events/blink/scoped_web_input_event.h" | |
14 #include "ui/events/latency_info.h" | 13 #include "ui/events/latency_info.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 namespace internal { | 16 namespace internal { |
18 | 17 |
19 bool CONTENT_EXPORT CanCoalesce(const blink::WebMouseEvent& event_to_coalesce, | 18 bool CONTENT_EXPORT CanCoalesce(const blink::WebMouseEvent& event_to_coalesce, |
20 const blink::WebMouseEvent& event); | 19 const blink::WebMouseEvent& event); |
21 void CONTENT_EXPORT Coalesce(const blink::WebMouseEvent& event_to_coalesce, | 20 void CONTENT_EXPORT Coalesce(const blink::WebMouseEvent& event_to_coalesce, |
22 blink::WebMouseEvent* event); | 21 blink::WebMouseEvent* event); |
23 bool CONTENT_EXPORT | 22 bool CONTENT_EXPORT |
24 CanCoalesce(const blink::WebMouseWheelEvent& event_to_coalesce, | 23 CanCoalesce(const blink::WebMouseWheelEvent& event_to_coalesce, |
25 const blink::WebMouseWheelEvent& event); | 24 const blink::WebMouseWheelEvent& event); |
26 void CONTENT_EXPORT Coalesce(const blink::WebMouseWheelEvent& event_to_coalesce, | 25 void CONTENT_EXPORT Coalesce(const blink::WebMouseWheelEvent& event_to_coalesce, |
27 blink::WebMouseWheelEvent* event); | 26 blink::WebMouseWheelEvent* event); |
28 bool CONTENT_EXPORT CanCoalesce(const blink::WebTouchEvent& event_to_coalesce, | 27 bool CONTENT_EXPORT CanCoalesce(const blink::WebTouchEvent& event_to_coalesce, |
29 const blink::WebTouchEvent& event); | 28 const blink::WebTouchEvent& event); |
30 void CONTENT_EXPORT Coalesce(const blink::WebTouchEvent& event_to_coalesce, | 29 void CONTENT_EXPORT Coalesce(const blink::WebTouchEvent& event_to_coalesce, |
31 blink::WebTouchEvent* event); | 30 blink::WebTouchEvent* event); |
32 bool CONTENT_EXPORT CanCoalesce(const blink::WebGestureEvent& event_to_coalesce, | 31 bool CONTENT_EXPORT CanCoalesce(const blink::WebGestureEvent& event_to_coalesce, |
33 const blink::WebGestureEvent& event); | 32 const blink::WebGestureEvent& event); |
34 void CONTENT_EXPORT Coalesce(const blink::WebGestureEvent& event_to_coalesce, | 33 void CONTENT_EXPORT Coalesce(const blink::WebGestureEvent& event_to_coalesce, |
35 blink::WebGestureEvent* event); | 34 blink::WebGestureEvent* event); |
36 | 35 |
37 } // namespace internal | 36 } // namespace internal |
38 | 37 |
39 class ScopedWebInputEventWithLatencyInfo { | 38 class ScopedWebInputEventWithLatencyInfo { |
40 public: | 39 public: |
41 ScopedWebInputEventWithLatencyInfo(ui::ScopedWebInputEvent, | 40 ScopedWebInputEventWithLatencyInfo( |
42 const ui::LatencyInfo&); | 41 blink::CoalescedWebInputEvent::ScopedWebInputEvent, |
| 42 const ui::LatencyInfo&); |
43 | 43 |
44 ~ScopedWebInputEventWithLatencyInfo(); | 44 ~ScopedWebInputEventWithLatencyInfo(); |
45 | 45 |
46 bool CanCoalesceWith(const ScopedWebInputEventWithLatencyInfo& other) const | 46 bool CanCoalesceWith(const ScopedWebInputEventWithLatencyInfo& other) const |
47 WARN_UNUSED_RESULT; | 47 WARN_UNUSED_RESULT; |
48 | 48 |
49 const blink::WebInputEvent& event() const; | 49 const blink::CoalescedWebInputEvent& coalescedEvent() const; |
50 blink::WebInputEvent& event(); | 50 blink::CoalescedWebInputEvent& coalescedEvent(); |
51 const ui::LatencyInfo latencyInfo() const { return latency_; } | 51 const ui::LatencyInfo latencyInfo() const { return latency_; } |
52 | 52 |
53 void CoalesceWith(const ScopedWebInputEventWithLatencyInfo& other); | 53 void CoalesceWith(const ScopedWebInputEventWithLatencyInfo& other); |
54 | 54 |
55 private: | 55 private: |
56 ui::ScopedWebInputEvent event_; | 56 blink::ScopedCoalescedWebInputEvent event_; |
| 57 |
57 mutable ui::LatencyInfo latency_; | 58 mutable ui::LatencyInfo latency_; |
58 }; | 59 }; |
59 | 60 |
60 template <typename T> | 61 template <typename T> |
61 class EventWithLatencyInfo { | 62 class EventWithLatencyInfo { |
62 public: | 63 public: |
63 T event; | 64 T event; |
64 mutable ui::LatencyInfo latency; | 65 mutable ui::LatencyInfo latency; |
65 | 66 |
66 explicit EventWithLatencyInfo(const T& e) : event(e) {} | 67 explicit EventWithLatencyInfo(const T& e) : event(e) {} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> | 106 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> |
106 MouseWheelEventWithLatencyInfo; | 107 MouseWheelEventWithLatencyInfo; |
107 typedef EventWithLatencyInfo<blink::WebMouseEvent> | 108 typedef EventWithLatencyInfo<blink::WebMouseEvent> |
108 MouseEventWithLatencyInfo; | 109 MouseEventWithLatencyInfo; |
109 typedef EventWithLatencyInfo<blink::WebTouchEvent> | 110 typedef EventWithLatencyInfo<blink::WebTouchEvent> |
110 TouchEventWithLatencyInfo; | 111 TouchEventWithLatencyInfo; |
111 | 112 |
112 } // namespace content | 113 } // namespace content |
113 | 114 |
114 #endif // CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ | 115 #endif // CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ |
OLD | NEW |