| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 void EventWithCallback::CoalesceWith(EventWithCallback* other, | 35 void EventWithCallback::CoalesceWith(EventWithCallback* other, |
| 36 base::TimeTicks timestamp_now) { | 36 base::TimeTicks timestamp_now) { |
| 37 // |other| should be a newer event than |this|. | 37 // |other| should be a newer event than |this|. |
| 38 if (other->latency_.trace_id() >= 0 && latency_.trace_id() >= 0) | 38 if (other->latency_.trace_id() >= 0 && latency_.trace_id() >= 0) |
| 39 DCHECK_GT(other->latency_.trace_id(), latency_.trace_id()); | 39 DCHECK_GT(other->latency_.trace_id(), latency_.trace_id()); |
| 40 | 40 |
| 41 // New events get coalesced into older events, and the newer timestamp | 41 // New events get coalesced into older events, and the newer timestamp |
| 42 // should always be preserved. | 42 // should always be preserved. |
| 43 const double time_stamp_seconds = other->event().timeStampSeconds; | 43 const double time_stamp_seconds = other->event().timeStampSeconds(); |
| 44 Coalesce(other->event(), event_.get()); | 44 Coalesce(other->event(), event_.get()); |
| 45 event_->setTimeStampSeconds(time_stamp_seconds); | 45 event_->setTimeStampSeconds(time_stamp_seconds); |
| 46 | 46 |
| 47 // When coalescing two input events, we keep the oldest LatencyInfo | 47 // When coalescing two input events, we keep the oldest LatencyInfo |
| 48 // since it will represent the longest latency. | 48 // since it will represent the longest latency. |
| 49 other->latency_ = latency_; | 49 other->latency_ = latency_; |
| 50 other->latency_.set_coalesced(); | 50 other->latency_.set_coalesced(); |
| 51 | 51 |
| 52 // Move original events. | 52 // Move original events. |
| 53 original_events_.splice(original_events_.end(), other->original_events_); | 53 original_events_.splice(original_events_.end(), other->original_events_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 EventWithCallback::OriginalEventWithCallback::OriginalEventWithCallback( | 72 EventWithCallback::OriginalEventWithCallback::OriginalEventWithCallback( |
| 73 ScopedWebInputEvent event, | 73 ScopedWebInputEvent event, |
| 74 const InputHandlerProxy::EventDispositionCallback& callback) | 74 const InputHandlerProxy::EventDispositionCallback& callback) |
| 75 : event_(std::move(event)), callback_(callback) {} | 75 : event_(std::move(event)), callback_(callback) {} |
| 76 | 76 |
| 77 EventWithCallback::OriginalEventWithCallback::~OriginalEventWithCallback() {} | 77 EventWithCallback::OriginalEventWithCallback::~OriginalEventWithCallback() {} |
| 78 | 78 |
| 79 } // namespace ui | 79 } // namespace ui |
| OLD | NEW |