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

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

Issue 2671993002: [Blink>Media] Fix a crash in autoplay caused by delayed visibility observation (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
« 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/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index a43e6d66f8ee0b4559685b200eeaa299fc9e97a8..caa74795f478b099fb9287f3227341133efff92a 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -4005,6 +4005,10 @@ EnumerationHistogram& HTMLMediaElement::showControlsHistogram() const {
void HTMLMediaElement::onVisibilityChangedForAutoplay(bool isVisible) {
if (!isVisible)
return;
+ // Visibility change might be notified after stopping the observer, as it is a
+ // delayed task. Abort the steps if this happens.
+ if (!m_autoplayVisibilityObserver)
+ return;
mlamouri (slow - plz ping) 2017/02/06 12:55:43 Why should we early return here? Shouldn't we inst
Zhiqiang Zhang (Slow) 2017/02/06 14:17:14 I think we should assume visibility change will ne
mlamouri (slow - plz ping) 2017/02/07 12:36:27 I see. That makes sense :)
if (shouldAutoplay()) {
m_paused = 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