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

Side by Side Diff: content/renderer/media/cdm/pepper_cdm_wrapper_impl.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #if defined(ENABLE_PEPPER_CDMS) 5 #if defined(ENABLE_PEPPER_CDMS)
6 #include "content/renderer/media/cdm/pepper_cdm_wrapper_impl.h" 6 #include "content/renderer/media/cdm/pepper_cdm_wrapper_impl.h"
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
11 #include "content/renderer/pepper/pepper_webplugin_impl.h" 11 #include "content/renderer/pepper/pepper_webplugin_impl.h"
12 #include "third_party/WebKit/public/platform/URLConversion.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 13 #include "third_party/WebKit/public/platform/WebString.h"
13 #include "third_party/WebKit/public/web/WebDocument.h" 14 #include "third_party/WebKit/public/web/WebDocument.h"
14 #include "third_party/WebKit/public/web/WebElement.h" 15 #include "third_party/WebKit/public/web/WebElement.h"
15 #include "third_party/WebKit/public/web/WebFrame.h" 16 #include "third_party/WebKit/public/web/WebFrame.h"
16 #include "third_party/WebKit/public/web/WebHelperPlugin.h" 17 #include "third_party/WebKit/public/web/WebHelperPlugin.h"
17 #include "third_party/WebKit/public/web/WebLocalFrame.h" 18 #include "third_party/WebKit/public/web/WebLocalFrame.h"
18 #include "third_party/WebKit/public/web/WebPlugin.h" 19 #include "third_party/WebKit/public/web/WebPlugin.h"
19 #include "third_party/WebKit/public/web/WebPluginContainer.h" 20 #include "third_party/WebKit/public/web/WebPluginContainer.h"
20 #include "third_party/WebKit/public/web/WebView.h" 21 #include "third_party/WebKit/public/web/WebView.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 void WebHelperPluginDeleter::operator()(blink::WebHelperPlugin* plugin) const { 25 void WebHelperPluginDeleter::operator()(blink::WebHelperPlugin* plugin) const {
25 plugin->destroy(); 26 plugin->destroy();
26 } 27 }
27 28
28 scoped_ptr<PepperCdmWrapper> PepperCdmWrapperImpl::Create( 29 scoped_ptr<PepperCdmWrapper> PepperCdmWrapperImpl::Create(
29 blink::WebLocalFrame* frame, 30 blink::WebLocalFrame* frame,
30 const std::string& pluginType, 31 const std::string& pluginType,
31 const GURL& security_origin) { 32 const GURL& security_origin) {
32 DCHECK(frame); 33 DCHECK(frame);
33 34
34 // The frame security origin could be different from the origin where the CDM 35 // The frame security origin could be different from the origin where the CDM
35 // creation was initiated, e.g. due to navigation. 36 // creation was initiated, e.g. due to navigation.
36 // Note: The code will continue after navigation to the "same" origin, even 37 // Note: The code will continue after navigation to the "same" origin, even
37 // though the CDM is no longer necessary. 38 // though the CDM is no longer necessary.
38 // TODO: Consider avoiding this possibility entirely. http://crbug.com/575236 39 // TODO: Consider avoiding this possibility entirely. http://crbug.com/575236
39 GURL frame_security_origin(frame->securityOrigin().toString()); 40 GURL frame_security_origin(
41 blink::WebStringToGURL(frame->securityOrigin().toString()));
40 if (frame_security_origin != security_origin) { 42 if (frame_security_origin != security_origin) {
41 LOG(ERROR) << "Frame has a different origin than the EME call."; 43 LOG(ERROR) << "Frame has a different origin than the EME call.";
42 return scoped_ptr<PepperCdmWrapper>(); 44 return scoped_ptr<PepperCdmWrapper>();
43 } 45 }
44 46
45 ScopedHelperPlugin helper_plugin(blink::WebHelperPlugin::create( 47 ScopedHelperPlugin helper_plugin(blink::WebHelperPlugin::create(
46 blink::WebString::fromUTF8(pluginType), frame)); 48 blink::WebString::fromUTF8(pluginType), frame));
47 if (!helper_plugin) 49 if (!helper_plugin)
48 return scoped_ptr<PepperCdmWrapper>(); 50 return scoped_ptr<PepperCdmWrapper>();
49 51
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 helper_plugin_.reset(); 88 helper_plugin_.reset();
87 } 89 }
88 90
89 ContentDecryptorDelegate* PepperCdmWrapperImpl::GetCdmDelegate() { 91 ContentDecryptorDelegate* PepperCdmWrapperImpl::GetCdmDelegate() {
90 return plugin_instance_->GetContentDecryptorDelegate(); 92 return plugin_instance_->GetContentDecryptorDelegate();
91 } 93 }
92 94
93 } // namespace content 95 } // namespace content
94 96
95 #endif // defined(ENABLE_PEPPER_CDMS) 97 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698