Bug 875402 - Delete MediaInputPort objects using normal refcounting semantics; r=roc

This commit is contained in:
Ehsan Akhgari 2013-05-25 10:01:08 -04:00
Родитель 4655043378
Коммит 2e93916b83
3 изменённых файлов: 51 добавлений и 3 удалений

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

@ -1906,9 +1906,6 @@ MediaInputPort::Destroy()
{ {
Run(); Run();
} }
// This does not need to be strongly referenced; the graph is holding
// a strong reference to the port, which we will remove. This will be the
// last message for the port.
MediaInputPort* mPort; MediaInputPort* mPort;
}; };
GraphImpl()->AppendMessage(new Message(this)); GraphImpl()->AppendMessage(new Message(this));
@ -1950,6 +1947,10 @@ ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, uint32_t aFlags,
// The graph holds its reference implicitly // The graph holds its reference implicitly
mPort.forget(); mPort.forget();
} }
virtual void RunDuringShutdown()
{
Run();
}
nsRefPtr<MediaInputPort> mPort; nsRefPtr<MediaInputPort> mPort;
}; };
nsRefPtr<MediaInputPort> port = new MediaInputPort(aStream, this, aFlags, nsRefPtr<MediaInputPort> port = new MediaInputPort(aStream, this, aFlags,

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

@ -23,6 +23,7 @@ MOCHITEST_FILES := \
test_bug867104.html \ test_bug867104.html \
test_bug867174.html \ test_bug867174.html \
test_bug867203.html \ test_bug867203.html \
test_bug875402.html \
test_analyserNode.html \ test_analyserNode.html \
test_AudioBuffer.html \ test_AudioBuffer.html \
test_AudioContext.html \ test_AudioContext.html \

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

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Crashtest for bug 875402</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();
try { o1 = new OfflineAudioContext(1, 10, (new AudioContext()).sampleRate); } catch(e) { }
try { o2 = o1.createJavaScriptNode(); } catch(e) { }
try { o4 = new OfflineAudioContext(1, 10, (new AudioContext()).sampleRate); } catch(e) { }
try { o5 = o1.createChannelSplitter(4); } catch(e) { }
try { o7 = o4.createScriptProcessor(1024, 4, 1); } catch(e) { }
SpecialPowers.forceCC();
SpecialPowers.forceGC();
try { o1.startRendering(); } catch(e) { }
try { o2.connect(o7); } catch(e) { }
try { o7.connect(o4); } catch(e) { }
try { o9 = o4.createScriptProcessor(1024, 1, 4); } catch(e) { }
try { o2.connect(o7); } catch(e) { }
try { o9.connect(o1); } catch(e) { }
setTimeout("try { o2.connect(o9); } catch(e) { } done();",1000)
try { o7.connect(o4); } catch(e) { }
setTimeout("try { o5.disconnect() } catch(e) { }",100)
try { o2.connect(o9); } catch(e) { }
try { o4.startRendering(); } catch(e) { }
try { o2.connect(o9); } catch(e) { }
setTimeout("try { o7.connect(o4); } catch(e) { }",50)
try { o13 = o4.createGain(); } catch(e) { }
setTimeout("try { o7.connect(o13, 0, 0) } catch(e) { }",50)
function done() {
ok(true, "We did not crash.");
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>