Title: [94608] trunk
- Revision
- 94608
- Author
- [email protected]
- Date
- 2011-09-06 15:51:33 -0700 (Tue, 06 Sep 2011)
Log Message
MediaElementAudioSourceNode destruction triggers ASSERTS
https://bugs.webkit.org/show_bug.cgi?id=67665
Reviewed by Nate Chapin.
Source/WebCore:
Test: webaudio/mediaelementaudiosourcenode-gc.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setAudioSourceNode):
* webaudio/AudioContext.cpp:
(WebCore::AudioContext::uninitializeDispatch):
(WebCore::AudioContext::stop):
* webaudio/AudioContext.h:
LayoutTests:
* webaudio/mediaelementaudiosourcenode-gc-expected.txt: Added.
* webaudio/mediaelementaudiosourcenode-gc.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (94607 => 94608)
--- trunk/LayoutTests/ChangeLog 2011-09-06 22:45:20 UTC (rev 94607)
+++ trunk/LayoutTests/ChangeLog 2011-09-06 22:51:33 UTC (rev 94608)
@@ -1,3 +1,13 @@
+2011-09-06 Chris Rogers <[email protected]>
+
+ MediaElementAudioSourceNode destruction triggers ASSERTS
+ https://bugs.webkit.org/show_bug.cgi?id=67665
+
+ Reviewed by Nate Chapin.
+
+ * webaudio/mediaelementaudiosourcenode-gc-expected.txt: Added.
+ * webaudio/mediaelementaudiosourcenode-gc.html: Added.
+
2011-09-06 James Robinson <[email protected]>
[chromium] Update pixel baselines for r94597
Added: trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-gc-expected.txt (0 => 94608)
--- trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-gc-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-gc-expected.txt 2011-09-06 22:51:33 UTC (rev 94608)
@@ -0,0 +1,9 @@
+Tests garbage collection of MediaElementAudioSourceNode.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS MediaElementAudioSourceNode survived garbage collection.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-gc.html (0 => 94608)
--- trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-gc.html (rev 0)
+++ trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-gc.html 2011-09-06 22:51:33 UTC (rev 94608)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+description("Tests garbage collection of MediaElementAudioSourceNode.");
+
+function gc()
+{
+ if (window.GCController)
+ return GCController.collect();
+
+ for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
+ var s = new String("abc");
+ }
+}
+
+function runTest() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ audioElement = document.createElement("audio");
+ context = new webkitAudioContext(1, 1000, 44100);
+ source = context.createMediaElementSource(audioElement);
+ audioElement = null;
+ context = null;
+ source = null;
+ gc();
+
+ testPassed("MediaElementAudioSourceNode survived garbage collection.");
+
+ finishJSTest();
+}
+
+runTest();
+successfullyParsed = true;
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (94607 => 94608)
--- trunk/Source/WebCore/ChangeLog 2011-09-06 22:45:20 UTC (rev 94607)
+++ trunk/Source/WebCore/ChangeLog 2011-09-06 22:51:33 UTC (rev 94608)
@@ -1,3 +1,19 @@
+2011-09-06 Chris Rogers <[email protected]>
+
+ MediaElementAudioSourceNode destruction triggers ASSERTS
+ https://bugs.webkit.org/show_bug.cgi?id=67665
+
+ Reviewed by Nate Chapin.
+
+ Test: webaudio/mediaelementaudiosourcenode-gc.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setAudioSourceNode):
+ * webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::uninitializeDispatch):
+ (WebCore::AudioContext::stop):
+ * webaudio/AudioContext.h:
+
2011-09-05 Oliver Hunt <[email protected]>
An object's structure should reference the global object responsible for its creation
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (94607 => 94608)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-09-06 22:45:20 UTC (rev 94607)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2011-09-06 22:51:33 UTC (rev 94608)
@@ -2984,7 +2984,6 @@
#if ENABLE(WEB_AUDIO)
void HTMLMediaElement::setAudioSourceNode(MediaElementAudioSourceNode* sourceNode)
{
- ASSERT(!m_audioSourceNode);
m_audioSourceNode = sourceNode;
}
Modified: trunk/Source/WebCore/webaudio/AudioContext.cpp (94607 => 94608)
--- trunk/Source/WebCore/webaudio/AudioContext.cpp 2011-09-06 22:45:20 UTC (rev 94607)
+++ trunk/Source/WebCore/webaudio/AudioContext.cpp 2011-09-06 22:51:33 UTC (rev 94608)
@@ -257,10 +257,25 @@
return m_hrtfDatabaseLoader->isLoaded();
}
+void AudioContext::uninitializeDispatch(void* userData)
+{
+ AudioContext* context = reinterpret_cast<AudioContext*>(userData);
+ ASSERT(context);
+ if (!context)
+ return;
+
+ context->uninitialize();
+}
+
void AudioContext::stop()
{
m_document = 0; // document is going away
- uninitialize();
+
+ // Don't call uninitialize() immediately here because the ScriptExecutionContext is in the middle
+ // of dealing with all of its ActiveDOMObjects at this point. uninitialize() can de-reference other
+ // ActiveDOMObjects so let's schedule uninitialize() to be called later.
+ // FIXME: see if there's a more direct way to handle this issue.
+ callOnMainThread(uninitializeDispatch, this);
}
Document* AudioContext::document() const
Modified: trunk/Source/WebCore/webaudio/AudioContext.h (94607 => 94608)
--- trunk/Source/WebCore/webaudio/AudioContext.h 2011-09-06 22:45:20 UTC (rev 94607)
+++ trunk/Source/WebCore/webaudio/AudioContext.h 2011-09-06 22:51:33 UTC (rev 94608)
@@ -231,6 +231,7 @@
void lazyInitialize();
void uninitialize();
+ static void uninitializeDispatch(void* userData);
void scheduleNodeDeletion();
static void deleteMarkedNodesDispatch(void* userData);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes