Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: content/common/input/event_with_latency_info.h

Issue 2162143002: Don't use PostTask queueing between compositor and main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't ack mouse move right away send them unthrottled Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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);
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_;
tdresser 2016/07/20 20:52:27 I don't feel great about this being mutable. It's
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698