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

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

Issue 1470153004: Autoplay experiment metric fixes and additions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl feedback. Created 5 years, 1 month 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 980f33aa210609a2dc9eb0c08ff41aa2e52a4cab..958a36f3ce1c63edb178a5647f2782ac64e4b292 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -140,7 +140,7 @@ public:
TimeRanges* seekable() const;
bool ended() const;
bool autoplay() const;
- enum class RecordMetricsBehavior { DoNotRecord, DoRecord };
+ enum class RecordMetricsBehavior { DoNotRecord, RecordOnSandboxFailure };
bool shouldAutoplay(const RecordMetricsBehavior = RecordMetricsBehavior::DoNotRecord);
bool loop() const;
void setLoop(bool);
@@ -280,6 +280,8 @@ protected:
DisplayMode displayMode() const { return m_displayMode; }
virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
+ void recordAutoplayMetric(AutoplayMetrics);
+
private:
void resetMediaPlayerAndMediaSource();
@@ -384,13 +386,12 @@ private:
void playInternal();
// If we are about to enter a paused state, call this to record
- // autoplay metrics. If we were already in a stopped state, then
- // this does nothing.
- void recordMetricsIfPausing();
+ // autoplay metrics.
+ void recordMetricsBeforePause();
+ void recordMetricsAtPlaybackEnd();
// Could stopping at this point be considered a bailout of playback?
// (as in, "The user really didn't want to play this").
bool isBailout() const;
- void autoplayMediaEncountered();
void allowVideoRendering();
void updateVolume();
@@ -422,8 +423,6 @@ private:
void setAllowHiddenVolumeControls(bool);
- void recordAutoplayMetric(AutoplayMetrics);
-
WebMediaPlayer::CORSMode corsMode() const;
// Returns the "direction of playback" value as specified in the HTML5 spec.
@@ -443,8 +442,10 @@ private:
// Return true if and only if we require a user gesture before letting
// the media play.
bool isUserGestureRequiredForPlay() const;
- void removeUserGestureRequirement();
- void setInitialPlayWithoutUserGestures(bool);
+ // If the user gesture is required, then this will remove it. If the
+ // media is later autoplayed, then the supplied reason will be recorded.
+ void removeUserGestureRequirement(AutoplayMetrics);
+ void autoplayMediaEncountered();
void setNetworkState(NetworkState);
@@ -625,6 +626,10 @@ private:
friend class AutoplayExperimentHelper;
AutoplayExperimentHelper m_autoplayHelper;
+ // Reason that autoplay would be allowed to proceed without a user gesture.
philipj_slow 2015/11/26 15:30:56 Can these be stored in AutoplayExperimentHelper?
liberato (no reviews please) 2015/12/02 00:58:09 Done.
+ AutoplayMetrics m_autoplayDeferredMetric;
+ // Did we record that this media element exists in the metrics yet?
+ bool m_recordedElement;
static URLRegistry* s_mediaStreamRegistry;
};

Powered by Google App Engine
This is Rietveld 408576698