Closed Bug 1397194 Opened 8 years ago Closed 7 years ago

Follow up Bug 1347519, polling manually in macOS gamepad API backend

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

x86_64
macOS
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: cleu, Assigned: cleu)

References

Details

Attachments

(1 file)

In current design, we use CFRunLoopRun as a blocking eventloop for receiving gamepad events and call CFRunLoopStop in a different thread to shut it down. Although Apple's dev docs claim that it's "generally" thread-safe, it leads to number of crashes in libsystem_pthread which is reported in Bug 1347519. To avoid this, we should manage eventloops ourselves.
Assignee: nobody → cleu
Blocks: 1347519
Priority: -- → P2
Attachment #8904936 - Flags: review?(kyle)
Hi Kyle, I once wanted to mitigate the crash inside pthread by using macos' native callback functions in bug 1347519, but it does not work properly, so I tried to rewrite the eventloop by gecko's nsITimer just like our Windows XInput backend. Actually this patch is finished months ago, but I had concern landing it that time because this change is hard to test by mochitest and the crash rate is low, however, I encounter a 100% crash case in bug 1422560, I think it's time to give up using macos' native event loop. BTW, I remembered that you were developing WebMIDI backend in mac and encounter issue about the blocking CFRunLoop for USB device detecting, I think maybe this solution apply to your situation as well.
Wow, thanks! The timing on this is great too, as I'm now reworking the patches for WebMIDI and was going to be hopefully shipping with a macOS implementation. :D
Comment on attachment 8904936 [details] Bug 1397194 - Polling manually in macOS gamepad API backend https://reviewboard.mozilla.org/r/176748/#review211544 ::: dom/gamepad/cocoa/CocoaGamepad.cpp:515 (Diff revision 3) > > return dict; > } > > -DarwinGamepadService::DarwinGamepadService() : mManager(nullptr) {} > +DarwinGamepadService::DarwinGamepadService() > + : mManager(nullptr), mIsRunning(false) {} Nit: {} on separate line.
Attachment #8904936 - Flags: review?(kyle) → review+
Blocks: 1422560
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/43f6a70b2f39 Polling manually in macOS gamepad API backend r=qdot
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: