| 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 9e4d7251251f3d24dc3bbe4989ba190af632954f..e7c49862abaa72e0e9f91965e381361bc16dbcc6 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| @@ -128,6 +128,7 @@ namespace {
|
|
|
| constexpr float kMostlyFillViewportThreshold = 0.85f;
|
| constexpr double kMostlyFillViewportBecomeStableSeconds = 5;
|
| +constexpr double kCheckViewportIntersectionIntervalSeconds = 1;
|
|
|
| enum MediaControlsShow {
|
| MediaControlsShowAttribute = 0,
|
| @@ -370,6 +371,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName,
|
| m_viewportFillDebouncerTimer(
|
| this,
|
| &HTMLMediaElement::viewportFillDebouncerTimerFired),
|
| + m_checkViewportIntersectionTimer(
|
| + this,
|
| + &HTMLMediaElement::checkViewportIntersectionTimerFired),
|
| m_playedTimeRanges(),
|
| m_asyncEventQueue(GenericEventQueue::create(this)),
|
| m_playbackRate(1.0f),
|
| @@ -2462,8 +2466,6 @@ void HTMLMediaElement::startPlaybackProgressTimer() {
|
| }
|
|
|
| void HTMLMediaElement::playbackProgressTimerFired(TimerBase*) {
|
| - checkViewportIntersectionChanged();
|
| -
|
| if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime &&
|
| getDirectionOfPlayback() == Forward) {
|
| m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN();
|
| @@ -3302,6 +3304,7 @@ void HTMLMediaElement::updatePlayState() {
|
| void HTMLMediaElement::stopPeriodicTimers() {
|
| m_progressEventTimer.stop();
|
| m_playbackProgressTimer.stop();
|
| + m_checkViewportIntersectionTimer.stop();
|
| }
|
|
|
| void HTMLMediaElement::
|
| @@ -4062,9 +4065,16 @@ DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) {
|
| visitor->trace(m_client);
|
| }
|
|
|
| -void HTMLMediaElement::checkViewportIntersectionChanged() {
|
| - // TODO(xjz): Early return if we not in tab mirroring.
|
| +void HTMLMediaElement::activateViewportIntersectionMonitoring(bool activate) {
|
| + if (activate && !m_checkViewportIntersectionTimer.isActive()) {
|
| + m_checkViewportIntersectionTimer.startRepeating(
|
| + kCheckViewportIntersectionIntervalSeconds, BLINK_FROM_HERE);
|
| + } else if (!activate) {
|
| + m_checkViewportIntersectionTimer.stop();
|
| + }
|
| +}
|
|
|
| +void HTMLMediaElement::checkViewportIntersectionTimerFired(TimerBase*) {
|
| bool shouldReportRootBounds = true;
|
| IntersectionGeometry geometry(nullptr, *this, Vector<Length>(),
|
| shouldReportRootBounds);
|
|
|