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

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

Issue 8098001: Fix a crash in the renderer process which occurs in the PPAPI host code due to the underlying plugin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 | « ppapi/proxy/host_dispatcher.cc ('k') | no next file » | 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) 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_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 NPVariant* result) { 70 NPVariant* result) {
71 NPObjectAccessorWithIdentifier accessor(object, method_name, false); 71 NPObjectAccessorWithIdentifier accessor(object, method_name, false);
72 if (!accessor.is_valid()) 72 if (!accessor.is_valid())
73 return false; 73 return false;
74 74
75 PPResultAndExceptionToNPResult result_converter( 75 PPResultAndExceptionToNPResult result_converter(
76 accessor.object()->GetNPObject(), result); 76 accessor.object()->GetNPObject(), result);
77 PPVarArrayFromNPVariantArray args(accessor.object()->instance(), 77 PPVarArrayFromNPVariantArray args(accessor.object()->instance(),
78 argc, argv); 78 argc, argv);
79 79
80 // For the OOP plugin case we need to grab a reference on the plugin module
81 // object to ensure that it is not destroyed courtsey an incoming
82 // ExecuteScript call which destroys the plugin module and in turn the
83 // dispatcher.
84 scoped_refptr<webkit::ppapi::PluginModule> ref(
85 accessor.object()->instance()->module());
86
80 return result_converter.SetResult(accessor.object()->ppp_class()->Call( 87 return result_converter.SetResult(accessor.object()->ppp_class()->Call(
81 accessor.object()->ppp_class_data(), accessor.identifier(), 88 accessor.object()->ppp_class_data(), accessor.identifier(),
82 argc, args.array(), result_converter.exception())); 89 argc, args.array(), result_converter.exception()));
83 } 90 }
84 91
85 bool WrapperClass_InvokeDefault(NPObject* np_object, const NPVariant* argv, 92 bool WrapperClass_InvokeDefault(NPObject* np_object, const NPVariant* argv,
86 uint32_t argc, NPVariant* result) { 93 uint32_t argc, NPVariant* result) {
87 PluginObject* obj = PluginObject::FromNPObject(np_object); 94 PluginObject* obj = PluginObject::FromNPObject(np_object);
88 if (!obj) 95 if (!obj)
89 return false; 96 return false;
90 97
91 PPVarArrayFromNPVariantArray args(obj->instance(), argc, argv); 98 PPVarArrayFromNPVariantArray args(obj->instance(), argc, argv);
92 PPResultAndExceptionToNPResult result_converter(obj->GetNPObject(), result); 99 PPResultAndExceptionToNPResult result_converter(obj->GetNPObject(), result);
93 100
101 // For the OOP plugin case we need to grab a reference on the plugin module
102 // object to ensure that it is not destroyed courtsey an incoming
103 // ExecuteScript call which destroys the plugin module and in turn the
104 // dispatcher.
105 scoped_refptr<webkit::ppapi::PluginModule> ref(
106 obj->instance()->module());
107
94 result_converter.SetResult(obj->ppp_class()->Call( 108 result_converter.SetResult(obj->ppp_class()->Call(
95 obj->ppp_class_data(), PP_MakeUndefined(), argc, args.array(), 109 obj->ppp_class_data(), PP_MakeUndefined(), argc, args.array(),
96 result_converter.exception())); 110 result_converter.exception()));
97 return result_converter.success(); 111 return result_converter.success();
98 } 112 }
99 113
100 bool WrapperClass_HasProperty(NPObject* object, NPIdentifier property_name) { 114 bool WrapperClass_HasProperty(NPObject* object, NPIdentifier property_name) {
101 NPObjectAccessorWithIdentifier accessor(object, property_name, true); 115 NPObjectAccessorWithIdentifier accessor(object, property_name, true);
102 if (!accessor.is_valid()) 116 if (!accessor.is_valid())
103 return false; 117 return false;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // static 348 // static
335 NPObject* PluginObject::AllocateObjectWrapper() { 349 NPObject* PluginObject::AllocateObjectWrapper() {
336 NPObjectWrapper* wrapper = new NPObjectWrapper; 350 NPObjectWrapper* wrapper = new NPObjectWrapper;
337 memset(wrapper, 0, sizeof(NPObjectWrapper)); 351 memset(wrapper, 0, sizeof(NPObjectWrapper));
338 return wrapper; 352 return wrapper;
339 } 353 }
340 354
341 } // namespace ppapi 355 } // namespace ppapi
342 } // namespace webkit 356 } // namespace webkit
343 357
OLDNEW
« no previous file with comments | « ppapi/proxy/host_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698