Bug 134375

Summary: The user pressing a button on a gamepad should cause gamepads to become visible to all NavigatorGamepads
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebCore Misc.Assignee: Brady Eidson <beidson>
Severity: Normal CC: dino
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 134076    
Description Flags
Patch v1 darin: review+

Description Brady Eidson 2014-06-26 18:30:27 PDT
The user pressing a button on a gamepad should cause gamepads to become visible to all NavigatorGamepads
Comment 1 Brady Eidson 2014-06-26 23:01:22 PDT
Created attachment 233967 [details]
Patch v1
Comment 2 Brady Eidson 2014-06-26 23:02:39 PDT
Ignore the can't-buildness that EWS sees - In my tree this patch is built on previous patches.  I will pass it through EWS before landing.
Comment 3 Darin Adler 2014-06-27 09:59:09 PDT
Comment on attachment 233967 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=233967&action=review

> Source/WebCore/Modules/gamepad/GamepadManager.cpp:81
> +        const Vector<PlatformGamepad*>& platformGamepads = GamepadProvider::shared().platformGamepads();

Seems like a good place to use auto, although maybe Alexey wouldn’t agree.

> Source/WebCore/Modules/gamepad/GamepadManager.cpp:82
> +        for (unsigned i = 0; i < platformGamepads.size(); ++i) {

Normally it’s an anti-pattern to actually call size each time through. My own preference is to put it into a local variable named size, either inside the for or just before it:

    for (unsigned i = 0, size = platformGamepads.size(); i < size; ++i)

> Source/WebCore/platform/mac/HIDGamepadProvider.cpp:85
> +    , m_inputNotificationTimer(this, &HIDGamepadProvider::inputNotificationTimerFired)

Consider the new style Timer that uses a function/lambda instead of a pointer to member function.

> Source/WebCore/platform/mac/HIDGamepadProvider.cpp:215
> +    if (!m_inputNotificationTimer.isActive())
> +        m_inputNotificationTimer.startOneShot(InputNotificationDelay);

A why comment would be good here to explain why the isActive check. We want to delay from the time of the first input, not postpone when we get additional input, I assume.
Comment 4 Brady Eidson 2014-06-27 14:12:02 PDT