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

Unified Diff: ui/events/event_utils.cc

Issue 2295923003: Expand event timestamp validation check to more platforms (Closed)
Patch Set: Fix mistake Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event_utils.cc
diff --git a/ui/events/event_utils.cc b/ui/events/event_utils.cc
index 2e34a82477e0ed6a591b0e325c4a7d1dd34a4a71..f60daf6d991a24ba55a61c24d5d27d9535946d2b 100644
--- a/ui/events/event_utils.cc
+++ b/ui/events/event_utils.cc
@@ -62,25 +62,20 @@ int RegisterCustomEventType() {
}
void ValidateEventTimeClock(base::TimeTicks* timestamp) {
-// Restrict this validation to DCHECK builds except when using X11 which is
-// known to provide bogus timestamps that require correction (crbug.com/611950).
-#if defined(USE_X11) || DCHECK_IS_ON()
if (base::debug::BeingDebugged())
return;
base::TimeTicks now = EventTimeForNow();
int64_t delta = (now - *timestamp).InMilliseconds();
- if (delta < 0 || delta > 60 * 1000) {
- UMA_HISTOGRAM_BOOLEAN("Event.TimestampHasValidTimebase", false);
+ bool has_valid_timebase = delta >= 0 && delta <= 60 * 1000;
+ UMA_HISTOGRAM_BOOLEAN("Event.TimestampHasValidTimebase.Browser",
+ has_valid_timebase);
+
#if defined(USE_X11)
+ // Restrict this correction to X11 which is known to provide bogus timestamps
+ // that require correction (crbug.com/611950).
+ if (!has_valid_timebase)
*timestamp = now;
-#else
- NOTREACHED() << "Unexpected event timestamp, now:" << now
- << " event timestamp:" << *timestamp;
-#endif
- }
-
- UMA_HISTOGRAM_BOOLEAN("Event.TimestampHasValidTimebase", true);
#endif
}
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698