[webkit-reviews] review granted: [Bug 214245] Resolve race between IOHIDManager and GameController framework : [Attachment 404298] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 14 21:59:09 PDT 2020


Tim Horton <thorton at apple.com> has granted Brady Eidson <beidson at apple.com>'s
request for review:
Bug 214245: Resolve race between IOHIDManager and GameController framework
https://bugs.webkit.org/show_bug.cgi?id=214245

Attachment 404298: Patch

https://bugs.webkit.org/attachment.cgi?id=404298&action=review




--- Comment #5 from Tim Horton <thorton at apple.com> ---
Comment on attachment 404298
  --> https://bugs.webkit.org/attachment.cgi?id=404298
Patch

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

> Source/WebCore/ChangeLog:16
> +	   GameControler.framework uses IOHIDServices.

Controller

> Source/WebCore/ChangeLog:42
> +	   In my testing, when the service publishes after the devices, it's
always wihin 50ms, so the 1s
> +	   delay seems sufficient.

Slightly frightening. Do you understand the source of the delay? (if it's, say,
fetching something from disk, it might be much longer on some hardware).

> Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.h:59
> +	   Yes,
> +	   No

Someone debugging later might get quite sad about the order of these values
(say, if they cast to bool in logging). Maybe swap them?

> Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.mm:191
> +    Yes,
> +    No,
> +    Maybe,

You've done it again

> Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.mm:268
> +    [matchingAttributes addObject:@{(id)CFSTR(kIOHIDDeviceUsagePageKey) :
@(kHIDPage_GenericDesktop), (id)CFSTR(kIOHIDDeviceUsageKey) :
@(kHIDUsage_GD_GamePad)}];
> +    [matchingAttributes addObject:@{(id)CFSTR(kIOHIDDeviceUsagePageKey) :
@(kHIDPage_GenericDesktop), (id)CFSTR(kIOHIDDeviceUsageKey) :
@(kHIDUsage_GD_Joystick)}];

Why are you making CFStrings? Seems like NSString is fine, due to toll-free
bridging, no? (and then you can just @() like you do for the
what-I-assume-are-NSNumbers)

> Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.mm:270
> +    IOHIDEventSystemClientSetMatchingMultiple(m_eventSystemClient.get(),
(__bridge CFArrayRef)(matchingAttributes));

Weird extra parens around matchingAttributes

> Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.mm:275
> +	   HIDGamepadProvider::singleton().newGamePadServicePublished();

The leading "new" is triggering my "new or create" instinct. Maybe
didPublishNewGamePadService? Or, since we aren't the ones publishing, some
other verb?


More information about the webkit-reviews mailing list