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

Unified Diff: components/exo/wayland/server.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge master Created 4 years, 7 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 | « components/exo/touch_unittest.cc ('k') | components/mus/common/event_param_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/wayland/server.cc
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc
index cd59bdba0f2c4a357bd576b818fd4655e1b226d0..6f23e1c86e7a25159d21c8a007833182b944cf37 100644
--- a/components/exo/wayland/server.cc
+++ b/components/exo/wayland/server.cc
@@ -109,6 +109,10 @@ void SetImplementation(wl_resource* resource,
DestroyUserData<T>);
}
+int64_t InMilliseconds(base::TimeTicks ticks) {
reveman 2016/06/03 13:06:00 Can you make this "uint32_t EventTimeStampToMillis
majidvp 2016/06/03 19:14:21 Done. I used TimeTicksToMilleseconds because it wa
+ return (ticks - base::TimeTicks()).InMilliseconds();
+}
+
// A property key containing the surface resource that is associated with
// window. If unset, no surface resource is associated with window.
DEFINE_WINDOW_PROPERTY_KEY(wl_resource*, kSurfaceResourceKey, nullptr);
@@ -1660,13 +1664,13 @@ class WaylandPointerDelegate : public PointerDelegate {
DCHECK(surface_resource);
wl_pointer_send_leave(pointer_resource_, next_serial(), surface_resource);
}
- void OnPointerMotion(base::TimeDelta time_stamp,
+ void OnPointerMotion(base::TimeTicks time_stamp,
const gfx::PointF& location) override {
- wl_pointer_send_motion(pointer_resource_, time_stamp.InMilliseconds(),
+ wl_pointer_send_motion(pointer_resource_, InMilliseconds(time_stamp),
wl_fixed_from_double(location.x()),
wl_fixed_from_double(location.y()));
}
- void OnPointerButton(base::TimeDelta time_stamp,
+ void OnPointerButton(base::TimeTicks time_stamp,
int button_flags,
bool pressed) override {
struct {
@@ -1683,14 +1687,14 @@ class WaylandPointerDelegate : public PointerDelegate {
for (auto button : buttons) {
if (button_flags & button.flag) {
wl_pointer_send_button(pointer_resource_, serial,
- time_stamp.InMilliseconds(), button.value,
+ InMilliseconds(time_stamp), button.value,
pressed ? WL_POINTER_BUTTON_STATE_PRESSED
: WL_POINTER_BUTTON_STATE_RELEASED);
}
}
}
- void OnPointerScroll(base::TimeDelta time_stamp,
+ void OnPointerScroll(base::TimeTicks time_stamp,
const gfx::Vector2dF& offset,
bool discrete) override {
// Same as Weston, the reference compositor.
@@ -1704,29 +1708,29 @@ class WaylandPointerDelegate : public PointerDelegate {
}
double x_value = offset.x() * kAxisStepDistance;
- wl_pointer_send_axis(pointer_resource_, time_stamp.InMilliseconds(),
+ wl_pointer_send_axis(pointer_resource_, InMilliseconds(time_stamp),
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
wl_fixed_from_double(-x_value));
double y_value = offset.y() * kAxisStepDistance;
- wl_pointer_send_axis(pointer_resource_, time_stamp.InMilliseconds(),
+ wl_pointer_send_axis(pointer_resource_, InMilliseconds(time_stamp),
WL_POINTER_AXIS_VERTICAL_SCROLL,
wl_fixed_from_double(-y_value));
}
- void OnPointerScrollCancel(base::TimeDelta time_stamp) override {
+ void OnPointerScrollCancel(base::TimeTicks time_stamp) override {
// Wayland doesn't know the concept of a canceling kinetic scrolling.
// But we can send a 0 distance scroll to emulate this behavior.
OnPointerScroll(time_stamp, gfx::Vector2dF(0, 0), false);
OnPointerScrollStop(time_stamp);
}
- void OnPointerScrollStop(base::TimeDelta time_stamp) override {
+ void OnPointerScrollStop(base::TimeTicks time_stamp) override {
if (wl_resource_get_version(pointer_resource_) >=
WL_POINTER_AXIS_STOP_SINCE_VERSION) {
- wl_pointer_send_axis_stop(pointer_resource_, time_stamp.InMilliseconds(),
+ wl_pointer_send_axis_stop(pointer_resource_, InMilliseconds(time_stamp),
WL_POINTER_AXIS_HORIZONTAL_SCROLL);
- wl_pointer_send_axis_stop(pointer_resource_, time_stamp.InMilliseconds(),
+ wl_pointer_send_axis_stop(pointer_resource_, InMilliseconds(time_stamp),
WL_POINTER_AXIS_VERTICAL_SCROLL);
}
}
@@ -1837,11 +1841,11 @@ class WaylandKeyboardDelegate : public KeyboardDelegate {
wl_keyboard_send_leave(keyboard_resource_, next_serial(), surface_resource);
wl_client_flush(client());
}
- void OnKeyboardKey(base::TimeDelta time_stamp,
+ void OnKeyboardKey(base::TimeTicks time_stamp,
ui::DomCode key,
bool pressed) override {
wl_keyboard_send_key(keyboard_resource_, next_serial(),
- time_stamp.InMilliseconds(), DomCodeToKey(key),
+ InMilliseconds(time_stamp), DomCodeToKey(key),
pressed ? WL_KEYBOARD_KEY_STATE_PRESSED
: WL_KEYBOARD_KEY_STATE_RELEASED);
wl_client_flush(client());
@@ -1946,26 +1950,26 @@ class WaylandTouchDelegate : public TouchDelegate {
wl_resource_get_client(surface_resource) == client();
}
void OnTouchDown(Surface* surface,
- base::TimeDelta time_stamp,
+ base::TimeTicks time_stamp,
int id,
const gfx::Point& location) override {
wl_resource* surface_resource = surface->GetProperty(kSurfaceResourceKey);
DCHECK(surface_resource);
wl_touch_send_down(touch_resource_, next_serial(),
- time_stamp.InMilliseconds(), surface_resource, id,
+ InMilliseconds(time_stamp), surface_resource, id,
wl_fixed_from_int(location.x()),
wl_fixed_from_int(location.y()));
wl_client_flush(client());
}
- void OnTouchUp(base::TimeDelta time_stamp, int id) override {
- wl_touch_send_up(touch_resource_, next_serial(),
- time_stamp.InMilliseconds(), id);
+ void OnTouchUp(base::TimeTicks time_stamp, int id) override {
+ wl_touch_send_up(touch_resource_, next_serial(), InMilliseconds(time_stamp),
+ id);
wl_client_flush(client());
}
- void OnTouchMotion(base::TimeDelta time_stamp,
+ void OnTouchMotion(base::TimeTicks time_stamp,
int id,
const gfx::Point& location) override {
- wl_touch_send_motion(touch_resource_, time_stamp.InMilliseconds(), id,
+ wl_touch_send_motion(touch_resource_, InMilliseconds(time_stamp), id,
wl_fixed_from_int(location.x()),
wl_fixed_from_int(location.y()));
wl_client_flush(client());
« no previous file with comments | « components/exo/touch_unittest.cc ('k') | components/mus/common/event_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698