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

Issue 306363002: Gamepad: honor page visibility (Closed)

Created:
6 years, 6 months ago by kbalazs
Modified:
6 years, 6 months ago
Reviewers:
scottmg, bajones, eseidel
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Gamepad: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+260 lines, -20 lines) Patch
A LayoutTests/gamepad/multiple-event-listeners.html View 1 chunk +27 lines, -0 lines 0 comments Download
A LayoutTests/gamepad/multiple-event-listeners-expected.txt View 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/gamepad/page-visibility.html View 1 chunk +99 lines, -0 lines 0 comments Download
A LayoutTests/gamepad/page-visibility-detach-while-dispatching.html View 1 1 chunk +27 lines, -0 lines 0 comments Download
A + LayoutTests/gamepad/page-visibility-detach-while-dispatching-expected.txt View 1 0 chunks +-1 lines, --1 lines 0 comments Download
A LayoutTests/gamepad/page-visibility-expected.txt View 1 chunk +18 lines, -0 lines 0 comments Download
M Source/core/frame/DeviceSensorEventController.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M Source/core/frame/DeviceSensorEventController.cpp View 1 chunk +2 lines, -5 lines 0 comments Download
M Source/modules/gamepad/NavigatorGamepad.h View 1 2 chunks +7 lines, -0 lines 0 comments Download
M Source/modules/gamepad/NavigatorGamepad.cpp View 1 2 7 chunks +68 lines, -13 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
kbalazs
6 years, 6 months ago (2014-06-02 17:52:55 UTC) #1
kbalazs
On 2014/06/02 17:52:55, kbalazs wrote: <off> I hate that rietveld truncates my description </off>
6 years, 6 months ago (2014-06-02 17:57:29 UTC) #2
bajones
On 2014/06/02 17:57:29, kbalazs wrote: > On 2014/06/02 17:52:55, kbalazs wrote: > > <off> > ...
6 years, 6 months ago (2014-06-02 18:52:25 UTC) #3
kbalazs
On 2014/06/02 18:52:25, bajones wrote: > On 2014/06/02 17:57:29, kbalazs wrote: > > On 2014/06/02 ...
6 years, 6 months ago (2014-06-02 20:48:54 UTC) #4
kbalazs
On 2014/06/02 20:48:54, kbalazs wrote: > On 2014/06/02 18:52:25, bajones wrote: > > On 2014/06/02 ...
6 years, 6 months ago (2014-06-04 20:39:03 UTC) #5
kbalazs
This is now ready together with https://codereview.chromium.org/304403002/ (which is needed for the tests).
6 years, 6 months ago (2014-06-05 22:46:48 UTC) #6
kbalazs
On 2014/06/05 22:46:48, kbalazs wrote: > This is now ready together with https://codereview.chromium.org/304403002/ > (which ...
6 years, 6 months ago (2014-06-12 23:59:22 UTC) #7
kbalazs
6 years, 6 months ago (2014-06-16 22:57:25 UTC) #8
On 2014/06/12 23:59:22, kbalazs wrote:
> On 2014/06/05 22:46:48, kbalazs wrote:
> > This is now ready together with https://codereview.chromium.org/304403002/
> > (which is needed for the tests).
> 
> This is no outdated and will need to be rebased on top of
> https://codereview.chromium.org/336693004/ (assuming it will land in some
form).

Let's close this, rework will come in other cl.

Powered by Google App Engine
This is Rietveld 408576698