Bug 134375 - The user pressing a button on a gamepad should cause gamepads to become visible to all NavigatorGamepads
Summary: The user pressing a button on a gamepad should cause gamepads to become visib...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords:
Depends on:
Blocks: 134076
  Show dependency treegraph
 
Reported: 2014-06-26 18:30 PDT by Brady Eidson
Modified: 2022-03-01 02:53 PST (History)
1 user (show)

See Also:


Attachments
Patch v1 (7.95 KB, patch)
2014-06-26 23:01 PDT, Brady Eidson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
http://trac.webkit.org/changeset/170553