OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugin_object.h" | 5 #include "webkit/plugins/ppapi/plugin_object.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 instance_->RemovePluginObject(this); | 291 instance_->RemovePluginObject(this); |
292 } | 292 } |
293 | 293 |
294 PP_Var PluginObject::Create(PluginInstance* instance, | 294 PP_Var PluginObject::Create(PluginInstance* instance, |
295 const PPP_Class_Deprecated* ppp_class, | 295 const PPP_Class_Deprecated* ppp_class, |
296 void* ppp_class_data) { | 296 void* ppp_class_data) { |
297 // This will internally end up calling our AllocateObjectWrapper via the | 297 // This will internally end up calling our AllocateObjectWrapper via the |
298 // WrapperClass_Allocated function which will have created an object wrapper | 298 // WrapperClass_Allocated function which will have created an object wrapper |
299 // appropriate for this class (derived from NPObject). | 299 // appropriate for this class (derived from NPObject). |
300 NPObjectWrapper* wrapper = static_cast<NPObjectWrapper*>( | 300 NPObjectWrapper* wrapper = static_cast<NPObjectWrapper*>( |
301 WebBindings::createObject(instance->instanceNPP(), | 301 WebBindings::createObject(NULL, const_cast<NPClass*>(&wrapper_class))); |
302 const_cast<NPClass*>(&wrapper_class))); | |
303 | 302 |
304 // This object will register itself both with the NPObject and with the | 303 // This object will register itself both with the NPObject and with the |
305 // PluginModule. The NPObject will normally handle its lifetime, and it | 304 // PluginModule. The NPObject will normally handle its lifetime, and it |
306 // will get deleted in the destroy method. It may also get deleted when the | 305 // will get deleted in the destroy method. It may also get deleted when the |
307 // plugin module is deallocated. | 306 // plugin module is deallocated. |
308 new PluginObject(instance, wrapper, ppp_class, ppp_class_data); | 307 new PluginObject(instance, wrapper, ppp_class, ppp_class_data); |
309 | 308 |
310 // We can just use a normal ObjectVar to refer to this object from the | 309 // We can just use a normal ObjectVar to refer to this object from the |
311 // plugin. It will hold a ref to the underlying NPObject which will in turn | 310 // plugin. It will hold a ref to the underlying NPObject which will in turn |
312 // hold our pluginObject. | 311 // hold our pluginObject. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // static | 351 // static |
353 NPObject* PluginObject::AllocateObjectWrapper() { | 352 NPObject* PluginObject::AllocateObjectWrapper() { |
354 NPObjectWrapper* wrapper = new NPObjectWrapper; | 353 NPObjectWrapper* wrapper = new NPObjectWrapper; |
355 memset(wrapper, 0, sizeof(NPObjectWrapper)); | 354 memset(wrapper, 0, sizeof(NPObjectWrapper)); |
356 return wrapper; | 355 return wrapper; |
357 } | 356 } |
358 | 357 |
359 } // namespace ppapi | 358 } // namespace ppapi |
360 } // namespace webkit | 359 } // namespace webkit |
361 | 360 |
OLD | NEW |