[webkit-reviews] review granted: [Bug 134375] The user pressing a button on a gamepad should cause gamepads to become visible to all NavigatorGamepads : [Attachment 233967] Patch v1

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 27 09:58:49 PDT 2014


Darin Adler <darin at apple.com> has granted Brady Eidson <beidson at apple.com>'s
request for review:
Bug 134375: The user pressing a button on a gamepad should cause gamepads to
become visible to all NavigatorGamepads
https://bugs.webkit.org/show_bug.cgi?id=134375

Attachment 233967: Patch v1
https://bugs.webkit.org/attachment.cgi?id=233967&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
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.


More information about the webkit-reviews mailing list