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

Unified Diff: third_party/WebKit/Source/core/html/AutoplayUmaHelper.h

Issue 2767093002: Fix AutoplayUmaHelper when autoplay is initiated from multiple sources (Closed)
Patch Set: fixed test Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
diff --git a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
index d6f7de8b9560156f3db03b17f0d2cbe21973ed3b..82130ef27566f342d2e972181b0c85adeeedc277 100644
--- a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
+++ b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
@@ -20,8 +20,12 @@ enum class AutoplaySource {
Attribute = 0,
// Autoplay comes from `play()` method.
Method = 1,
- // This enum value must be last.
+ // Used for checking dual source.
NumberOfSources = 2,
+ // Both sources are used.
+ DualSource = 2,
+ // This enum value must be last.
+ NumberOfUmaSources = 3,
};
// These values are used for histograms. Do not reorder.
@@ -75,7 +79,7 @@ class CORE_EXPORT AutoplayUmaHelper : public EventListener,
bool isVisible() const { return m_isVisible; }
- bool hasSource() const { return m_source != AutoplaySource::NumberOfSources; }
+ bool hasSource() const { return !m_sources.empty(); }
DECLARE_VIRTUAL_TRACE();
@@ -105,9 +109,9 @@ class CORE_EXPORT AutoplayUmaHelper : public EventListener,
bool shouldListenToContextDestroyed() const;
bool shouldRecordUserPausedAutoplayingCrossOriginVideo() const;
- // The autoplay source. Use AutoplaySource::NumberOfSources for invalid
- // source.
- AutoplaySource m_source;
+ // The autoplay sources.
+ std::set<AutoplaySource> m_sources;
+
// The media element this UMA helper is attached to. |m_element| owns |this|.
Member<HTMLMediaElement> m_element;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698