Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2725873002: Media: fix memory leak because of the document holding on an EventListener. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index b20a17edb06b0a4bee5031030d34d2891a6fd04a..c82535fd716627aa3d8de1467f109f37478fd28a 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -100,7 +100,7 @@
#include "wtf/text/CString.h"
#ifndef BLINK_MEDIA_LOG
-#define BLINK_MEDIA_LOG DVLOG(3)
+#define BLINK_MEDIA_LOG LOG(INFO)
#endif
#ifndef LOG_MEDIA_EVENTS
@@ -496,6 +496,8 @@ HTMLMediaElement::~HTMLMediaElement() {
void HTMLMediaElement::dispose() {
closeMediaSource();
+ LOG(INFO) << "HTMLMediaElement::dispose";
+
// Destroying the player may cause a resource load to be canceled,
// which could result in LocalDOMWindow::dispatchWindowLoadEvent() being
// called via ResourceFetch::didLoadResource(), then
@@ -654,6 +656,7 @@ Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(
}
void HTMLMediaElement::didNotifySubtreeInsertionsToDocument() {
+ BLINK_MEDIA_LOG << "didNotifySubtreeInsertionsToDocument()";
updateControlsVisibility();
}
@@ -664,6 +667,8 @@ void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) {
HTMLElement::removedFrom(insertionPoint);
if (insertionPoint->inActiveDocument()) {
updateControlsVisibility();
+ m_mediaControls->detach();
+ m_mediaControls = nullptr;
if (m_networkState > kNetworkEmpty)
pauseInternal();
}
@@ -3804,6 +3809,7 @@ bool HTMLMediaElement::isInteractiveContent() const {
}
DEFINE_TRACE(HTMLMediaElement) {
+ LOG(INFO) << "HTMLMediaElement::trace";
visitor->trace(m_playedTimeRanges);
visitor->trace(m_asyncEventQueue);
visitor->trace(m_error);

Powered by Google App Engine
This is Rietveld 408576698