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

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

Issue 2706593002: [Blink>Media] Adding rappor metrics to record autoplay muted by attribute usage (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/AutoplayUmaHelper.h" 5 #include "core/html/AutoplayUmaHelper.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ElementVisibilityObserver.h" 8 #include "core/dom/ElementVisibilityObserver.h"
9 #include "core/events/Event.h" 9 #include "core/events/Event.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // Record the source. 68 // Record the source.
69 if (m_element->isHTMLVideoElement()) { 69 if (m_element->isHTMLVideoElement()) {
70 videoHistogram.count(static_cast<int>(m_source)); 70 videoHistogram.count(static_cast<int>(m_source));
71 if (m_element->muted()) 71 if (m_element->muted())
72 mutedVideoHistogram.count(static_cast<int>(m_source)); 72 mutedVideoHistogram.count(static_cast<int>(m_source));
73 } else { 73 } else {
74 audioHistogram.count(static_cast<int>(m_source)); 74 audioHistogram.count(static_cast<int>(m_source));
75 } 75 }
76 76
77 // Record the child frame and top-level frame URLs for autoplay muted videos
78 // by attribute.
79 if (m_elemnet->isHTMLVideoElement() && m_element->muted() &&
80 source == AutoplaySource::Attribute) {
81 Platform::current()->recordRapporURL(
82 "Media.Video.Autoplay.Muted.Attribute.ChildFrame",
83 m_element->document().url());
84 Platform::current()->recordRapporURL(
85 "Media.Video.Autoplay.Muted.Attribute.TopLevelFrame",
86 m_element->document().topDocument().url());
mlamouri (slow - plz ping) 2017/02/20 11:23:43 FWIW, I'm not sure if that's the right thing to do
Zhiqiang Zhang (Slow) 2017/02/20 17:49:43 Maybe we just don't record the top-level frames at
87 }
88
77 // Record if it will be blocked by Data Saver or Autoplay setting. 89 // Record if it will be blocked by Data Saver or Autoplay setting.
78 if (m_element->isHTMLVideoElement() && m_element->muted() && 90 if (m_element->isHTMLVideoElement() && m_element->muted() &&
79 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { 91 RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) {
80 bool dataSaverEnabled = 92 bool dataSaverEnabled =
81 m_element->document().settings() && 93 m_element->document().settings() &&
82 m_element->document().settings()->getDataSaverEnabled(); 94 m_element->document().settings()->getDataSaverEnabled();
83 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings(); 95 bool blockedBySetting = !m_element->isAutoplayAllowedPerSettings();
84 96
85 if (dataSaverEnabled && blockedBySetting) { 97 if (dataSaverEnabled && blockedBySetting) {
86 blockedMutedVideoHistogram.count( 98 blockedMutedVideoHistogram.count(
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 373
362 DEFINE_TRACE(AutoplayUmaHelper) { 374 DEFINE_TRACE(AutoplayUmaHelper) {
363 EventListener::trace(visitor); 375 EventListener::trace(visitor);
364 ContextLifecycleObserver::trace(visitor); 376 ContextLifecycleObserver::trace(visitor);
365 visitor->trace(m_element); 377 visitor->trace(m_element);
366 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver); 378 visitor->trace(m_mutedVideoPlayMethodVisibilityObserver);
367 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver); 379 visitor->trace(m_mutedVideoOffscreenDurationVisibilityObserver);
368 } 380 }
369 381
370 } // namespace blink 382 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698