Bug 160871 - Cleanup WK2 platform gamepad handling
Summary: Cleanup WK2 platform gamepad handling
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords:
Depends on:
Blocks: 134076
  Show dependency treegraph
 
Reported: 2016-08-15 15:39 PDT by Brady Eidson
Modified: 2016-08-16 14:46 PDT (History)
3 users (show)

See Also:


Attachments
Patch (18.81 KB, patch)
2016-08-15 15:45 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (18.90 KB, patch)
2016-08-16 14:15 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2016-08-15 15:39:10 PDT
Cleanup WK2 platform gamepad handling
Comment 1 Brady Eidson 2016-08-15 15:45:52 PDT
Created attachment 286103 [details]
Patch
Comment 2 Alex Christensen 2016-08-15 21:01:24 PDT
Comment on attachment 286103 [details]
Patch

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

> Source/WebCore/platform/gamepad/GamepadProviderClient.h:40
> +    virtual void setInitialConnectedGamepads(const Vector<PlatformGamepad*>&) { }

I don't understand the lifetime of these PlatformGamepads.  Where do they come from?  How do we know they will still be alive as long as we have pointers to them?

> Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h:87
> +    bool m_hasInitialGamepads { false };

This is only used in an assertion.  Could be compiled out.  Probably nbd

> Source/WebKit2/WebProcess/WebProcess.cpp:1036
> +void WebProcess::setInitialGamepads(const Vector<WebKit::GamepadData>& gamepadDatas)

data is already plural
Comment 3 Alex Christensen 2016-08-15 21:01:40 PDT
Comment on attachment 286103 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        No new tests (No currently testable change in behavior).

:(
Comment 4 Brady Eidson 2016-08-16 08:30:25 PDT
(In reply to comment #2)
> Comment on attachment 286103 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=286103&action=review
> 
> > Source/WebCore/platform/gamepad/GamepadProviderClient.h:40
> > +    virtual void setInitialConnectedGamepads(const Vector<PlatformGamepad*>&) { }
> 
> I don't understand the lifetime of these PlatformGamepads.  Where do they
> come from?  How do we know they will still be alive as long as we have
> pointers to them?

The platform GamepadProvider owns them. They are valid until you get a "platformGamepadDisconnected" message.

> 
> > Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h:87
> > +    bool m_hasInitialGamepads { false };
> 
> This is only used in an assertion.  Could be compiled out.  Probably nbd

I'd like to leave it for now, as there are grander plans for it going forward - Though I will remain cognizant of whether or not it is assertion-only.

> 
> > Source/WebKit2/WebProcess/WebProcess.cpp:1036
> > +void WebProcess::setInitialGamepads(const Vector<WebKit::GamepadData>& gamepadDatas)
> 
> data is already plural

Do you have a naming suggestion for a "vector of GamepadData" that is not "gamepadDatas" but also not "gamepadDataVector"? :)
Comment 5 Brady Eidson 2016-08-16 08:30:49 PDT
(In reply to comment #3)
> Comment on attachment 286103 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=286103&action=review
> 
> > Source/WebCore/ChangeLog:8
> > +        No new tests (No currently testable change in behavior).
> 
> :(

As you know, I have grand plans for next week.
Comment 6 WebKit Commit Bot 2016-08-16 09:29:24 PDT
Comment on attachment 286103 [details]
Patch

Clearing flags on attachment: 286103

Committed r204506: <http://trac.webkit.org/changeset/204506>
Comment 7 WebKit Commit Bot 2016-08-16 09:29:27 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Chris Dumez 2016-08-16 09:53:25 PDT
/Volumes/Data/cdumez/WebKit/OpenSource/Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp:105:77: error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
Comment 9 Chris Dumez 2016-08-16 09:58:54 PDT
Reverted r204506 for reason:

Broke the build

Committed r204509: <http://trac.webkit.org/changeset/204509>
Comment 10 Alex Christensen 2016-08-16 10:20:46 PDT
Comment on attachment 286103 [details]
Patch

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

> Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp:105
> +    IOHIDManagerRegisterInputValueCallback(m_manager.get(), nullptr, nullptr);

It looks like the second parameter of this cannot be null :(
Comment 11 Brady Eidson 2016-08-16 11:58:59 PDT
(In reply to comment #10)
> Comment on attachment 286103 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=286103&action=review
> 
> > Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp:105
> > +    IOHIDManagerRegisterInputValueCallback(m_manager.get(), nullptr, nullptr);
> 
> It looks like the second parameter of this cannot be null :(

This is absolutely 100% incorrect.

From https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html

"Note: To unregister pass NULL for the callback."
Comment 12 Brady Eidson 2016-08-16 11:59:10 PDT
(In reply to comment #8)
> /Volumes/Data/cdumez/WebKit/OpenSource/Source/WebCore/platform/gamepad/mac/
> HIDGamepadProvider.cpp:105:77: error: null passed to a callee that requires
> a non-null argument [-Werror,-Wnonnull]

Where did you see this?
Comment 13 Chris Dumez 2016-08-16 12:02:05 PDT
(In reply to comment #12)
> (In reply to comment #8)
> > /Volumes/Data/cdumez/WebKit/OpenSource/Source/WebCore/platform/gamepad/mac/
> > HIDGamepadProvider.cpp:105:77: error: null passed to a callee that requires
> > a non-null argument [-Werror,-Wnonnull]
> 
> Where did you see this?

Locally but it also showed on internal bots and I provided a link on IRC
Comment 14 Brady Eidson 2016-08-16 12:08:06 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #8)
> > > /Volumes/Data/cdumez/WebKit/OpenSource/Source/WebCore/platform/gamepad/mac/
> > > HIDGamepadProvider.cpp:105:77: error: null passed to a callee that requires
> > > a non-null argument [-Werror,-Wnonnull]
> > 
> > Where did you see this?
> 
> Locally but it also showed on internal bots and I provided a link on IRC

I was not on IRC at the time, and internal bot links are currently broken. Yay!

Anyways, a macOS regression in this API.

Working around and filing a bug on the relevant team.
Comment 15 Brady Eidson 2016-08-16 12:08:17 PDT
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #12)
> > > (In reply to comment #8)
> > > > /Volumes/Data/cdumez/WebKit/OpenSource/Source/WebCore/platform/gamepad/mac/
> > > > HIDGamepadProvider.cpp:105:77: error: null passed to a callee that requires
> > > > a non-null argument [-Werror,-Wnonnull]
> > > 
> > > Where did you see this?
> > 
> > Locally but it also showed on internal bots and I provided a link on IRC
> 
> I was not on IRC at the time, and internal bot links are currently broken.
> Yay!
> 
> Anyways, a macOS regression in this API.

macOS Sierra*
Comment 16 Brady Eidson 2016-08-16 14:15:54 PDT
Created attachment 286202 [details]
Patch
Comment 17 WebKit Commit Bot 2016-08-16 14:46:00 PDT
Comment on attachment 286202 [details]
Patch

Clearing flags on attachment: 286202

Committed r204524: <http://trac.webkit.org/changeset/204524>
Comment 18 WebKit Commit Bot 2016-08-16 14:46:06 PDT
All reviewed patches have been landed.  Closing bug.