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

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

Issue 2552853002: [Compositor event queue] Coalesce gesture scroll&pinch of the same sequence (Closed)
Patch Set: sadrul's comments, fix dependency 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
« no previous file with comments | « ui/events/blink/event_with_callback.h ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/events/blink/event_with_callback.h" 5 #include "ui/events/blink/event_with_callback.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/events/blink/blink_event_util.h" 8 #include "ui/events/blink/blink_event_util.h"
9 #include "ui/events/blink/did_overscroll_params.h" 9 #include "ui/events/blink/did_overscroll_params.h"
10 #include "ui/events/blink/web_input_event_traits.h" 10 #include "ui/events/blink/web_input_event_traits.h"
11 11
12 using blink::WebInputEvent; 12 using blink::WebInputEvent;
13 using blink::WebGestureEvent; 13 using blink::WebGestureEvent;
14 14
15 namespace ui { 15 namespace ui {
16 16
17 EventWithCallback::EventWithCallback( 17 EventWithCallback::EventWithCallback(
18 ScopedWebInputEvent event, 18 ScopedWebInputEvent event,
19 const LatencyInfo& latency, 19 const LatencyInfo& latency,
20 base::TimeTicks timestamp_now, 20 base::TimeTicks timestamp_now,
21 const InputHandlerProxy::EventDispositionCallback& callback) 21 const InputHandlerProxy::EventDispositionCallback& callback)
22 : event_(WebInputEventTraits::Clone(*event)), 22 : event_(WebInputEventTraits::Clone(*event)),
23 latency_(latency), 23 latency_(latency),
24 creation_timestamp_(timestamp_now), 24 creation_timestamp_(timestamp_now),
25 last_coalesced_timestamp_(timestamp_now) { 25 last_coalesced_timestamp_(timestamp_now) {
26 original_events_.emplace_back(std::move(event), callback); 26 original_events_.emplace_back(std::move(event), callback);
27 } 27 }
28 28
29 EventWithCallback::EventWithCallback(
30 ScopedWebInputEvent event,
31 const LatencyInfo& latency,
32 base::TimeTicks creation_timestamp,
33 base::TimeTicks last_coalesced_timestamp,
34 std::unique_ptr<OriginalEventList> original_events)
35 : event_(std::move(event)),
36 latency_(latency),
37 creation_timestamp_(creation_timestamp),
38 last_coalesced_timestamp_(last_coalesced_timestamp) {
39 if (original_events)
40 original_events_.splice(original_events_.end(), *original_events);
41 }
42
29 EventWithCallback::~EventWithCallback() {} 43 EventWithCallback::~EventWithCallback() {}
30 44
31 bool EventWithCallback::CanCoalesceWith(const EventWithCallback& other) const { 45 bool EventWithCallback::CanCoalesceWith(const EventWithCallback& other) const {
32 return CanCoalesce(other.event(), event()); 46 return CanCoalesce(other.event(), event());
33 } 47 }
34 48
35 void EventWithCallback::CoalesceWith(EventWithCallback* other, 49 void EventWithCallback::CoalesceWith(EventWithCallback* other,
36 base::TimeTicks timestamp_now) { 50 base::TimeTicks timestamp_now) {
37 // |other| should be a newer event than |this|. 51 // |other| should be a newer event than |this|.
38 if (other->latency_.trace_id() >= 0 && latency_.trace_id() >= 0) 52 if (other->latency_.trace_id() >= 0 && latency_.trace_id() >= 0)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 84 }
71 85
72 EventWithCallback::OriginalEventWithCallback::OriginalEventWithCallback( 86 EventWithCallback::OriginalEventWithCallback::OriginalEventWithCallback(
73 ScopedWebInputEvent event, 87 ScopedWebInputEvent event,
74 const InputHandlerProxy::EventDispositionCallback& callback) 88 const InputHandlerProxy::EventDispositionCallback& callback)
75 : event_(std::move(event)), callback_(callback) {} 89 : event_(std::move(event)), callback_(callback) {}
76 90
77 EventWithCallback::OriginalEventWithCallback::~OriginalEventWithCallback() {} 91 EventWithCallback::OriginalEventWithCallback::~OriginalEventWithCallback() {}
78 92
79 } // namespace ui 93 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/event_with_callback.h ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698