| 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_waitingForAutoplayPlaybackEnd(false) | 34 , m_waitingForAutoplayPlaybackEnd(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 (m_mode != Mode::ExperimentOff) { | 42 if (isExperimentEnabled()) { |
| 43 WTF_LOG(Media, "HTMLMediaElement: autoplay experiment set to %d", | 43 WTF_LOG(Media, "HTMLMediaElement: autoplay experiment set to %d", |
| 44 m_mode); | 44 m_mode); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 AutoplayExperimentHelper::~AutoplayExperimentHelper() | 48 AutoplayExperimentHelper::~AutoplayExperimentHelper() |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 void AutoplayExperimentHelper::dispose() | 52 void AutoplayExperimentHelper::dispose() |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 recordAutoplayMetric(client().isHTMLVideoElement() | 489 recordAutoplayMetric(client().isHTMLVideoElement() |
| 490 ? AnyVideoElement | 490 ? AnyVideoElement |
| 491 : AnyAudioElement); | 491 : AnyAudioElement); |
| 492 } | 492 } |
| 493 | 493 |
| 494 bool AutoplayExperimentHelper::requiresViewportVisibility() const | 494 bool AutoplayExperimentHelper::requiresViewportVisibility() const |
| 495 { | 495 { |
| 496 return enabled(IfViewport) || enabled(IfPartialViewport); | 496 return enabled(IfViewport) || enabled(IfPartialViewport); |
| 497 } | 497 } |
| 498 | 498 |
| 499 bool AutoplayExperimentHelper::isExperimentEnabled() |
| 500 { |
| 501 return m_mode != Mode::ExperimentOff; |
| 502 } |
| 503 |
| 499 } // namespace blink | 504 } // namespace blink |
| OLD | NEW |