DescriptionGamepad: honor page visibility
This CL attempts to make gamepad events work perfectly in relation to page
visibility state in all cases.
Now we stop listening on gamepad events when page is hidden. It did not work
because DeviceSensorEventController did not tell NavigatorGamepad to
unregister if there were no gamepad event listeners. But since gamepad data can
be polled without a listener this was wrong. When we become visible again we
tell the page about all changes. Note that handling all this at the browser side
would be impractical because it would need to track which changes were observed
by which renderer (think about multiple tabs listening and the user switches
between them).
NavigatorGamepad::didRemoveEventListener now considers that there might be
multiple listeners.
Finally as a refactor now we use DeviceSensorEventController::dispatchDeviceEvent
in NavigatorGamepad instead of duplicating some of it's logic.
BUG=344556
Patch Set 1 #Patch Set 2 : handle more in Blink for perfection #Patch Set 3 : just a comment that it will be better with Oilpan #Messages
Total messages: 8 (0 generated)
|