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

Side by Side Diff: content/common/input/event_with_latency_info.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 "content/common/input/event_with_latency_info.h" 5 #include "content/common/input/event_with_latency_info.h"
6 6
7 using blink::WebInputEvent; 7 using blink::WebInputEvent;
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 13 matching lines...) Expand all
24 void ScopedWebInputEventWithLatencyInfo::CoalesceWith( 24 void ScopedWebInputEventWithLatencyInfo::CoalesceWith(
25 const ScopedWebInputEventWithLatencyInfo& other) { 25 const ScopedWebInputEventWithLatencyInfo& other) {
26 // |other| should be a newer event than |this|. 26 // |other| should be a newer event than |this|.
27 if (other.latency_.trace_id() >= 0 && latency_.trace_id() >= 0) 27 if (other.latency_.trace_id() >= 0 && latency_.trace_id() >= 0)
28 DCHECK_GT(other.latency_.trace_id(), latency_.trace_id()); 28 DCHECK_GT(other.latency_.trace_id(), latency_.trace_id());
29 29
30 // New events get coalesced into older events, and the newer timestamp 30 // New events get coalesced into older events, and the newer timestamp
31 // should always be preserved. 31 // should always be preserved.
32 const double time_stamp_seconds = other.event().timeStampSeconds; 32 const double time_stamp_seconds = other.event().timeStampSeconds;
33 ui::Coalesce(other.event(), event_.get()); 33 ui::Coalesce(other.event(), event_.get());
34 event_->timeStampSeconds = time_stamp_seconds; 34 event_->setTimeStampSeconds(time_stamp_seconds);
35 35
36 // When coalescing two input events, we keep the oldest LatencyInfo 36 // When coalescing two input events, we keep the oldest LatencyInfo
37 // since it will represent the longest latency. 37 // since it will represent the longest latency.
38 other.latency_ = latency_; 38 other.latency_ = latency_;
39 other.latency_.set_coalesced(); 39 other.latency_.set_coalesced();
40 } 40 }
41 41
42 const blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() const { 42 const blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() const {
43 return *event_; 43 return *event_;
44 } 44 }
45 45
46 blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() { 46 blink::WebInputEvent& ScopedWebInputEventWithLatencyInfo::event() {
47 return *event_; 47 return *event_;
48 } 48 }
49 49
50 } // namespace content 50 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698