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

Side by Side Diff: webkit/plugins/ppapi/ppapi_webplugin_impl.cc

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_buffer_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 5 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 bool WebPluginImpl::initialize(WebPluginContainer* container) { 85 bool WebPluginImpl::initialize(WebPluginContainer* container) {
86 // The plugin delegate may have gone away. 86 // The plugin delegate may have gone away.
87 if (!init_data_->delegate) 87 if (!init_data_->delegate)
88 return false; 88 return false;
89 89
90 instance_ = init_data_->module->CreateInstance(init_data_->delegate, 90 instance_ = init_data_->module->CreateInstance(init_data_->delegate,
91 container, 91 container,
92 init_data_->url); 92 init_data_->url);
93 if (!instance_) 93 if (!instance_.get())
94 return false; 94 return false;
95 95
96 // Enable script objects for this plugin. 96 // Enable script objects for this plugin.
97 container->allowScriptObjects(); 97 container->allowScriptObjects();
98 98
99 bool success = instance_->Initialize(init_data_->arg_names, 99 bool success = instance_->Initialize(init_data_->arg_names,
100 init_data_->arg_values, 100 init_data_->arg_values,
101 full_frame_); 101 full_frame_);
102 if (!success) { 102 if (!success) {
103 instance_->Delete(); 103 instance_->Delete();
(...skipping 12 matching lines...) Expand all
116 init_data_.reset(); 116 init_data_.reset();
117 container_ = container; 117 container_ = container;
118 return true; 118 return true;
119 } 119 }
120 120
121 void WebPluginImpl::destroy() { 121 void WebPluginImpl::destroy() {
122 // Tell |container_| to clear references to this plugin's script objects. 122 // Tell |container_| to clear references to this plugin's script objects.
123 if (container_) 123 if (container_)
124 container_->clearScriptObjects(); 124 container_->clearScriptObjects();
125 125
126 if (instance_) { 126 if (instance_.get()) {
127 ::ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_); 127 ::ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(instance_object_);
128 instance_object_ = PP_MakeUndefined(); 128 instance_object_ = PP_MakeUndefined();
129 instance_->Delete(); 129 instance_->Delete();
130 instance_ = NULL; 130 instance_ = NULL;
131 } 131 }
132 132
133 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 133 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
134 } 134 }
135 135
136 NPObject* WebPluginImpl::scriptableObject() { 136 NPObject* WebPluginImpl::scriptableObject() {
137 // Call through the plugin to get its instance object. The plugin should pass 137 // Call through the plugin to get its instance object. The plugin should pass
138 // us a reference which we release in destroy(). 138 // us a reference which we release in destroy().
139 if (instance_object_.type == PP_VARTYPE_UNDEFINED) 139 if (instance_object_.type == PP_VARTYPE_UNDEFINED)
140 instance_object_ = instance_->GetInstanceObject(); 140 instance_object_ = instance_->GetInstanceObject();
141 // GetInstanceObject talked to the plugin which may have removed the instance 141 // GetInstanceObject talked to the plugin which may have removed the instance
142 // from the DOM, in which case instance_ would be NULL now. 142 // from the DOM, in which case instance_ would be NULL now.
143 if (!instance_) 143 if (!instance_.get())
144 return NULL; 144 return NULL;
145 145
146 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(instance_object_)); 146 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(instance_object_));
147 // If there's an InstanceObject, tell the Instance's MessageChannel to pass 147 // If there's an InstanceObject, tell the Instance's MessageChannel to pass
148 // any non-postMessage calls to it. 148 // any non-postMessage calls to it.
149 if (object) { 149 if (object.get()) {
150 instance_->message_channel().SetPassthroughObject(object->np_object()); 150 instance_->message_channel().SetPassthroughObject(object->np_object());
151 } 151 }
152 NPObject* message_channel_np_object(instance_->message_channel().np_object()); 152 NPObject* message_channel_np_object(instance_->message_channel().np_object());
153 // The object is expected to be retained before it is returned. 153 // The object is expected to be retained before it is returned.
154 WebKit::WebBindings::retainObject(message_channel_np_object); 154 WebKit::WebBindings::retainObject(message_channel_np_object);
155 return message_channel_np_object; 155 return message_channel_np_object;
156 } 156 }
157 157
158 NPP WebPluginImpl::pluginNPP() { 158 NPP WebPluginImpl::pluginNPP() {
159 return instance_->instanceNPP(); 159 return instance_->instanceNPP();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 void WebPluginImpl::rotateView(RotationType type) { 296 void WebPluginImpl::rotateView(RotationType type) {
297 instance_->RotateView(type); 297 instance_->RotateView(type);
298 } 298 }
299 299
300 bool WebPluginImpl::isPlaceholder() { 300 bool WebPluginImpl::isPlaceholder() {
301 return false; 301 return false;
302 } 302 }
303 303
304 } // namespace ppapi 304 } // namespace ppapi
305 } // namespace webkit 305 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698