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

Side by Side Diff: Source/bindings/v8/V8NPObject.cpp

Issue 23537048: Reduce usage of v8::Isolate::GetCurrent() in NPV8Object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | « Source/bindings/v8/ScriptController.cpp ('k') | Source/bindings/v8/V8NPUtils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (!npObject || !_NPN_IsAlive(npObject)) { 104 if (!npObject || !_NPN_IsAlive(npObject)) {
105 throwError(v8ReferenceError, "NPObject deleted", args.GetIsolate()); 105 throwError(v8ReferenceError, "NPObject deleted", args.GetIsolate());
106 return; 106 return;
107 } 107 }
108 108
109 // Wrap up parameters. 109 // Wrap up parameters.
110 int numArgs = args.Length(); 110 int numArgs = args.Length();
111 OwnArrayPtr<NPVariant> npArgs = adoptArrayPtr(new NPVariant[numArgs]); 111 OwnArrayPtr<NPVariant> npArgs = adoptArrayPtr(new NPVariant[numArgs]);
112 112
113 for (int i = 0; i < numArgs; i++) 113 for (int i = 0; i < numArgs; i++)
114 convertV8ObjectToNPVariant(args[i], npObject, &npArgs[i]); 114 convertV8ObjectToNPVariant(args[i], npObject, &npArgs[i], args.GetIsolat e());
115 115
116 NPVariant result; 116 NPVariant result;
117 VOID_TO_NPVARIANT(result); 117 VOID_TO_NPVARIANT(result);
118 118
119 bool retval = true; 119 bool retval = true;
120 switch (functionId) { 120 switch (functionId) {
121 case InvokeMethod: 121 case InvokeMethod:
122 if (npObject->_class->invoke) { 122 if (npObject->_class->invoke) {
123 v8::Handle<v8::String> functionName = v8::Handle<v8::String>::Cast(a rgs.Data()); 123 v8::Handle<v8::String> functionName = v8::Handle<v8::String>::Cast(a rgs.Data());
124 NPIdentifier identifier = getStringIdentifier(functionName); 124 NPIdentifier identifier = getStringIdentifier(functionName);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 throwError(v8ReferenceError, "NPObject deleted", isolate); 313 throwError(v8ReferenceError, "NPObject deleted", isolate);
314 return value; // Intercepted, but an exception was thrown. 314 return value; // Intercepted, but an exception was thrown.
315 } 315 }
316 316
317 if (npObject->_class->hasProperty && npObject->_class->setProperty && npObje ct->_class->hasProperty(npObject, identifier)) { 317 if (npObject->_class->hasProperty && npObject->_class->setProperty && npObje ct->_class->hasProperty(npObject, identifier)) {
318 if (!_NPN_IsAlive(npObject)) 318 if (!_NPN_IsAlive(npObject))
319 return throwError(v8ReferenceError, "NPObject deleted", isolate); 319 return throwError(v8ReferenceError, "NPObject deleted", isolate);
320 320
321 NPVariant npValue; 321 NPVariant npValue;
322 VOID_TO_NPVARIANT(npValue); 322 VOID_TO_NPVARIANT(npValue);
323 convertV8ObjectToNPVariant(value, npObject, &npValue); 323 convertV8ObjectToNPVariant(value, npObject, &npValue, isolate);
324 bool success = npObject->_class->setProperty(npObject, identifier, &npVa lue); 324 bool success = npObject->_class->setProperty(npObject, identifier, &npVa lue);
325 _NPN_ReleaseVariantValue(&npValue); 325 _NPN_ReleaseVariantValue(&npValue);
326 if (success) 326 if (success)
327 return value; // Intercept the call. 327 return value; // Intercept the call.
328 } 328 }
329 return v8Undefined(); 329 return v8Undefined();
330 } 330 }
331 331
332 332
333 void npObjectNamedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value > value, const v8::PropertyCallbackInfo<v8::Value>& info) 333 void npObjectNamedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value > value, const v8::PropertyCallbackInfo<v8::Value>& info)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 v8::HandleScope scope(isolate); 470 v8::HandleScope scope(isolate);
471 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e); 471 v8::Handle<v8::Object> wrapper = staticNPObjectMap().newLocal(object, isolat e);
472 if (!wrapper.IsEmpty()) { 472 if (!wrapper.IsEmpty()) {
473 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo()); 473 V8DOMWrapper::clearNativeInfo(wrapper, npObjectTypeInfo());
474 staticNPObjectMap().removeAndDispose(object); 474 staticNPObjectMap().removeAndDispose(object);
475 _NPN_ReleaseObject(object); 475 _NPN_ReleaseObject(object);
476 } 476 }
477 } 477 }
478 478
479 } // namespace WebCore 479 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptController.cpp ('k') | Source/bindings/v8/V8NPUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698