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

Side by Side Diff: media/blink/webmediaplayer_util.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 | « media/blink/webmediaplayer_util.h ('k') | media/blink/webmediasource_impl.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/blink/webmediaplayer_util.h" 5 #include "media/blink/webmediaplayer_util.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 NOTREACHED(); 104 NOTREACHED();
105 return "Unknown"; 105 return "Unknown";
106 } 106 }
107 107
108 } // namespace 108 } // namespace
109 109
110 void ReportMetrics(blink::WebMediaPlayer::LoadType load_type, 110 void ReportMetrics(blink::WebMediaPlayer::LoadType load_type,
111 const GURL& url, 111 const GURL& url,
112 const blink::WebSecurityOrigin& security_origin, 112 const blink::WebSecurityOrigin& security_origin,
113 scoped_refptr<MediaLog> media_log) { 113 MediaLog* media_log) {
114 DCHECK(media_log); 114 DCHECK(media_log);
115 115
116 // Report URL scheme, such as http, https, file, blob etc. 116 // Report URL scheme, such as http, https, file, blob etc.
117 UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url), 117 UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url),
118 kMaxURLScheme + 1); 118 kMaxURLScheme + 1);
119 119
120 // Report load type, such as URL, MediaSource or MediaStream. 120 // Report load type, such as URL, MediaSource or MediaStream.
121 UMA_HISTOGRAM_ENUMERATION("Media.LoadType", load_type, 121 UMA_HISTOGRAM_ENUMERATION("Media.LoadType", load_type,
122 blink::WebMediaPlayer::kLoadTypeMax + 1); 122 blink::WebMediaPlayer::kLoadTypeMax + 1);
123 123
124 // Report the origin from where the media player is created. 124 // Report the origin from where the media player is created.
125 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl." + 125 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl." +
126 LoadTypeToString(load_type)); 126 LoadTypeToString(load_type));
127 127
128 // For MSE, also report usage by secure/insecure origin. 128 // For MSE, also report usage by secure/insecure origin.
129 if (load_type == blink::WebMediaPlayer::kLoadTypeMediaSource) { 129 if (load_type == blink::WebMediaPlayer::kLoadTypeMediaSource) {
130 if (security_origin.IsPotentiallyTrustworthy()) { 130 if (security_origin.IsPotentiallyTrustworthy()) {
131 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl.MSE.Secure"); 131 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl.MSE.Secure");
132 } else { 132 } else {
133 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl.MSE.Insecure"); 133 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl.MSE.Insecure");
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 void ReportPipelineError(blink::WebMediaPlayer::LoadType load_type, 138 void ReportPipelineError(blink::WebMediaPlayer::LoadType load_type,
139 PipelineStatus error, 139 PipelineStatus error,
140 scoped_refptr<MediaLog> media_log) { 140 MediaLog* media_log) {
141 DCHECK_NE(PIPELINE_OK, error); 141 DCHECK_NE(PIPELINE_OK, error);
142 142
143 // Report the origin from where the media player is created. 143 // Report the origin from where the media player is created.
144 media_log->RecordRapporWithSecurityOrigin( 144 media_log->RecordRapporWithSecurityOrigin(
145 "Media.OriginUrl." + LoadTypeToString(load_type) + ".PipelineError"); 145 "Media.OriginUrl." + LoadTypeToString(load_type) + ".PipelineError");
146 } 146 }
147 147
148 EmeInitDataType ConvertToEmeInitDataType( 148 EmeInitDataType ConvertToEmeInitDataType(
149 blink::WebEncryptedMediaInitDataType init_data_type) { 149 blink::WebEncryptedMediaInitDataType init_data_type) {
150 switch (init_data_type) { 150 switch (init_data_type) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 } // namespace 237 } // namespace
238 238
239 OutputDeviceStatusCB ConvertToOutputDeviceStatusCB( 239 OutputDeviceStatusCB ConvertToOutputDeviceStatusCB(
240 blink::WebSetSinkIdCallbacks* web_callbacks) { 240 blink::WebSetSinkIdCallbacks* web_callbacks) {
241 return media::BindToCurrentLoop( 241 return media::BindToCurrentLoop(
242 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); 242 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks)));
243 } 243 }
244 244
245 } // namespace media 245 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_util.h ('k') | media/blink/webmediasource_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698