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

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

Issue 2245613002: Revert "Simplify ElementVisibilityObserver implementation." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | 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 477cbbbd0a63ee29b73920abdcffb48bba5588b0..9ae340c3bbdf09ee5911ec1dc743e49b303f8f2e 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -1659,8 +1659,10 @@ void HTMLMediaElement::setReadyState(ReadyState state)
// We might end up in a situation where the previous
// observer didn't had time to fire yet. We can avoid
// creating a new one in this case.
- if (!m_autoplayVisibilityObserver)
- m_autoplayVisibilityObserver = ElementVisibilityObserver::create(this, this);
+ if (!m_autoplayVisibilityObserver) {
+ m_autoplayVisibilityObserver = new ElementVisibilityObserver(this, WTF::bind(&HTMLMediaElement::onVisibilityChangedForAutoplay, wrapWeakPersistent(this)));
+ m_autoplayVisibilityObserver->start();
+ }
} else {
m_paused = false;
invalidateCachedTime();
@@ -3673,8 +3675,8 @@ DEFINE_TRACE(HTMLMediaElement)
visitor->trace(m_srcObject);
visitor->trace(m_autoplayVisibilityObserver);
visitor->template registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakMembers>(this);
- HTMLElement::trace(visitor);
Supplementable<HTMLMediaElement>::trace(visitor);
+ HTMLElement::trace(visitor);
ActiveDOMObject::trace(visitor);
}
@@ -3912,7 +3914,7 @@ void HTMLMediaElement::recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus sta
autoplayUnmuteHistogram.count(status);
}
-void HTMLMediaElement::onVisibilityChanged(bool isVisible)
+void HTMLMediaElement::onVisibilityChangedForAutoplay(bool isVisible)
{
if (!isVisible)
return;
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698