| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/html/AutoplayExperimentHelper.h" | 5 #include "core/html/AutoplayExperimentHelper.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLMediaElement.h" | 9 #include "core/html/HTMLMediaElement.h" |
| 10 #include "core/layout/LayoutBox.h" | 10 #include "core/layout/LayoutBox.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 , m_autoplayMediaEncountered(false) | 32 , m_autoplayMediaEncountered(false) |
| 33 , m_playbackStartedMetricRecorded(false) | 33 , m_playbackStartedMetricRecorded(false) |
| 34 , m_waitingForAutoplayPlaybackStop(false) | 34 , m_waitingForAutoplayPlaybackStop(false) |
| 35 , m_recordedElement(false) | 35 , m_recordedElement(false) |
| 36 , m_lastLocationUpdateTime(-std::numeric_limits<double>::infinity()) | 36 , m_lastLocationUpdateTime(-std::numeric_limits<double>::infinity()) |
| 37 , m_viewportTimer(this, &AutoplayExperimentHelper::viewportTimerFired) | 37 , m_viewportTimer(this, &AutoplayExperimentHelper::viewportTimerFired) |
| 38 , m_autoplayDeferredMetric(GesturelessPlaybackNotOverridden) | 38 , m_autoplayDeferredMetric(GesturelessPlaybackNotOverridden) |
| 39 { | 39 { |
| 40 m_mode = fromString(this->client().autoplayExperimentMode()); | 40 m_mode = fromString(this->client().autoplayExperimentMode()); |
| 41 | 41 |
| 42 if (isExperimentEnabled()) { | 42 DVLOG_IF(3, isExperimentEnabled()) << "autoplay experiment set to " << m_mod
e; |
| 43 WTF_LOG(Media, "HTMLMediaElement: autoplay experiment set to %d", | |
| 44 m_mode); | |
| 45 } | |
| 46 } | 43 } |
| 47 | 44 |
| 48 AutoplayExperimentHelper::~AutoplayExperimentHelper() | 45 AutoplayExperimentHelper::~AutoplayExperimentHelper() |
| 49 { | 46 { |
| 50 } | 47 } |
| 51 | 48 |
| 52 void AutoplayExperimentHelper::dispose() | 49 void AutoplayExperimentHelper::dispose() |
| 53 { | 50 { |
| 54 // Do any cleanup that requires the client. | 51 // Do any cleanup that requires the client. |
| 55 unregisterForPositionUpdatesIfNeeded(); | 52 unregisterForPositionUpdatesIfNeeded(); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 { | 546 { |
| 550 return client().isHTMLVideoElement() && (enabled(IfViewport) || enabled(IfPa
rtialViewport)); | 547 return client().isHTMLVideoElement() && (enabled(IfViewport) || enabled(IfPa
rtialViewport)); |
| 551 } | 548 } |
| 552 | 549 |
| 553 bool AutoplayExperimentHelper::isExperimentEnabled() | 550 bool AutoplayExperimentHelper::isExperimentEnabled() |
| 554 { | 551 { |
| 555 return m_mode != Mode::ExperimentOff; | 552 return m_mode != Mode::ExperimentOff; |
| 556 } | 553 } |
| 557 | 554 |
| 558 } // namespace blink | 555 } // namespace blink |
| OLD | NEW |