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

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 Created 4 years, 2 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
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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 } 1306 }
1305 1307
1306 void WebMediaPlayerAndroid::ReportHLSMetrics() const { 1308 void WebMediaPlayerAndroid::ReportHLSMetrics() const {
1307 if (player_type_ != MEDIA_PLAYER_TYPE_URL) 1309 if (player_type_ != MEDIA_PLAYER_TYPE_URL)
1308 return; 1310 return;
1309 1311
1310 bool is_hls = IsHLSStream(); 1312 bool is_hls = IsHLSStream();
1311 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); 1313 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls);
1312 if (is_hls) { 1314 if (is_hls) {
1313 media::RecordOriginOfHLSPlayback( 1315 media::RecordOriginOfHLSPlayback(
1314 blink::WebStringToGURL(frame_->getSecurityOrigin().toString())); 1316 url::Origin(frame_->getSecurityOrigin()).GetURL());
1315 } 1317 }
1316 1318
1317 // Assuming that |is_hls| is the ground truth, test predictions. 1319 // Assuming that |is_hls| is the ground truth, test predictions.
1318 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_); 1320 bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_);
1319 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_); 1321 bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_);
1320 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT; 1322 MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT;
1321 if (is_hls_path == is_hls && is_hls_url == is_hls) { 1323 if (is_hls_path == is_hls && is_hls_url == is_hls) {
1322 result = PREDICTION_RESULT_ALL_CORRECT; 1324 result = PREDICTION_RESULT_ALL_CORRECT;
1323 } else if (is_hls_path == is_hls) { 1325 } else if (is_hls_path == is_hls) {
1324 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; 1326 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER;
(...skipping 11 matching lines...) Expand all
1336 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1338 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1337 switches::kDisableMediaSuspend)) { 1339 switches::kDisableMediaSuspend)) {
1338 return false; 1340 return false;
1339 } 1341 }
1340 1342
1341 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1343 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1342 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); 1344 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden();
1343 } 1345 }
1344 1346
1345 } // namespace content 1347 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698