RESOLVED FIXED 214094
Aggressively prime GameController.framework gamepad provider
https://bugs.webkit.org/show_bug.cgi?id=214094
Summary Aggressively prime GameController.framework gamepad provider
Brady Eidson
Reported 2020-07-08 12:52:58 PDT
Aggressively prime GameController.framework gamepad provider GC.framework does some work on app activation assuming it was hard linked. Since we soft link it, it doesn't quite work right. So let's give it a kickstart.
Attachments
Patch (8.26 KB, patch)
2020-07-08 16:05 PDT, Brady Eidson
darin: review+
PFL (8.25 KB, patch)
2020-07-08 17:52 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2020-07-08 16:05:14 PDT
Darin Adler
Comment 2 2020-07-08 16:30:44 PDT
Comment on attachment 403815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=403815&action=review > Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm:107 > + static dispatch_once_t onceToken; > + dispatch_once(&onceToken, ^{ > + LOG(Gamepad, "GameControllerGamepadProvider explicitly starting GameController framework monitoring"); > + [getGCControllerClass() __openXPC_and_CBApplicationDidBecomeActive__]; > + }); Is thread safety an issue here? Otherwise, we would probably just want to use a boolean, not a dispatch_once_t. > Source/WebKit/WebProcess/Gamepad/WebGamepadProvider.cpp:72 > + LOG(Gamepad, "WebGamepadProvider::gamepadConnected - Gamepad index %i attached (visibility: %i)\n", gamepadData.index(), (int)eventVisibility); Since gamepadData.index() is an unsigned, this should be %u, not %i. > Source/WebKit/WebProcess/Gamepad/WebGamepadProvider.cpp:95 > + LOG(Gamepad, "WebGamepadProvider::gamepadDisconnected - Gamepad index %i detached (m_gamepads size %lu, m_rawGamepads size %lu\n", index, m_gamepads.size(), m_rawGamepads.size()); Since index is an unsigned, this should be %u, not %i. Since a Vector size is a size_t, the others should be %zu, not %lu. > Source/WebKit/WebProcess/Gamepad/WebGamepadProvider.cpp:103 > + LOG(Gamepad, "WebGamepadProvider::gamepadActivity - %lu gamepad datas with %lu local web gamepads\n", gamepadDatas.size(), m_gamepads.size()); Since a Vector size is a size_t, these should be %zu, not %lu.
Brady Eidson
Comment 3 2020-07-08 17:52:41 PDT
Tim Horton
Comment 4 2020-07-08 17:55:35 PDT
Comment on attachment 403815 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=403815&action=review >> Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm:107 >> + }); > > Is thread safety an issue here? Otherwise, we would probably just want to use a boolean, not a dispatch_once_t. That is a super-internal-looking method. What is the actual way that this works normally? Just linking the framework probably isn't it; is it +initialize on some class or something?
Brady Eidson
Comment 5 2020-07-08 17:56:45 PDT
(In reply to Tim Horton from comment #4) > Comment on attachment 403815 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=403815&action=review > > >> Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm:107 > >> + }); > > > > Is thread safety an issue here? Otherwise, we would probably just want to use a boolean, not a dispatch_once_t. > > That is a super-internal-looking method. What is the actual way that this > works normally? Just linking the framework probably isn't it; is it > +initialize on some class or something? No, it's just linking the framework. (Will ping you on slack)
EWS
Comment 6 2020-07-08 18:20:22 PDT
Committed r264143: <https://trac.webkit.org/changeset/264143> All reviewed patches have been landed. Closing bug and clearing flags on attachment 403829 [details].
Radar WebKit Bug Importer
Comment 7 2020-07-08 18:21:16 PDT
Note You need to log in before you can comment on or make changes to this bug.