Closed
Bug 926091
Opened 11 years ago
Closed 11 years ago
Make Gamepad.buttons into an array of GamepadButton objects
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: ted, Assigned: ted)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 4 obsolete files)
13.57 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
I made a spec change to change Gamepad.buttons into an array of GamepadButton objects instead of just doubles: https://dvcs.w3.org/hg/gamepad/rev/a37c10a031b4 https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#widl-Gamepad-buttons I wanted to do this now before we ship anything because it's a breaking change. This patch implements the new spec behavior. Unfortunately it's not perfect, it's still failing one Mochitest, and also leaking during Mochitests.
Assignee | ||
Comment 1•11 years ago
|
||
Comment 2•11 years ago
|
||
Is this what NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY is for?
Assignee | ||
Comment 3•11 years ago
|
||
Ok, I fixed the leak and the test failure. The leak was due to me unnecessarily AddRef'ing the nsISupports* I was passing to the variant. The test failure was because Gamepad::SyncState was no longer doing the right thing now that mButtons was an array of objects and not just doubles. I fixed both of those.
Attachment #817922 -
Flags: review?(bugs)
Assignee | ||
Updated•11 years ago
|
Attachment #816254 -
Attachment is obsolete: true
Comment 4•11 years ago
|
||
Comment on attachment 817922 [details] [diff] [review] Make Gamepad.buttons into an array of GamepadButton objects I think we should actually cache the variant for buttons. (and cycle collect it then) Also, GamepadButton really should have some sane parent, the same what Gamepad has. That way if chrome/addon touches GamepadButton first, content can still touch the button without getting some security exception.
Attachment #817922 -
Flags: review?(bugs) → review-
Updated•11 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 5•11 years ago
|
||
I added caching of both variants on Gamepad. I also made GamepadButton use the parent of the Gamepad that creates it.
Attachment #818019 -
Flags: review?(bugs)
Assignee | ||
Updated•11 years ago
|
Attachment #817922 -
Attachment is obsolete: true
Comment 6•11 years ago
|
||
Comment on attachment 818019 [details] [diff] [review] Make Gamepad.buttons into an array of GamepadButton objects > Gamepad::GetButtons(nsIVariant** aButtons) > { >+ if (mButtonsVariant) { >+ nsCOMPtr<nsIVariant> buttons = mButtonsVariant; >+ *aButtons = buttons.forget().get(); I'd write this NS_ADDREF(*aButtons = mButtonsVariant); > Gamepad::GetAxes(nsIVariant** aAxes) > { >+ if (mAxesVariant) { >+ nsCOMPtr<nsIVariant> axes = mAxesVariant; >+ *aAxes = axes.forget().get(); >+ return NS_OK; >+ } Unfortunately we can't quite do this. the values of axes may change, unlike buttons in the current impl
Attachment #818019 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 7•11 years ago
|
||
Thanks. I don't know why I didn't realize that.
Attachment #818413 -
Flags: review?(bugs)
Assignee | ||
Updated•11 years ago
|
Attachment #818019 -
Attachment is obsolete: true
Comment 8•11 years ago
|
||
Comment on attachment 818413 [details] [diff] [review] Make Gamepad.buttons into an array of GamepadButton objects nsTArray<nsRefPtr<GamepadButton>> space between > and > (unless all our compilers supports >> already) >+interface GamepadButton { >+ readonly attribute boolean pressed; >+ readonly attribute double value; >+}; 2 space indentation please.
Attachment #818413 -
Flags: review?(bugs) → review+
Comment 9•11 years ago
|
||
(In reply to comment #8) > Comment on attachment 818413 [details] [diff] [review] > --> https://bugzilla.mozilla.org/attachment.cgi?id=818413 > Make Gamepad.buttons into an array of GamepadButton objects > > nsTArray<nsRefPtr<GamepadButton>> > space between > and > (unless all our compilers supports >> already) They do now!!! Go crazy with >>'s. :-)
Assignee | ||
Comment 10•11 years ago
|
||
My try push showed that I forgot to fix test_interfaces.html to include GamepadButton. smaug gave r+ over IRC to make that change.
Assignee | ||
Updated•11 years ago
|
Attachment #818413 -
Attachment is obsolete: true
Assignee | ||
Comment 11•11 years ago
|
||
Comment on attachment 818605 [details] [diff] [review] Make Gamepad.buttons into an array of GamepadButton objects. r=smaug from the previous patch and r=smaug over IRC for the test change.
Attachment #818605 -
Flags: review+
Assignee | ||
Comment 12•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/2c7feaa3d1be
Comment 13•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2c7feaa3d1be https://hg.mozilla.org/mozilla-central/rev/1cf18e533f44
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Comment 14•11 years ago
|
||
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #9) > > nsTArray<nsRefPtr<GamepadButton>> > > space between > and > (unless all our compilers supports >> already) > > They do now!!! Go crazy with >>'s. :-) Preparing to file the s/> >/>>/ bug.... ;-)
Comment 15•11 years ago
|
||
Note that this required a clobber for Windows dep build bustage.
Comment 16•10 years ago
|
||
The page https://developer.mozilla.org/en-US/docs/Web/API/Gamepad.buttons and the previous version has not been released (on by default) in a final version. So I think this is ok like this.
Keywords: dev-doc-needed → dev-doc-complete
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•