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

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

Issue 480233007: Remove implicit conversions from scoped_refptr to T* in content/renderer/media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | content/renderer/media/media_stream.cc » ('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 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/crypto/pepper_cdm_wrapper_impl.h" 6 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h"
7 7
8 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 8 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
9 #include "content/renderer/pepper/pepper_webplugin_impl.h" 9 #include "content/renderer/pepper/pepper_webplugin_impl.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 10 #include "third_party/WebKit/public/platform/WebString.h"
(...skipping 21 matching lines...) Expand all
32 if (!helper_plugin) 32 if (!helper_plugin)
33 return scoped_ptr<PepperCdmWrapper>(); 33 return scoped_ptr<PepperCdmWrapper>();
34 34
35 blink::WebPlugin* plugin = helper_plugin->getPlugin(); 35 blink::WebPlugin* plugin = helper_plugin->getPlugin();
36 DCHECK(!plugin->isPlaceholder()); // Prevented by Blink. 36 DCHECK(!plugin->isPlaceholder()); // Prevented by Blink.
37 37
38 // Only Pepper plugins are supported, so it must ultimately be a ppapi object. 38 // Only Pepper plugins are supported, so it must ultimately be a ppapi object.
39 PepperWebPluginImpl* ppapi_plugin = static_cast<PepperWebPluginImpl*>(plugin); 39 PepperWebPluginImpl* ppapi_plugin = static_cast<PepperWebPluginImpl*>(plugin);
40 scoped_refptr<PepperPluginInstanceImpl> plugin_instance = 40 scoped_refptr<PepperPluginInstanceImpl> plugin_instance =
41 ppapi_plugin->instance(); 41 ppapi_plugin->instance();
42 if (!plugin_instance) 42 if (!plugin_instance.get())
43 return scoped_ptr<PepperCdmWrapper>(); 43 return scoped_ptr<PepperCdmWrapper>();
44 44
45 GURL url(plugin_instance->container()->element().document().url()); 45 GURL url(plugin_instance->container()->element().document().url());
46 CHECK_EQ(security_origin.GetOrigin(), url.GetOrigin()) 46 CHECK_EQ(security_origin.GetOrigin(), url.GetOrigin())
47 << "Pepper instance has a different origin than the EME call."; 47 << "Pepper instance has a different origin than the EME call.";
48 48
49 if (!plugin_instance->GetContentDecryptorDelegate()) 49 if (!plugin_instance->GetContentDecryptorDelegate())
50 return scoped_ptr<PepperCdmWrapper>(); 50 return scoped_ptr<PepperCdmWrapper>();
51 51
52 return scoped_ptr<PepperCdmWrapper>( 52 return scoped_ptr<PepperCdmWrapper>(
53 new PepperCdmWrapperImpl(helper_plugin.Pass(), plugin_instance)); 53 new PepperCdmWrapperImpl(helper_plugin.Pass(), plugin_instance));
54 } 54 }
55 55
56 PepperCdmWrapperImpl::PepperCdmWrapperImpl( 56 PepperCdmWrapperImpl::PepperCdmWrapperImpl(
57 ScopedHelperPlugin helper_plugin, 57 ScopedHelperPlugin helper_plugin,
58 const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance) 58 const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance)
59 : helper_plugin_(helper_plugin.Pass()), 59 : helper_plugin_(helper_plugin.Pass()),
60 plugin_instance_(plugin_instance) { 60 plugin_instance_(plugin_instance) {
61 DCHECK(helper_plugin_); 61 DCHECK(helper_plugin_);
62 DCHECK(plugin_instance_); 62 DCHECK(plugin_instance_.get());
63 // Plugin must be a CDM. 63 // Plugin must be a CDM.
64 DCHECK(plugin_instance_->GetContentDecryptorDelegate()); 64 DCHECK(plugin_instance_->GetContentDecryptorDelegate());
65 } 65 }
66 66
67 PepperCdmWrapperImpl::~PepperCdmWrapperImpl() { 67 PepperCdmWrapperImpl::~PepperCdmWrapperImpl() {
68 // Destroy the nested objects in reverse order. 68 // Destroy the nested objects in reverse order.
69 plugin_instance_ = NULL; 69 plugin_instance_ = NULL;
70 helper_plugin_.reset(); 70 helper_plugin_.reset();
71 } 71 }
72 72
73 ContentDecryptorDelegate* PepperCdmWrapperImpl::GetCdmDelegate() { 73 ContentDecryptorDelegate* PepperCdmWrapperImpl::GetCdmDelegate() {
74 return plugin_instance_->GetContentDecryptorDelegate(); 74 return plugin_instance_->GetContentDecryptorDelegate();
75 } 75 }
76 76
77 } // namespace content 77 } // namespace content
78 78
79 #endif // defined(ENABLE_PEPPER_CDMS) 79 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698