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