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

Side by Side Diff: third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp

Issue 1850903002: Enable user gesture requirement for autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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
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 #if !ENABLE(OILPAN) 50 #if !ENABLE(OILPAN)
51 // We can't do this during destruction in oilpan, since we rely on the 51 // We can't do this during destruction in oilpan, since we rely on the
52 // client to still be alive. 52 // client to still be alive.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 { 475 {
476 if (m_recordedElement) 476 if (m_recordedElement)
477 return; 477 return;
478 478
479 m_recordedElement = true; 479 m_recordedElement = true;
480 recordAutoplayMetric(client().isHTMLVideoElement() 480 recordAutoplayMetric(client().isHTMLVideoElement()
481 ? AnyVideoElement 481 ? AnyVideoElement
482 : AnyAudioElement); 482 : AnyAudioElement);
483 } 483 }
484 484
485 bool AutoplayExperimentHelper::isExperimentEnabled()
486 {
487 return m_mode != Mode::ExperimentOff;
488 }
489
485 } // namespace blink 490 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698