Bug 867203 - Part 1: Unregister AudioBufferSourceNodes from PannerNodes when they die; r=padenot

--HG--
extra : rebase_source : 3c580a0feba39d01779a91e6bd10a10d98cb7114
This commit is contained in:
Ehsan Akhgari 2013-04-30 19:20:55 -04:00
Родитель a36bcc36bc
Коммит 56fc223adb
5 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -21,6 +21,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioBufferSourceNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBuffer) NS_IMPL_CYCLE_COLLECTION_UNLINK(mBuffer)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPlaybackRate) NS_IMPL_CYCLE_COLLECTION_UNLINK(mPlaybackRate)
if (tmp->Context()) { if (tmp->Context()) {
// AudioNode's Unlink implementation disconnects us from the graph
// too, but we need to do this right here to make sure that
// UnregisterAudioBufferSourceNode can properly untangle us from
// the possibly connected PannerNodes.
tmp->DisconnectFromGraph();
tmp->Context()->UnregisterAudioBufferSourceNode(tmp); tmp->Context()->UnregisterAudioBufferSourceNode(tmp);
} }
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode) NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode)

Просмотреть файл

@ -244,6 +244,7 @@ void
AudioContext::UnregisterAudioBufferSourceNode(AudioBufferSourceNode* aNode) AudioContext::UnregisterAudioBufferSourceNode(AudioBufferSourceNode* aNode)
{ {
mAudioBufferSourceNodes.RemoveEntry(aNode); mAudioBufferSourceNodes.RemoveEntry(aNode);
UpdatePannerSource();
} }
void void

Просмотреть файл

@ -173,6 +173,7 @@ public:
void RemoveOutputParam(AudioParam* aParam); void RemoveOutputParam(AudioParam* aParam);
private: private:
friend class AudioBufferSourceNode;
// This could possibly delete 'this'. // This could possibly delete 'this'.
void DisconnectFromGraph(); void DisconnectFromGraph();

Просмотреть файл

@ -20,6 +20,7 @@ MOCHITEST_FILES := \
test_bug866570.html \ test_bug866570.html \
test_bug866737.html \ test_bug866737.html \
test_bug867089.html \ test_bug867089.html \
test_bug867203.html \
test_analyserNode.html \ test_analyserNode.html \
test_AudioBuffer.html \ test_AudioBuffer.html \
test_AudioContext.html \ test_AudioContext.html \

Просмотреть файл

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Crashtest for bug 867203</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var ctx = new AudioContext();
var panner1 = ctx.createPanner();
panner1.setVelocity(1, 1, 1);
ctx.listener.setVelocity(1, 1, 1);
(function() {
ctx.createBufferSource().connect(panner1);
})();
SpecialPowers.forceGC();
SpecialPowers.forceCC();
ctx.createPanner();
ok(true, "We did not crash.");
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>