| Index: ui/events/event_utils.cc
|
| diff --git a/ui/events/event_utils.cc b/ui/events/event_utils.cc
|
| index a079ff22b620093e8673b61d7945ead6a257393b..2e34a82477e0ed6a591b0e325c4a7d1dd34a4a71 100644
|
| --- a/ui/events/event_utils.cc
|
| +++ b/ui/events/event_utils.cc
|
| @@ -61,8 +61,27 @@ int RegisterCustomEventType() {
|
| return ++g_custom_event_types;
|
| }
|
|
|
| -base::TimeTicks EventTimeForNow() {
|
| - return base::TimeTicks::Now();
|
| +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);
|
| +#if defined(USE_X11)
|
| + *timestamp = now;
|
| +#else
|
| + NOTREACHED() << "Unexpected event timestamp, now:" << now
|
| + << " event timestamp:" << *timestamp;
|
| +#endif
|
| + }
|
| +
|
| + UMA_HISTOGRAM_BOOLEAN("Event.TimestampHasValidTimebase", true);
|
| +#endif
|
| }
|
|
|
| bool ShouldDefaultToNaturalScroll() {
|
|
|