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