| 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_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ |
| 7 | 7 |
| 8 #include "ui/events/latency_info.h" | 8 #include "ui/events/latency_info.h" |
| 9 | 9 |
| 10 #include "content/common/input/web_input_event_traits.h" | 10 #include "content/common/input/web_input_event_traits.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 class WebGestureEvent; | 13 class WebGestureEvent; |
| 14 class WebMouseEvent; | 14 class WebMouseEvent; |
| 15 class WebMouseWheelEvent; | 15 class WebMouseWheelEvent; |
| 16 class WebTouchEvent; | 16 class WebTouchEvent; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 template <typename T> | 21 template <typename T> |
| 22 class EventWithLatencyInfo { | 22 class EventWithLatencyInfo { |
| 23 public: | 23 public: |
| 24 T event; | 24 T event; |
| 25 ui::LatencyInfo latency; | 25 mutable ui::LatencyInfo latency; |
| 26 |
| 27 explicit EventWithLatencyInfo(const T& e) : event(e) {} |
| 26 | 28 |
| 27 EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l) | 29 EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l) |
| 28 : event(e), latency(l) {} | 30 : event(e), latency(l) {} |
| 29 | 31 |
| 30 EventWithLatencyInfo() {} | 32 EventWithLatencyInfo() {} |
| 31 | 33 |
| 32 bool CanCoalesceWith(const EventWithLatencyInfo& other) | 34 bool CanCoalesceWith(const EventWithLatencyInfo& other) |
| 33 const WARN_UNUSED_RESULT { | 35 const WARN_UNUSED_RESULT { |
| 34 return WebInputEventTraits::CanCoalesce(other.event, event); | 36 return WebInputEventTraits::CanCoalesce(other.event, event); |
| 35 } | 37 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> | 52 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> |
| 51 MouseWheelEventWithLatencyInfo; | 53 MouseWheelEventWithLatencyInfo; |
| 52 typedef EventWithLatencyInfo<blink::WebMouseEvent> | 54 typedef EventWithLatencyInfo<blink::WebMouseEvent> |
| 53 MouseEventWithLatencyInfo; | 55 MouseEventWithLatencyInfo; |
| 54 typedef EventWithLatencyInfo<blink::WebTouchEvent> | 56 typedef EventWithLatencyInfo<blink::WebTouchEvent> |
| 55 TouchEventWithLatencyInfo; | 57 TouchEventWithLatencyInfo; |
| 56 | 58 |
| 57 } // namespace content | 59 } // namespace content |
| 58 | 60 |
| 59 #endif // CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ | 61 #endif // CONTENT_BROWSER_RENDERER_HOST_EVENT_WITH_LATENCY_INFO_H_ |
| OLD | NEW |