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

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

Issue 8342016: Revert 106142 - Add a new globals object for PPAPI tracking information. (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 | « webkit/plugins/ppapi/plugin_module.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/ppapi/plugin_object.cc:r3734-4217,4606-5108,5177-5263
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "third_party/npapi/bindings/npapi.h" 12 #include "third_party/npapi/bindings/npapi.h"
13 #include "third_party/npapi/bindings/npruntime.h" 13 #include "third_party/npapi/bindings/npruntime.h"
14 #include "ppapi/c/dev/ppb_var_deprecated.h" 14 #include "ppapi/c/dev/ppb_var_deprecated.h"
15 #include "ppapi/c/dev/ppp_class_deprecated.h" 15 #include "ppapi/c/dev/ppp_class_deprecated.h"
16 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_var.h" 17 #include "ppapi/c/pp_var.h"
18 #include "ppapi/shared_impl/ppapi_globals.h"
19 #include "ppapi/shared_impl/var.h" 18 #include "ppapi/shared_impl/var.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
21 #include "webkit/plugins/ppapi/npapi_glue.h" 20 #include "webkit/plugins/ppapi/npapi_glue.h"
22 #include "webkit/plugins/ppapi/plugin_module.h" 21 #include "webkit/plugins/ppapi/plugin_module.h"
23 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 22 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
24 #include "webkit/plugins/ppapi/resource_tracker.h" 23 #include "webkit/plugins/ppapi/resource_tracker.h"
25 #include "webkit/plugins/ppapi/string.h" 24 #include "webkit/plugins/ppapi/string.h"
26 25
27 using ppapi::PpapiGlobals;
28 using ppapi::StringVar; 26 using ppapi::StringVar;
29 using ppapi::Var; 27 using ppapi::Var;
30 using WebKit::WebBindings; 28 using WebKit::WebBindings;
31 29
32 namespace webkit { 30 namespace webkit {
33 namespace ppapi { 31 namespace ppapi {
34 32
35 namespace { 33 namespace {
36 34
37 const char kInvalidValueException[] = "Error: Invalid value"; 35 const char kInvalidValueException[] = "Error: Invalid value";
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 NPObjectAccessorWithIdentifier accessor(object, property_name, true); 143 NPObjectAccessorWithIdentifier accessor(object, property_name, true);
146 if (!accessor.is_valid()) 144 if (!accessor.is_valid())
147 return false; 145 return false;
148 146
149 PPResultAndExceptionToNPResult result_converter( 147 PPResultAndExceptionToNPResult result_converter(
150 accessor.object()->GetNPObject(), NULL); 148 accessor.object()->GetNPObject(), NULL);
151 PP_Var value_var = NPVariantToPPVar(accessor.object()->instance(), value); 149 PP_Var value_var = NPVariantToPPVar(accessor.object()->instance(), value);
152 accessor.object()->ppp_class()->SetProperty( 150 accessor.object()->ppp_class()->SetProperty(
153 accessor.object()->ppp_class_data(), accessor.identifier(), value_var, 151 accessor.object()->ppp_class_data(), accessor.identifier(), value_var,
154 result_converter.exception()); 152 result_converter.exception());
155 PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(value_var); 153 ResourceTracker::Get()->GetVarTracker()->ReleaseVar(value_var);
156 return result_converter.CheckExceptionForNoResult(); 154 return result_converter.CheckExceptionForNoResult();
157 } 155 }
158 156
159 bool WrapperClass_RemoveProperty(NPObject* object, NPIdentifier property_name) { 157 bool WrapperClass_RemoveProperty(NPObject* object, NPIdentifier property_name) {
160 NPObjectAccessorWithIdentifier accessor(object, property_name, true); 158 NPObjectAccessorWithIdentifier accessor(object, property_name, true);
161 if (!accessor.is_valid()) 159 if (!accessor.is_valid())
162 return false; 160 return false;
163 161
164 PPResultAndExceptionToNPResult result_converter( 162 PPResultAndExceptionToNPResult result_converter(
165 accessor.object()->GetNPObject(), NULL); 163 accessor.object()->GetNPObject(), NULL);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 208 }
211 } 209 }
212 } 210 }
213 211
214 // This will actually throw the exception, either from GetAllPropertyNames, 212 // This will actually throw the exception, either from GetAllPropertyNames,
215 // or if anything was set during the conversion process. 213 // or if anything was set during the conversion process.
216 result_converter.CheckExceptionForNoResult(); 214 result_converter.CheckExceptionForNoResult();
217 215
218 // Release the PP_Var that the plugin allocated. On success, they will all 216 // Release the PP_Var that the plugin allocated. On success, they will all
219 // be converted to NPVariants, and on failure, we want them to just go away. 217 // be converted to NPVariants, and on failure, we want them to just go away.
220 ::ppapi::VarTracker* var_tracker = PpapiGlobals::Get()->GetVarTracker(); 218 ::ppapi::VarTracker* var_tracker = ResourceTracker::Get()->GetVarTracker();
221 for (uint32_t i = 0; i < property_count; ++i) 219 for (uint32_t i = 0; i < property_count; ++i)
222 var_tracker->ReleaseVar(properties[i]); 220 var_tracker->ReleaseVar(properties[i]);
223 free(properties); 221 free(properties);
224 return result_converter.success(); 222 return result_converter.success();
225 } 223 }
226 224
227 bool WrapperClass_Construct(NPObject* object, const NPVariant* argv, 225 bool WrapperClass_Construct(NPObject* object, const NPVariant* argv,
228 uint32_t argc, NPVariant* result) { 226 uint32_t argc, NPVariant* result) {
229 PluginObject* obj = PluginObject::FromNPObject(object); 227 PluginObject* obj = PluginObject::FromNPObject(object);
230 if (!obj) 228 if (!obj)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // static 348 // static
351 NPObject* PluginObject::AllocateObjectWrapper() { 349 NPObject* PluginObject::AllocateObjectWrapper() {
352 NPObjectWrapper* wrapper = new NPObjectWrapper; 350 NPObjectWrapper* wrapper = new NPObjectWrapper;
353 memset(wrapper, 0, sizeof(NPObjectWrapper)); 351 memset(wrapper, 0, sizeof(NPObjectWrapper));
354 return wrapper; 352 return wrapper;
355 } 353 }
356 354
357 } // namespace ppapi 355 } // namespace ppapi
358 } // namespace webkit 356 } // namespace webkit
359 357
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698