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

Side by Side Diff: ui/events/blink/event_with_callback.h

Issue 2552853002: [Compositor event queue] Coalesce gesture scroll&pinch of the same sequence (Closed)
Patch Set: Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ 5 #ifndef UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_
6 #define UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ 6 #define UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "ui/events/blink/input_handler_proxy.h" 10 #include "ui/events/blink/input_handler_proxy.h"
11 #include "ui/events/latency_info.h" 11 #include "ui/events/latency_info.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 namespace test { 15 namespace test {
16 class InputHandlerProxyEventQueueTest; 16 class InputHandlerProxyEventQueueTest;
17 } 17 }
18 18
19 class EventWithCallback { 19 class EventWithCallback {
20 public: 20 public:
21 struct OriginalEventWithCallback {
22 OriginalEventWithCallback(
23 ScopedWebInputEvent event,
24 const InputHandlerProxy::EventDispositionCallback& callback);
25 ~OriginalEventWithCallback();
26 ScopedWebInputEvent event_;
27 InputHandlerProxy::EventDispositionCallback callback_;
28 };
29 using OriginalEventList = std::list<OriginalEventWithCallback>;
30
21 EventWithCallback( 31 EventWithCallback(
22 ScopedWebInputEvent event, 32 ScopedWebInputEvent event,
23 const LatencyInfo& latency, 33 const LatencyInfo& latency,
24 base::TimeTicks timestamp_now, 34 base::TimeTicks timestamp_now,
25 const InputHandlerProxy::EventDispositionCallback& callback); 35 const InputHandlerProxy::EventDispositionCallback& callback);
36 EventWithCallback(ScopedWebInputEvent event,
37 const LatencyInfo& latency,
38 base::TimeTicks creation_timestamp,
39 base::TimeTicks last_coalesced_timestamp,
40 std::unique_ptr<OriginalEventList> original_events);
26 ~EventWithCallback(); 41 ~EventWithCallback();
27 42
28 bool CanCoalesceWith(const EventWithCallback& other) const WARN_UNUSED_RESULT; 43 bool CanCoalesceWith(const EventWithCallback& other) const WARN_UNUSED_RESULT;
29 void CoalesceWith(EventWithCallback* other, base::TimeTicks timestamp_now); 44 void CoalesceWith(EventWithCallback* other, base::TimeTicks timestamp_now);
30 45
31 void RunCallbacks(InputHandlerProxy::EventDisposition, 46 void RunCallbacks(InputHandlerProxy::EventDisposition,
32 const LatencyInfo& latency, 47 const LatencyInfo& latency,
33 std::unique_ptr<DidOverscrollParams>); 48 std::unique_ptr<DidOverscrollParams>);
34 49
50 const blink::WebGestureEvent& ToWebGestureEvent() const;
dtapuska 2016/12/08 15:18:37 This method looks a little weird to have on someth
chongz 2016/12/09 20:52:25 Moved to "blink_event_util.h".
35 const blink::WebInputEvent& event() const { return *event_; } 51 const blink::WebInputEvent& event() const { return *event_; }
36 const LatencyInfo latency_info() const { return latency_; } 52 const LatencyInfo latency_info() const { return latency_; }
37 base::TimeTicks creation_timestamp() const { return creation_timestamp_; } 53 base::TimeTicks creation_timestamp() const { return creation_timestamp_; }
38 base::TimeTicks last_coalesced_timestamp() const { 54 base::TimeTicks last_coalesced_timestamp() const {
39 return last_coalesced_timestamp_; 55 return last_coalesced_timestamp_;
40 } 56 }
41 size_t coalesced_count() const { return original_events_.size(); } 57 size_t coalesced_count() const { return original_events_.size(); }
58 OriginalEventList& original_events() { return original_events_; }
42 59
43 private: 60 private:
44 friend class test::InputHandlerProxyEventQueueTest; 61 friend class test::InputHandlerProxyEventQueueTest;
45 struct OriginalEventWithCallback {
46 OriginalEventWithCallback(
47 ScopedWebInputEvent event,
48 const InputHandlerProxy::EventDispositionCallback& callback);
49 ~OriginalEventWithCallback();
50 ScopedWebInputEvent event_;
51 InputHandlerProxy::EventDispositionCallback callback_;
52 };
53 62
54 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 63 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
55 64
56 ScopedWebInputEvent event_; 65 ScopedWebInputEvent event_;
57 LatencyInfo latency_; 66 LatencyInfo latency_;
58 std::list<OriginalEventWithCallback> original_events_; 67 OriginalEventList original_events_;
59 68
60 base::TimeTicks creation_timestamp_; 69 base::TimeTicks creation_timestamp_;
61 base::TimeTicks last_coalesced_timestamp_; 70 base::TimeTicks last_coalesced_timestamp_;
62 }; 71 };
63 72
64 } // namespace ui 73 } // namespace ui
65 74
66 #endif // UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_ 75 #endif // UI_EVENTS_BLINK_EVENT_WITH_CALLBACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698