Chromium Code Reviews| Index: ui/events/platform/x11/x11_event_source.cc |
| diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc |
| index 03c84f8b20c0dd5a4e476f82088b331408fdd679..f70ea29dafa7e00a6f463f23583fa58284e49a3e 100644 |
| --- a/ui/events/platform/x11/x11_event_source.cc |
| +++ b/ui/events/platform/x11/x11_event_source.cc |
| @@ -95,7 +95,6 @@ X11EventSource::X11EventSource(X11EventSourceDelegate* delegate, |
| XDisplay* display) |
| : delegate_(delegate), |
| display_(display), |
| - last_seen_server_time_(CurrentTime), |
| event_timestamp_(CurrentTime), |
| dummy_initialized_(false), |
| continue_stream_(true) { |
| @@ -153,7 +152,7 @@ void X11EventSource::BlockUntilWindowUnmapped(XID window) { |
| BlockOnWindowStructureEvent(window, UnmapNotify); |
| } |
| -Time X11EventSource::UpdateLastSeenServerTime() { |
| +Time X11EventSource::GetCurrentServerTime() { |
| base::TimeTicks start = base::TimeTicks::Now(); |
| DCHECK(display_); |
| @@ -176,25 +175,11 @@ Time X11EventSource::UpdateLastSeenServerTime() { |
| XIfEvent(display_, &event, IsPropertyNotifyForTimestamp, |
| reinterpret_cast<XPointer>(&dummy_window_)); |
| - last_seen_server_time_ = event.xproperty.time; |
| - |
| UMA_HISTOGRAM_CUSTOM_COUNTS( |
| "Event.Latency.X11EventSource.UpdateServerTime", |
|
Daniel Erat
2016/08/27 01:47:07
nit: time to consider fixing this histogram name?
Tom (Use chromium acct)
2016/08/30 19:14:58
Done.
|
| (base::TimeTicks::Now() - start).InMicroseconds(), 1, |
| base::TimeDelta::FromMilliseconds(1).InMicroseconds(), 50); |
| - return last_seen_server_time_; |
| -} |
| - |
| -void X11EventSource::SetLastSeenServerTime(Time time) { |
| - if (time != CurrentTime) { |
| - int64_t event_time_64 = time; |
| - int64_t time_difference = last_seen_server_time_ - event_time_64; |
| - // Ignore timestamps that go backwards. However, X server time is a 32-bit |
| - // millisecond counter, so if the time goes backwards by more than half the |
| - // range of the 32-bit counter, treat it as a rollover. |
| - if (time_difference < 0 || time_difference > (UINT32_MAX >> 1)) |
| - last_seen_server_time_ = time; |
| - } |
| + return event.xproperty.time; |
| } |
| Time X11EventSource::GetTimestamp() { |
| @@ -202,7 +187,7 @@ Time X11EventSource::GetTimestamp() { |
| return event_timestamp_; |
| } |
| DVLOG(1) << "Making a round trip to get a recent server timestamp."; |
| - return UpdateLastSeenServerTime(); |
| + return GetCurrentServerTime(); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -216,7 +201,6 @@ void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) { |
| } |
| event_timestamp_ = ExtractTimeFromXEvent(*xevent); |
| - SetLastSeenServerTime(event_timestamp_); |
| delegate_->ProcessXEvent(xevent); |
| PostDispatchEvent(xevent); |