Closed Bug 1358064 Opened 8 years ago Closed 8 years ago

Refactor fire event functions in GamepadManager

Categories

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

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: daoshengmu, Assigned: cleu)

References

Details

Attachments

(1 file, 1 obsolete file)

I notice there are some duplicate code when asking global window fire events and set attributes to the gamepads. We should do some refactor at NewButtonEvent/NewAxisMoveEvent/NewPoseEvent/NewHandChangeEvent.
Assignee: nobody → cleu
Depends on: 1356452
Comment on attachment 8860285 [details] Bug 1358064 - Simplify Gamepad Event processing; https://reviewboard.mozilla.org/r/132308/#review135218 r=me, after fixing some nits. ::: dom/gamepad/GamepadManager.cpp:529 (Diff revision 2) > - NewAxisMoveEvent(a.index(), a.service_type(), a.axis(), a.value()); > + // can mutate the mListeners array. > + nsTArray<RefPtr<nsGlobalWindow>> listeners(mListeners); > + MOZ_ASSERT(!listeners.IsEmpty()); > + > + for (uint32_t i = 0; i < listeners.Length(); i++) { > + please remove this new line ::: dom/gamepad/GamepadManager.cpp:557 (Diff revision 2) > - if (aEvent.type() == GamepadChangeEvent::TGamepadPoseInformation) { > + > + RefPtr<Gamepad> gamepad; > + > + switch (aEvent.type()) { > + case GamepadChangeEvent::TGamepadButtonInformation: > + { You can choose to remove {} scope or let {} align the letter 'c' of case. ::: dom/gamepad/GamepadManager.cpp:588 (Diff revision 2) > + RefPtr<Gamepad> gamepad; > + bool ret = false; > + > + switch (aEvent.type()) { > + case GamepadChangeEvent::TGamepadButtonInformation: > + { Same as {} align issue
Attachment #8860285 - Flags: review?(dmu) → review+
Comment on attachment 8859949 [details] Bug 1358064 - Part1: Combine MaybeWindowHasSeenGamepad and FireConnectionEvent; .mielczarek https://reviewboard.mozilla.org/r/131998/#review135226 LGTM
Attachment #8859949 - Flags: review?(dmu) → review+
The scopes in the switch-case code is need because each case has its own variation of GamepadChangeEvent, without them will result in a redefinition variable compile error.
Attachment #8859949 - Attachment is obsolete: true
Attachment #8859949 - Flags: review?(ted)
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/autoland/rev/2981a5649a3a Simplify Gamepad Event processing; r=daoshengmu
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
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: