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

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

Issue 2249223003: Fix a crash in AutoplayUmaHelper when releasing visibility observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wrapPersistent => wrapWeakPersistent Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp
diff --git a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp
index b359769b8a007dbf862405f1673040b029a7fa7a..bc6fe41590ece6524fdd9c2b7c6f5c45bd8c768c 100644
--- a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp
+++ b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp
@@ -81,7 +81,7 @@ void AutoplayUmaHelper::didMoveToNewDocument(Document& oldDocument)
void AutoplayUmaHelper::onVisibilityChangedForVideoMutedPlayMethod(bool isVisible)
{
- if (!isVisible)
+ if (!isVisible || !m_videoMutedPlayMethodVisibilityObserver)
return;
recordVideoAutoplayMutedPlayMethodBecomesVisibleUma(true);
@@ -115,7 +115,7 @@ void AutoplayUmaHelper::handlePlayingEvent()
{
if (m_source == AutoplaySource::Method && m_element->isHTMLVideoElement() && m_element->muted()) {
if (!m_videoMutedPlayMethodVisibilityObserver) {
- m_videoMutedPlayMethodVisibilityObserver = new ElementVisibilityObserver(m_element, WTF::bind(&AutoplayUmaHelper::onVisibilityChangedForVideoMutedPlayMethod, wrapPersistent(this)));
+ m_videoMutedPlayMethodVisibilityObserver = new ElementVisibilityObserver(m_element, WTF::bind(&AutoplayUmaHelper::onVisibilityChangedForVideoMutedPlayMethod, wrapWeakPersistent(this)));
m_videoMutedPlayMethodVisibilityObserver->start();
m_element->document().domWindow()->addEventListener(EventTypeNames::unload, this, false);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698