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

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

Issue 2101613002: Record the offscreen playing duration of autoplaying muted videos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
index 282b0fae379e98ae19c87e05ddba06d8669e3091..fd3a02cb8e6b89a5fd73ef90f6e6f64cd0d2b918 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -493,6 +493,7 @@ private:
EnumerationHistogram& showControlsHistogram() const;
void recordAutoplaySourceMetric(int source);
+ void recordAutoplayVideoOffscreenMetric(double timeDeltaMS);
void onVisibilityChangedForAutoplay(bool isVisible);
@@ -612,6 +613,18 @@ private:
GC_PLUGIN_IGNORE("http://crbug.com/404577")
WeakMember<AudioSourceProviderClient> m_audioSourceNode;
+ // Variables used for recording the duration of autoplay muted video playing offscreen.
+ // The variables are valid when |m_autoplayOffscrenVisibilityObserver| is non-null. Whenever the playback pauses, the UMA is recorded, and |m_autoplayOffscreenVisibilityObserver| is set to null.
+ double m_mutedVideoAutoplayStartTimeMS;
+ double m_mutedVideoAutoplayOffscreenDurationMS;
+ bool m_isVisible;
+ bool m_isAutoplayFromAttribute;
+ Member<ElementVisibilityObserver> m_autoplayOffscreenVisibilityObserver;
+
+ void maybeRecordMutedVideoAutoplayOffscreenDuration();
+
+ void onVisibilityChangedForAutoplayOffscreen(bool isVisibile);
+
// AudioClientImpl wraps an AudioSourceProviderClient.
// When the audio format is known, Chromium calls setFormat().
class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientImpl>, public WebAudioSourceProviderClient {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698