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(NULL, const_cast<NPClass*>(&wrapper_class))); | 301 WebBindings::createObject(instance->instanceNPP(), |
| 302 const_cast<NPClass*>(&wrapper_class))); |
302 | 303 |
303 // This object will register itself both with the NPObject and with the | 304 // This object will register itself both with the NPObject and with the |
304 // PluginModule. The NPObject will normally handle its lifetime, and it | 305 // PluginModule. The NPObject will normally handle its lifetime, and it |
305 // will get deleted in the destroy method. It may also get deleted when the | 306 // will get deleted in the destroy method. It may also get deleted when the |
306 // plugin module is deallocated. | 307 // plugin module is deallocated. |
307 new PluginObject(instance, wrapper, ppp_class, ppp_class_data); | 308 new PluginObject(instance, wrapper, ppp_class, ppp_class_data); |
308 | 309 |
309 // We can just use a normal ObjectVar to refer to this object from the | 310 // We can just use a normal ObjectVar to refer to this object from the |
310 // plugin. It will hold a ref to the underlying NPObject which will in turn | 311 // plugin. It will hold a ref to the underlying NPObject which will in turn |
311 // hold our pluginObject. | 312 // hold our pluginObject. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // static | 352 // static |
352 NPObject* PluginObject::AllocateObjectWrapper() { | 353 NPObject* PluginObject::AllocateObjectWrapper() { |
353 NPObjectWrapper* wrapper = new NPObjectWrapper; | 354 NPObjectWrapper* wrapper = new NPObjectWrapper; |
354 memset(wrapper, 0, sizeof(NPObjectWrapper)); | 355 memset(wrapper, 0, sizeof(NPObjectWrapper)); |
355 return wrapper; | 356 return wrapper; |
356 } | 357 } |
357 | 358 |
358 } // namespace ppapi | 359 } // namespace ppapi |
359 } // namespace webkit | 360 } // namespace webkit |
360 | 361 |
OLD | NEW |