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

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

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 11 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 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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 void EventWithCallback::CoalesceWith(EventWithCallback* other, 49 void EventWithCallback::CoalesceWith(EventWithCallback* other,
50 base::TimeTicks timestamp_now) { 50 base::TimeTicks timestamp_now) {
51 // |other| should be a newer event than |this|. 51 // |other| should be a newer event than |this|.
52 if (other->latency_.trace_id() >= 0 && latency_.trace_id() >= 0) 52 if (other->latency_.trace_id() >= 0 && latency_.trace_id() >= 0)
53 DCHECK_GT(other->latency_.trace_id(), latency_.trace_id()); 53 DCHECK_GT(other->latency_.trace_id(), latency_.trace_id());
54 54
55 // New events get coalesced into older events, and the newer timestamp 55 // New events get coalesced into older events, and the newer timestamp
56 // should always be preserved. 56 // should always be preserved.
57 const double time_stamp_seconds = other->event().timeStampSeconds; 57 const double time_stamp_seconds = other->event().timeStampSeconds;
58 Coalesce(other->event(), event_.get()); 58 Coalesce(other->event(), event_.get());
59 event_->timeStampSeconds = time_stamp_seconds; 59 event_->setTimeStampSeconds(time_stamp_seconds);
60 60
61 // When coalescing two input events, we keep the oldest LatencyInfo 61 // When coalescing two input events, we keep the oldest LatencyInfo
62 // since it will represent the longest latency. 62 // since it will represent the longest latency.
63 other->latency_ = latency_; 63 other->latency_ = latency_;
64 other->latency_.set_coalesced(); 64 other->latency_.set_coalesced();
65 65
66 // Move original events. 66 // Move original events.
67 original_events_.splice(original_events_.end(), other->original_events_); 67 original_events_.splice(original_events_.end(), other->original_events_);
68 last_coalesced_timestamp_ = timestamp_now; 68 last_coalesced_timestamp_ = timestamp_now;
69 } 69 }
(...skipping 14 matching lines...) Expand all
84 } 84 }
85 85
86 EventWithCallback::OriginalEventWithCallback::OriginalEventWithCallback( 86 EventWithCallback::OriginalEventWithCallback::OriginalEventWithCallback(
87 ScopedWebInputEvent event, 87 ScopedWebInputEvent event,
88 const InputHandlerProxy::EventDispositionCallback& callback) 88 const InputHandlerProxy::EventDispositionCallback& callback)
89 : event_(std::move(event)), callback_(callback) {} 89 : event_(std::move(event)), callback_(callback) {}
90 90
91 EventWithCallback::OriginalEventWithCallback::~OriginalEventWithCallback() {} 91 EventWithCallback::OriginalEventWithCallback::~OriginalEventWithCallback() {}
92 92
93 } // namespace ui 93 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698