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

Side by Side Diff: chrome/browser/page_load_metrics/user_input_tracker.cc

Issue 2611943004: Disable UserInputTracker DCHECK which is firing in unit tests. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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 "chrome/browser/page_load_metrics/user_input_tracker.h" 5 #include "chrome/browser/page_load_metrics/user_input_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "third_party/WebKit/public/platform/WebInputEvent.h" 9 #include "third_party/WebKit/public/platform/WebInputEvent.h"
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // can be used to distinguish these cases. isTrusted isn't yet a property of 92 // can be used to distinguish these cases. isTrusted isn't yet a property of
93 // WebInputEvent. We should consider adding it. 93 // WebInputEvent. We should consider adding it.
94 94
95 const base::TimeTicks now = base::TimeTicks::Now(); 95 const base::TimeTicks now = base::TimeTicks::Now();
96 base::TimeTicks time = RoundToRateLimitedOffset(GetEventTime(event)); 96 base::TimeTicks time = RoundToRateLimitedOffset(GetEventTime(event));
97 if (time <= 97 if (time <=
98 std::max(most_recent_consumed_time_, now - GetOldEventThreshold())) 98 std::max(most_recent_consumed_time_, now - GetOldEventThreshold()))
99 return; 99 return;
100 100
101 if (time > now) { 101 if (time > now) {
102 DCHECK(!base::TimeTicks::IsHighResolution()); 102 // We should never receive a UserInputEvent with a timestamp in the future
103 // if we're on a platform with a high-res clock, where the monotonic clock
104 // is system-wide monotonic. Unfortunately, this DCHECK seems to fire in
105 // some linux unit tests, so it is disabled for the time being. See
106 // crbug.com/678093 for more details.
107 // DCHECK(!base::TimeTicks::IsHighResolution());
103 return; 108 return;
104 } 109 }
105 110
106 // lower_bound finds the first element >= |time|. 111 // lower_bound finds the first element >= |time|.
107 auto it = std::lower_bound(sorted_event_times_.begin(), 112 auto it = std::lower_bound(sorted_event_times_.begin(),
108 sorted_event_times_.end(), time); 113 sorted_event_times_.end(), time);
109 if (it != sorted_event_times_.end() && *it == time) { 114 if (it != sorted_event_times_.end() && *it == time) {
110 // Don't insert duplicate values. 115 // Don't insert duplicate values.
111 return; 116 return;
112 } 117 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 std::upper_bound(sorted_event_times_.begin(), sorted_event_times_.end(), 172 std::upper_bound(sorted_event_times_.begin(), sorted_event_times_.end(),
168 cutoff)); 173 cutoff));
169 } 174 }
170 175
171 // static 176 // static
172 base::TimeDelta UserInputTracker::GetOldEventThreshold() { 177 base::TimeDelta UserInputTracker::GetOldEventThreshold() {
173 return base::TimeDelta::FromSeconds(kOldestAllowedEventAgeSeconds); 178 return base::TimeDelta::FromSeconds(kOldestAllowedEventAgeSeconds);
174 } 179 }
175 180
176 } // namespace page_load_metrics 181 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698