Change ui::Event::time_stamp from TimeDelta to TimeTicks
Event timestamp values are now consistently coming from the same clock as
base::TimeTicks. Historically this was not the case in particular on Windows
platform which is why we were using base::TimeDelta instead.
Now that this has been addressed we should use base::TimeTicks to make it clear
that these values are expected to come from the same clock and remove some
crufty code.
The changes in the CL are pretty simple and mechanical:
- Introduce a pair of conversion functions in ui/events/base_event_utils.h to
convert between WebInputEvent::timeStampSeconds (double) and
ui::Event::timeStamp (TimeTicks)
- TimeDelta() =>TimeTicks()
- TimeDelta::FromMilliseconds(0) => base::TimeTicks()
- TimeDelta::FromInternalValue(TimeTicks::Now().ToInternalValue()) => TimeTicks::Now()
- TimeDelta::FromMilliseconds(Time::Now().ToDoubleT() * 1000) => TimeTicks::Now()
- Time::NowFromSystemTime() - base::Time() => TimeTicks::Now()
BUG=453559
Review-Url: https://codereview.chromium.org/1975533002
Cr-Commit-Position: refs/heads/master@{#398947}
diff --git a/components/exo/pointer_delegate.h b/components/exo/pointer_delegate.h
index e9c7193..182513d 100644
--- a/components/exo/pointer_delegate.h
+++ b/components/exo/pointer_delegate.h
@@ -40,29 +40,29 @@
virtual void OnPointerLeave(Surface* surface) = 0;
// Called when pointer moved within the current target surface.
- virtual void OnPointerMotion(base::TimeDelta time_stamp,
+ virtual void OnPointerMotion(base::TimeTicks time_stamp,
const gfx::PointF& location) = 0;
// Called when pointer button state changed. |changed_button_flags| contains
// all buttons that changed. |pressed| is true if buttons entered pressed
// state.
- virtual void OnPointerButton(base::TimeDelta time_stamp,
+ virtual void OnPointerButton(base::TimeTicks time_stamp,
int changed_button_flags,
bool pressed) = 0;
// Called when pointer is scrolling. |offset| contains the direction and
// distance of the change. |discrete| is true if the scrolling is caused
// by a discrete device such as a scroll wheel.
- virtual void OnPointerScroll(base::TimeDelta time_stamp,
+ virtual void OnPointerScroll(base::TimeTicks time_stamp,
const gfx::Vector2dF& offset,
bool discrete) = 0;
// Called when a current kinetic scroll should be canceled.
- virtual void OnPointerScrollCancel(base::TimeDelta time_stamp) = 0;
+ virtual void OnPointerScrollCancel(base::TimeTicks time_stamp) = 0;
// Called when pointer scroll has stopped and a fling is happening (e.g.
// lifting the fingers from the touchpad after scrolling quickly)
- virtual void OnPointerScrollStop(base::TimeDelta time_stamp) = 0;
+ virtual void OnPointerScrollStop(base::TimeTicks time_stamp) = 0;
// Called after all pointer information of this frame has been set and the
// client should evaluate the updated state. No events are being sent before