Closed
Bug 947241
Opened 12 years ago
Closed 12 years ago
Make Gamepad use the new attributes with cached sequence return values infrastructure
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
Attachments
(1 file, 1 obsolete file)
|
7.23 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
It fits like a glove.
| Assignee | ||
Comment 1•12 years ago
|
||
Attachment #8343760 -
Flags: review?(ted)
Attachment #8343760 -
Flags: review?(peterv)
Comment 2•12 years ago
|
||
Comment on attachment 8343760 [details] [diff] [review]
Make Gamepad used cached sequences for its buttons and axes.
Review of attachment 8343760 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/gamepad/Gamepad.cpp
@@ +68,2 @@
> mAxes[aAxis] = aValue;
> + if (changed) {
I would do:
if (mAxes[aAxis] != aValue) {
mAxes[aAxis] = aValue;
GamepadBinding::ClearCachedAxesValue(this);
}
@@ +72,4 @@
> }
>
> +void
> +Gamepad::GetButtons(nsTArray<nsRefPtr<GamepadButton> >& aButtons)
Don't need the extra space anymore
Comment 3•12 years ago
|
||
Comment on attachment 8343760 [details] [diff] [review]
Make Gamepad used cached sequences for its buttons and axes.
Review of attachment 8343760 [details] [diff] [review]:
-----------------------------------------------------------------
This is so much nicer, I'm weeping with joy!
::: dom/gamepad/Gamepad.cpp
@@ +68,3 @@
> mAxes[aAxis] = aValue;
> + if (changed) {
> + GamepadBinding::ClearCachedAxesValue(this);
So ClearCachedAxesValue is a bindings-generated method that comes from having [Cached] on the webidl method? Magic!
@@ +82,2 @@
> {
> + aAxes = mAxes;
Should we just inline these both in the class declaration? (You removed the previously-inlined overloads of these.)
::: dom/gamepad/Gamepad.h
@@ +89,5 @@
> nsString mID;
> uint32_t mIndex;
>
> // The mapping in use.
> GamepadMappingType mMapping;
There's an mButtonsVariant field you can remove:
http://hg.mozilla.org/mozilla-central/annotate/1401e4b394ad/dom/gamepad/Gamepad.h#l116
Attachment #8343760 -
Flags: review?(ted) → review+
| Assignee | ||
Comment 4•12 years ago
|
||
> I would do:
Yes, done.
> Don't need the extra space anymore
Mmm...ok. ;)
> So ClearCachedAxesValue is a bindings-generated method
Yup. https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#Cached
> Should we just inline these both in the class declaration?
Makes sense, done. They ended up shorter than I first expected.
> There's an mButtonsVariant field you can remove:
Yup, done.
| Assignee | ||
Comment 5•12 years ago
|
||
Attachment #8343795 -
Flags: review?(peterv)
| Assignee | ||
Comment 6•12 years ago
|
||
Also, fixed a problem where we weren't actually CCing mButtons (!).
| Assignee | ||
Updated•12 years ago
|
Attachment #8343760 -
Attachment is obsolete: true
Attachment #8343760 -
Flags: review?(peterv)
Comment 7•12 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #4)
> > So ClearCachedAxesValue is a bindings-generated method
>
> Yup. https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#Cached
It would be nicer if that wiki mentioned the generated ClearCached${x}Value method explicitly, but awesome that this is documented!
| Assignee | ||
Comment 8•12 years ago
|
||
Hmm. It's mentioned under [StoreInSlot], but you're right. I'll make it clearer.
Updated•12 years ago
|
Attachment #8343795 -
Flags: review?(peterv) → review+
| Assignee | ||
Comment 9•12 years ago
|
||
Flags: in-testsuite?
Whiteboard: [need review]
| Assignee | ||
Updated•12 years ago
|
Target Milestone: --- → mozilla29
Comment 10•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•