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

Unified Diff: media/blink/webmediaplayer_util.cc

Issue 2712983004: Simplify/Cleanup MediaClient (Closed)
Patch Set: Little fixes 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
Index: media/blink/webmediaplayer_util.cc
diff --git a/media/blink/webmediaplayer_util.cc b/media/blink/webmediaplayer_util.cc
index e4a5d342c7ead4b2906d5e38b99a3e88b00f9e95..4b518529f229ab8ba1505bbc57322306779ef9a6 100644
--- a/media/blink/webmediaplayer_util.cc
+++ b/media/blink/webmediaplayer_util.cc
@@ -11,7 +11,7 @@
#include "base/metrics/histogram_macros.h"
#include "media/base/bind_to_current_loop.h"
-#include "media/base/media_client.h"
+#include "media/base/media_log.h"
#include "third_party/WebKit/public/platform/URLConversion.h"
#include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.h"
@@ -109,7 +109,10 @@ std::string LoadTypeToString(blink::WebMediaPlayer::LoadType load_type) {
void ReportMetrics(blink::WebMediaPlayer::LoadType load_type,
const GURL& url,
- const blink::WebSecurityOrigin& security_origin) {
+ const blink::WebSecurityOrigin& security_origin,
+ scoped_refptr<MediaLog> media_log) {
+ DCHECK(media_log);
+
// Report URL scheme, such as http, https, file, blob etc.
UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url),
kMaxURLScheme + 1);
@@ -119,44 +122,34 @@ void ReportMetrics(blink::WebMediaPlayer::LoadType load_type,
blink::WebMediaPlayer::LoadTypeMax + 1);
// Report the origin from where the media player is created.
- if (GetMediaClient()) {
- GURL security_origin_url(url::Origin(security_origin).GetURL());
-
- GetMediaClient()->RecordRapporURL(
- "Media.OriginUrl." + LoadTypeToString(load_type), security_origin_url);
-
- // For MSE, also report usage by secure/insecure origin.
- if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource) {
- if (security_origin.isPotentiallyTrustworthy()) {
- GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Secure",
- security_origin_url);
- } else {
- GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Insecure",
- security_origin_url);
- }
+ GURL security_origin_url(url::Origin(security_origin).GetURL());
+ media_log->RecordRapporWithURL(
+ "Media.OriginUrl." + LoadTypeToString(load_type), security_origin_url);
+
+ // For MSE, also report usage by secure/insecure origin.
+ if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource) {
+ if (security_origin.isPotentiallyTrustworthy()) {
+ media_log->RecordRapporWithURL("Media.OriginUrl.MSE.Secure",
+ security_origin_url);
+ } else {
+ media_log->RecordRapporWithURL("Media.OriginUrl.MSE.Insecure",
+ security_origin_url);
}
}
}
void ReportPipelineError(blink::WebMediaPlayer::LoadType load_type,
const blink::WebSecurityOrigin& security_origin,
- PipelineStatus error) {
+ PipelineStatus error,
+ scoped_refptr<MediaLog> media_log) {
DCHECK_NE(PIPELINE_OK, error);
// Report the origin from where the media player is created.
- if (!GetMediaClient())
- return;
-
- GetMediaClient()->RecordRapporURL(
+ media_log->RecordRapporWithURL(
"Media.OriginUrl." + LoadTypeToString(load_type) + ".PipelineError",
url::Origin(security_origin).GetURL());
}
-void RecordOriginOfHLSPlayback(const GURL& origin_url) {
- if (media::GetMediaClient())
- GetMediaClient()->RecordRapporURL("Media.OriginUrl.HLS", origin_url);
-}
-
EmeInitDataType ConvertToEmeInitDataType(
blink::WebEncryptedMediaInitDataType init_data_type) {
switch (init_data_type) {
« content/renderer/media/render_media_log.h ('K') | « media/blink/webmediaplayer_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698