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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.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 "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "third_party/WebKit/public/platform/WebString.h" 60 #include "third_party/WebKit/public/platform/WebString.h"
61 #include "third_party/WebKit/public/platform/WebURL.h" 61 #include "third_party/WebKit/public/platform/WebURL.h"
62 #include "third_party/WebKit/public/web/WebDocument.h" 62 #include "third_party/WebKit/public/web/WebDocument.h"
63 #include "third_party/WebKit/public/web/WebFrame.h" 63 #include "third_party/WebKit/public/web/WebFrame.h"
64 #include "third_party/WebKit/public/web/WebView.h" 64 #include "third_party/WebKit/public/web/WebView.h"
65 #include "third_party/skia/include/core/SkCanvas.h" 65 #include "third_party/skia/include/core/SkCanvas.h"
66 #include "third_party/skia/include/core/SkImage.h" 66 #include "third_party/skia/include/core/SkImage.h"
67 #include "third_party/skia/include/core/SkPaint.h" 67 #include "third_party/skia/include/core/SkPaint.h"
68 #include "third_party/skia/include/core/SkTypeface.h" 68 #include "third_party/skia/include/core/SkTypeface.h"
69 #include "ui/gfx/image/image.h" 69 #include "ui/gfx/image/image.h"
70 #include "url/gurl.h"
71 #include "url/origin.h"
70 72
71 static const uint32_t kGLTextureExternalOES = 0x8D65; 73 static const uint32_t kGLTextureExternalOES = 0x8D65;
72 static const int kSDKVersionToSupportSecurityOriginCheck = 20; 74 static const int kSDKVersionToSupportSecurityOriginCheck = 20;
73 75
74 using blink::WebMediaPlayer; 76 using blink::WebMediaPlayer;
75 using blink::WebSize; 77 using blink::WebSize;
76 using blink::WebString; 78 using blink::WebString;
77 using blink::WebURL; 79 using blink::WebURL;
78 using gpu::gles2::GLES2Interface; 80 using gpu::gles2::GLES2Interface;
79 using media::LogHelper; 81 using media::LogHelper;
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 } 1292 }
1291 1293
1292 void WebMediaPlayerAndroid::ReportHLSMetrics() const { 1294 void WebMediaPlayerAndroid::ReportHLSMetrics() const {
1293 if (player_type_ != MEDIA_PLAYER_TYPE_URL) 1295 if (player_type_ != MEDIA_PLAYER_TYPE_URL)
1294 return; 1296 return;
1295 1297
1296 bool is_hls = IsHLSStream(); 1298 bool is_hls = IsHLSStream();
1297 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); 1299 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls);
1298 if (is_hls) { 1300 if (is_hls) {
1299 media::RecordOriginOfHLSPlayback( 1301 media::RecordOriginOfHLSPlayback(
1300 blink::WebStringToGURL(frame_->getSecurityOrigin().toString())); 1302 url::Origin(frame_->getSecurityOrigin()).GetURL());
1301 } 1303 }
1302 1304
1303 // Assuming that |is_hls| is the ground truth, test predictions. 1305 // Assuming that |is_hls| is the ground truth, test predictions.
1304 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_); 1306 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_);
1305 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_); 1307 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_);
1306 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT; 1308 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT;
1307 if (is_hls_path == is_hls && is_hls_url == is_hls) { 1309 if (is_hls_path == is_hls && is_hls_url == is_hls) {
1308 result = PREDICTION_RESULT_ALL_CORRECT; 1310 result = PREDICTION_RESULT_ALL_CORRECT;
1309 } else if (is_hls_path == is_hls) { 1311 } else if (is_hls_path == is_hls) {
1310 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; 1312 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER;
(...skipping 11 matching lines...) Expand all
1322 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1324 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1323 switches::kDisableMediaSuspend)) { 1325 switches::kDisableMediaSuspend)) {
1324 return false; 1326 return false;
1325 } 1327 }
1326 1328
1327 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1329 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1328 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); 1330 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden();
1329 } 1331 }
1330 1332
1331 } // namespace content 1333 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/dom_storage/webstoragenamespace_impl.cc ('k') | content/renderer/media/cdm/pepper_cdm_wrapper_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698