WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
85681
Simplify AudioNode ref-counting by removing RefTypeDisabled
https://bugs.webkit.org/show_bug.cgi?id=85681
Summary
Simplify AudioNode ref-counting by removing RefTypeDisabled
Raymond Toy
Reported
2012-05-04 16:05:09 PDT
It should be possible to remove the RefTypeDisabled ref type and also the corresponding enable() and disable() methods that set the ref type to RefTypeDisabled.
Attachments
WIP
(11.62 KB, patch)
2012-05-14 15:24 PDT
,
Raymond Toy
no flags
Details
Formatted Diff
Diff
Patch
(11.80 KB, patch)
2012-05-15 16:05 PDT
,
Raymond Toy
no flags
Details
Formatted Diff
Diff
Patch
(11.40 KB, patch)
2012-05-15 20:16 PDT
,
Raymond Toy
no flags
Details
Formatted Diff
Diff
Patch
(11.38 KB, patch)
2012-05-16 13:38 PDT
,
Raymond Toy
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Raymond Toy
Comment 1
2012-05-04 16:05:59 PDT
Implement this before fixing 77224. This change will simplify 77224.
Raymond Toy
Comment 2
2012-05-14 15:24:05 PDT
Created
attachment 141797
[details]
WIP
Raymond Toy
Comment 3
2012-05-14 15:32:45 PDT
Cannot remove the enable() and disable() methods. They're still needed to do the correct things.
Chris Rogers
Comment 4
2012-05-14 15:33:21 PDT
Comment on
attachment 141797
[details]
WIP View in context:
https://bugs.webkit.org/attachment.cgi?id=141797&action=review
> Source/WebCore/Modules/webaudio/AudioNode.cpp:270 > + fprintf(stderr, "%p: %d: AudioNode::enableOutputs %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount);
we're using print (instead of fprintf) let's stay consistent -- in another patch you can change everything over to fprintf, but let's not mix that up in this one
> Source/WebCore/Modules/webaudio/AudioNode.cpp:302 > + if (m_isDisabled && m_connectionRefCount > 0 && refType == RefTypeConnection)
Can we just move the if() logic from line 302 into line 272 and call enable... directly?
> Source/WebCore/Modules/webaudio/AudioNode.cpp:340 > +void AudioNode::disableOutputsIfNotDisabled()
I'd move the code for this method up to just after the "enable" version of this method
> Source/WebCore/Modules/webaudio/AudioNode.h:158 > + void disableOutputsIfNotDisabled();
nit: I'm too crazy about these names - how about: enableOutputsIfNecessary disableOutputsIfNecessary
Raymond Toy
Comment 5
2012-05-15 16:05:38 PDT
Created
attachment 142090
[details]
Patch
Raymond Toy
Comment 6
2012-05-15 16:09:48 PDT
Comment on
attachment 141797
[details]
WIP View in context:
https://bugs.webkit.org/attachment.cgi?id=141797&action=review
Updated according to review. Chris, please review the changes in AudioNodeInput::disable() and AudioNode::disableOutputsIfNecessary(). AudioNodeInput::disable() is better, but AudioNode::disableOutputsIfNecessary() is not as nice as I would want, but I'm not sure how else to do it.
>> Source/WebCore/Modules/webaudio/AudioNode.cpp:270 >> + fprintf(stderr, "%p: %d: AudioNode::enableOutputs %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount); > > we're using print (instead of fprintf) let's stay consistent -- in another patch you can change everything over to fprintf, but let's not mix that up in this one
Removed. I forgot to delete this debugging print.
>> Source/WebCore/Modules/webaudio/AudioNode.cpp:302 >> + if (m_isDisabled && m_connectionRefCount > 0 && refType == RefTypeConnection) > > Can we just move the if() logic from line 302 into line 272 and call enable... directly?
Done. But need to add refType as a parameter to work with finishDeref.
>> Source/WebCore/Modules/webaudio/AudioNode.cpp:340 >> +void AudioNode::disableOutputsIfNotDisabled() > > I'd move the code for this method up to just after the "enable" version of this method
Done.
>> Source/WebCore/Modules/webaudio/AudioNode.h:158 >> + void disableOutputsIfNotDisabled(); > > nit: I'm too crazy about these names - how about: > enableOutputsIfNecessary > disableOutputsIfNecessary
New names applied.
Chris Rogers
Comment 7
2012-05-15 19:00:21 PDT
Comment on
attachment 142090
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142090&action=review
> Source/WebCore/Modules/webaudio/AudioNode.cpp:267 > +void AudioNode::enableOutputsIfNecessary(RefType refType)
Please remove refType argument -- see comment below in ref() method.
> Source/WebCore/Modules/webaudio/AudioNode.cpp:286 > + if (!m_isDisabled) {
It's odd to have a nested if () here. Please roll this test into the first if ()
> Source/WebCore/Modules/webaudio/AudioNode.cpp:327 > + enableOutputsIfNecessary(refType);
You can remove refType argument and simply wrap the enableOutputsIfNecessary() call in: if (refType == RefTypeConnection)
> Source/WebCore/Modules/webaudio/AudioNodeInput.cpp:110 > + // Disable outputs, but only if there is one connection left (checked in
Please remove all of these comment about "one connection left", etc. All of this is logic internal (implementation detail) to disableOutputsIfNecessary() On the other hand, the difficult part of understanding this code is that we're inside of the disable() method right here, and yet we're calling something called disableOutputsIfNecessary(). The essential point to be made in the comment is that we "propagate" the disabling from this input to any outputs of this AudioNode
Raymond Toy
Comment 8
2012-05-15 20:16:36 PDT
Created
attachment 142135
[details]
Patch
Raymond Toy
Comment 9
2012-05-15 20:19:18 PDT
Comment on
attachment 142090
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142090&action=review
>> Source/WebCore/Modules/webaudio/AudioNode.cpp:267 >> +void AudioNode::enableOutputsIfNecessary(RefType refType) > > Please remove refType argument -- see comment below in ref() method.
Done.
>> Source/WebCore/Modules/webaudio/AudioNode.cpp:286 >> + if (!m_isDisabled) { > > It's odd to have a nested if () here. Please roll this test into the first if ()
Combined into one.
>> Source/WebCore/Modules/webaudio/AudioNode.cpp:327 >> + enableOutputsIfNecessary(refType); > > You can remove refType argument and simply wrap the enableOutputsIfNecessary() call in: > if (refType == RefTypeConnection)
Done.
>> Source/WebCore/Modules/webaudio/AudioNodeInput.cpp:110 >> + // Disable outputs, but only if there is one connection left (checked in > > Please remove all of these comment about "one connection left", etc. > All of this is logic internal (implementation detail) to disableOutputsIfNecessary() > > On the other hand, the difficult part of understanding this code is that we're inside of the disable() method right here, and yet we're > calling something called disableOutputsIfNecessary(). > The essential point to be made in the comment is that we "propagate" the disabling from this input to any outputs of this AudioNode
Comment removed.
Raymond Toy
Comment 10
2012-05-16 09:19:08 PDT
Comment on
attachment 142090
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142090&action=review
>>> Source/WebCore/Modules/webaudio/AudioNodeInput.cpp:110 >>> + // Disable outputs, but only if there is one connection left (checked in >> >> Please remove all of these comment about "one connection left", etc. >> All of this is logic internal (implementation detail) to disableOutputsIfNecessary() >> >> On the other hand, the difficult part of understanding this code is that we're inside of the disable() method right here, and yet we're >> calling something called disableOutputsIfNecessary(). >> The essential point to be made in the comment is that we "propagate" the disabling from this input to any outputs of this AudioNode > > Comment removed.
Maybe the functions should be renamed propagateOutputEnables and propagateOutputDisables?
Chris Rogers
Comment 11
2012-05-16 13:28:35 PDT
Comment on
attachment 142135
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142135&action=review
Looks good with a couple of comment nits.
> Source/WebCore/ChangeLog:3 > + Remove RefTypDisabled and disable() and enable() methods
Please update comment since disable and enable are not removed in this patch, and RefTypDisabled is a typo. I'd recommend changing the title of the WebKit bug itself to something like: "Simplify AudioNode ref-counting by removing RefTypeDisabled"
> Source/WebCore/Modules/webaudio/AudioNode.cpp:281 > + // Disable outputs if they have not been disabled yet. We do this if the number of connections
"if they have not been disabled yet" -> "if appropriate"
> Source/WebCore/Modules/webaudio/AudioNodeInput.cpp:110 > + node()->disableOutputsIfNecessary();
Please add comment: // Propagate disabled state to outputs.
> Source/WebCore/Modules/webaudio/AudioNodeInput.cpp:128 > + node()->enableOutputsIfNecessary();
Please add comment: // Propagate enabled state to outputs.
Raymond Toy
Comment 12
2012-05-16 13:38:24 PDT
Created
attachment 142336
[details]
Patch
Chris Rogers
Comment 13
2012-05-16 13:54:08 PDT
Comment on
attachment 142336
[details]
Patch Thanks Ray
WebKit Review Bot
Comment 14
2012-05-16 15:26:24 PDT
Comment on
attachment 142336
[details]
Patch Clearing flags on attachment: 142336 Committed
r117354
: <
http://trac.webkit.org/changeset/117354
>
WebKit Review Bot
Comment 15
2012-05-16 15:26:29 PDT
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 16
2012-05-21 15:22:37 PDT
Comment on
attachment 141797
[details]
WIP Cleared review? from obsolete
attachment 141797
[details]
so that this bug does not appear in
http://webkit.org/pending-review
. If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug