New issue
Advanced search Search tips

Issue 773803 link

Starred by 4 users

Issue metadata

Status: WontFix
Owner:
Closed: Nov 2017
Components:
EstimatedDays: ----
NextAction: 2017-11-26
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

GamepadEvent.timeStamp should use the OS provided timestamp

Project Member Reported by majidvp@chromium.org, Oct 11 2017

Issue description

Instead of using TimeTicks::Now() we should initialized the
Gamepad Events with the OS provided timestamp [1].

This is just basically a matter of converting the timestamp to TimeTicks
and using an alternative Event ctor here [2].

[1]https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/modules/gamepad/Gamepad.h?type=cs&l=89
[2] https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/modules/gamepad/GamepadEvent.cpp?type=cs&l=9


 
Hello!

I would like to fix this issue :)
Owner: majidvp@chromium.org
Status: Assigned (was: Available)
Great!  I hope the info in comment #1 is enough to get you started. Otherwise feel free to ask any questions you may have and I will try to help find you the right answers. 

Also I will be happy to be your first reviewer once you have a patch up for review.

Great!  I hope the info in comment #1 is enough to get you started. Otherwise feel free to ask any questions you may have and I will try to help find you the right answers. 

Also I will be happy to be your first reviewer once you have a patch up for review.

BTW, I mark the bug "assigned" but I cannot seem to be able to assign it to you given that you are not a project member yet. So I put myself as the "owner" but it is yours.

NextAction: 2017-11-26
Thanks, currently working on it, I will send you a patch ASAP
Ok, correct me if I am wrong:

The only thing that I have to do is to get the OS timestamp, convert it to TimeTicks and then change the timestamp value of the gamepad that is being passed on this line of the constructor?

https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/modules/gamepad/GamepadEvent.cpp?type=cs&l=13




That is correct. If you pass in a valid TimeTicks to blink::Event constructor (i.e., as the platform_time_stamp) 
then that timestamp will be the one exposed to Javascript.


Note that blink::Event constructor expects to received a base::TimeTicks that comes from the same
clock as base::TimeTicks::Now() [1]. So you need to make sure that invariant is true when
converting the OS provided timestamp to base::TimeTicks.


I am not familiar with gamepad APIs so I am not sure what clock their
timestamp uses (This may actually be platform specific). But for examples 
on Linux for Xinput events we had to have special logic to ensure the X11 
timestamps for input events are properly converted to base::TimeTicks. [2]


[1] https://codesearch.chromium.org/chromium/src/base/time/time.h?type=cs&sq=package:chromium&l=765
[2] https://codesearch.chromium.org/chromium/src/ui/events/x/events_x.cc?type=cs&l=87
Status: WontFix (was: Assigned)
We have decided to no do anything here. So closing as WONTFIX. 

Details of discussion are in [1] but ere is a summary:


First, there is a difference between Gamepad.timestamp and GamepadEvent.timestamp.

Second,  getting an "OS timestamp" that can be converted to time tick
is going to be a lot of work. And even then, these timestamps may not really be that
relevant to the connect/disconnect events but rather the last data poll.

Third, GamepageEvents are only dispatched for connect/disconnect so they are not
high-frequency unlike Gamepad button changes that are polled at a hi-freq.


Given these, for GamepadEvent (e.g., connect/disconnect), we think it is good enough
to use the moment of creation of the event as the event timestamp. This is what 
we do for many other event types and it was already the case. So no change is needed.

There is already a bug for tracking any changes needed for Gamepad.timestamp. Issue 398642


[1] https://chromium-review.googlesource.com/c/chromium/src/+/757832

The NextAction date has arrived: 2017-11-26

Sign in to add a comment