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

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

Issue 2382973002: Convert WebSecurityOrigin -> GURL without re-parsing the url (Closed)
Patch Set: rebase on #427122 Created 4 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 unified diff | Download patch
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Report URL scheme, such as http, https, file, blob etc. 114 // Report URL scheme, such as http, https, file, blob etc.
115 UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url), 115 UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url),
116 kMaxURLScheme + 1); 116 kMaxURLScheme + 1);
117 117
118 // Report load type, such as URL, MediaSource or MediaStream. 118 // Report load type, such as URL, MediaSource or MediaStream.
119 UMA_HISTOGRAM_ENUMERATION("Media.LoadType", load_type, 119 UMA_HISTOGRAM_ENUMERATION("Media.LoadType", load_type,
120 blink::WebMediaPlayer::LoadTypeMax + 1); 120 blink::WebMediaPlayer::LoadTypeMax + 1);
121 121
122 // Report the origin from where the media player is created. 122 // Report the origin from where the media player is created.
123 if (GetMediaClient()) { 123 if (GetMediaClient()) {
124 GURL security_origin_url( 124 GURL security_origin_url(url::Origin(security_origin).GetURL());
125 blink::WebStringToGURL(security_origin.toString()));
126 125
127 GetMediaClient()->RecordRapporURL( 126 GetMediaClient()->RecordRapporURL(
128 "Media.OriginUrl." + LoadTypeToString(load_type), security_origin_url); 127 "Media.OriginUrl." + LoadTypeToString(load_type), security_origin_url);
129 128
130 // For MSE, also report usage by secure/insecure origin. 129 // For MSE, also report usage by secure/insecure origin.
131 if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource) { 130 if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource) {
132 if (security_origin.isPotentiallyTrustworthy()) { 131 if (security_origin.isPotentiallyTrustworthy()) {
133 GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Secure", 132 GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Secure",
134 security_origin_url); 133 security_origin_url);
135 } else { 134 } else {
136 GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Insecure", 135 GetMediaClient()->RecordRapporURL("Media.OriginUrl.MSE.Insecure",
137 security_origin_url); 136 security_origin_url);
138 } 137 }
139 } 138 }
140 } 139 }
141 } 140 }
142 141
143 void ReportPipelineError(blink::WebMediaPlayer::LoadType load_type, 142 void ReportPipelineError(blink::WebMediaPlayer::LoadType load_type,
144 const blink::WebSecurityOrigin& security_origin, 143 const blink::WebSecurityOrigin& security_origin,
145 PipelineStatus error) { 144 PipelineStatus error) {
146 DCHECK_NE(PIPELINE_OK, error); 145 DCHECK_NE(PIPELINE_OK, error);
147 146
148 // Report the origin from where the media player is created. 147 // Report the origin from where the media player is created.
149 if (!GetMediaClient()) 148 if (!GetMediaClient())
150 return; 149 return;
151 150
152 GetMediaClient()->RecordRapporURL( 151 GetMediaClient()->RecordRapporURL(
153 "Media.OriginUrl." + LoadTypeToString(load_type) + ".PipelineError", 152 "Media.OriginUrl." + LoadTypeToString(load_type) + ".PipelineError",
154 blink::WebStringToGURL(security_origin.toString())); 153 url::Origin(security_origin).GetURL());
155 } 154 }
156 155
157 void RecordOriginOfHLSPlayback(const GURL& origin_url) { 156 void RecordOriginOfHLSPlayback(const GURL& origin_url) {
158 if (media::GetMediaClient()) 157 if (media::GetMediaClient())
159 GetMediaClient()->RecordRapporURL("Media.OriginUrl.HLS", origin_url); 158 GetMediaClient()->RecordRapporURL("Media.OriginUrl.HLS", origin_url);
160 } 159 }
161 160
162 EmeInitDataType ConvertToEmeInitDataType( 161 EmeInitDataType ConvertToEmeInitDataType(
163 blink::WebEncryptedMediaInitDataType init_data_type) { 162 blink::WebEncryptedMediaInitDataType init_data_type) {
164 switch (init_data_type) { 163 switch (init_data_type) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 249
251 } // namespace 250 } // namespace
252 251
253 OutputDeviceStatusCB ConvertToOutputDeviceStatusCB( 252 OutputDeviceStatusCB ConvertToOutputDeviceStatusCB(
254 blink::WebSetSinkIdCallbacks* web_callbacks) { 253 blink::WebSetSinkIdCallbacks* web_callbacks) {
255 return media::BindToCurrentLoop( 254 return media::BindToCurrentLoop(
256 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks))); 255 base::Bind(RunSetSinkIdCallback, SetSinkIdCallback(web_callbacks)));
257 } 256 }
258 257
259 } // namespace media 258 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webencryptedmediaclient_impl.cc ('k') | third_party/WebKit/Source/modules/storage/StorageNamespace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698