HTMLMediaElement isn't garbage collected between document reloads
authorfischman@chromium.org <fischman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Sep 2012 04:44:29 +0000 (04:44 +0000)
committerfischman@chromium.org <fischman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Sep 2012 04:44:29 +0000 (04:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97020

Reviewed by Eric Carlson.

.:

Manual test added: ManualTests/audio-freed-during-reload.html

* ManualTests/audio-freed-during-reload.html:

Source/WebCore:

JS-created (as opposed to DOM-created) Audio nodes never got collected, because they
appear to always hasPendingActivity(), because m_playing is never set to false.

Manual test added: ManualTests/audio-freed-during-reload.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::stop): set m_playing = false; explicitly.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129296 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
ManualTests/audio-freed-during-reload.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index c78972a..8dc53f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-09-21  Ami Fischman  <fischman@chromium.org>
+
+        HTMLMediaElement isn't garbage collected between document reloads
+        https://bugs.webkit.org/show_bug.cgi?id=97020
+
+        Reviewed by Eric Carlson.
+
+        Manual test added: ManualTests/audio-freed-during-reload.html
+
+        * ManualTests/audio-freed-during-reload.html:
+
 2012-09-21  Chris Rogers  <crogers@google.com>
 
         Add Web Audio support for deprecated/legacy APIs
diff --git a/ManualTests/audio-freed-during-reload.html b/ManualTests/audio-freed-during-reload.html
new file mode 100644 (file)
index 0000000..d661d91
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+    <script>
+        function go() {
+          var a = new Audio();
+          a.autoplay = "1";
+          a.src = "../LayoutTests/media/content/test.wav";
+        }
+    </script>
+
+    <body onload="go()">
+        <p>
+            Load this page and open Activity Monitor, htop, chrome's task manager, or another resource monitor.
+            Reload the page a number of times and verify that the memory usage
+            doesn't keep climbing indefinitely per reload.
+        </p>
+    </body>
+</html?
index af7aca0..db86958 100644 (file)
@@ -1,3 +1,18 @@
+2012-09-21  Ami Fischman  <fischman@chromium.org>
+
+        HTMLMediaElement isn't garbage collected between document reloads
+        https://bugs.webkit.org/show_bug.cgi?id=97020
+
+        Reviewed by Eric Carlson.
+
+        JS-created (as opposed to DOM-created) Audio nodes never got collected, because they
+        appear to always hasPendingActivity(), because m_playing is never set to false.
+
+        Manual test added: ManualTests/audio-freed-during-reload.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::stop): set m_playing = false; explicitly.
+
 2012-09-21  Simon Fraser  <simon.fraser@apple.com>
 
         RenderMarquee causes ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox()) : WebCore::FloatRect WebCore::RenderGeometryMap::absoluteRect(const WebCore::FloatRect &) const
index 5f56745..66b8c46 100644 (file)
@@ -3675,6 +3675,7 @@ void HTMLMediaElement::stop()
     userCancelledLoad();
     
     // Stop the playback without generating events
+    m_playing = false;
     setPausedInternal(true);
     
     if (renderer())