| 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/WebCoalescedInputEvent.h" | |
| 12 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 11 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| 13 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" | 12 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" |
| 14 #include "third_party/WebKit/public/platform/WebTouchEvent.h" | 13 #include "third_party/WebKit/public/platform/WebTouchEvent.h" |
| 15 #include "ui/events/blink/blink_event_util.h" | 14 #include "ui/events/blink/blink_event_util.h" |
| 15 #include "ui/events/blink/web_input_event_traits.h" |
| 16 #include "ui/events/latency_info.h" | 16 #include "ui/events/latency_info.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class ScopedWebInputEventWithLatencyInfo { | |
| 21 public: | |
| 22 ScopedWebInputEventWithLatencyInfo(blink::WebScopedInputEvent, | |
| 23 const ui::LatencyInfo&); | |
| 24 | |
| 25 ~ScopedWebInputEventWithLatencyInfo(); | |
| 26 | |
| 27 bool CanCoalesceWith(const ScopedWebInputEventWithLatencyInfo& other) const | |
| 28 WARN_UNUSED_RESULT; | |
| 29 | |
| 30 const blink::WebInputEvent& event() const; | |
| 31 const blink::WebCoalescedInputEvent& coalesced_event() const; | |
| 32 blink::WebInputEvent& event(); | |
| 33 const ui::LatencyInfo latencyInfo() const { return latency_; } | |
| 34 | |
| 35 void CoalesceWith(const ScopedWebInputEventWithLatencyInfo& other); | |
| 36 | |
| 37 private: | |
| 38 blink::WebScopedCoalescedInputEvent event_; | |
| 39 mutable ui::LatencyInfo latency_; | |
| 40 }; | |
| 41 | |
| 42 template <typename T> | 20 template <typename T> |
| 43 class EventWithLatencyInfo { | 21 class EventWithLatencyInfo { |
| 44 public: | 22 public: |
| 45 T event; | 23 T event; |
| 46 mutable ui::LatencyInfo latency; | 24 mutable ui::LatencyInfo latency; |
| 47 | 25 |
| 48 explicit EventWithLatencyInfo(const T& e) : event(e) {} | 26 explicit EventWithLatencyInfo(const T& e) : event(e) {} |
| 49 | 27 |
| 50 EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l) | 28 EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l) |
| 51 : event(e), latency(l) {} | 29 : event(e), latency(l) {} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> | 71 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> |
| 94 MouseWheelEventWithLatencyInfo; | 72 MouseWheelEventWithLatencyInfo; |
| 95 typedef EventWithLatencyInfo<blink::WebMouseEvent> | 73 typedef EventWithLatencyInfo<blink::WebMouseEvent> |
| 96 MouseEventWithLatencyInfo; | 74 MouseEventWithLatencyInfo; |
| 97 typedef EventWithLatencyInfo<blink::WebTouchEvent> | 75 typedef EventWithLatencyInfo<blink::WebTouchEvent> |
| 98 TouchEventWithLatencyInfo; | 76 TouchEventWithLatencyInfo; |
| 99 | 77 |
| 100 } // namespace content | 78 } // namespace content |
| 101 | 79 |
| 102 #endif // CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ | 80 #endif // CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ |
| OLD | NEW |