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

Unified Diff: Source/bindings/v8/NPV8Object.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/NPV8Object.h ('k') | Source/bindings/v8/ScriptController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/NPV8Object.cpp
diff --git a/Source/bindings/v8/NPV8Object.cpp b/Source/bindings/v8/NPV8Object.cpp
index ec367e1e1f1a21df25ffff5ed0ead8505b4ce020..ef02215cd046f144932cc0e6ab4d8f04fd8e2f2d 100644
--- a/Source/bindings/v8/NPV8Object.cpp
+++ b/Source/bindings/v8/NPV8Object.cpp
@@ -66,7 +66,7 @@ static NPObject* allocV8NPObject(NPP, NPClass*)
static void freeV8NPObject(NPObject* npObject)
{
V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
- disposeUnderlyingV8Object(npObject);
+ disposeUnderlyingV8Object(npObject, v8::Isolate::GetCurrent());
free(v8NpObject);
}
@@ -114,7 +114,7 @@ NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object)
return reinterpret_cast<NPObject*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
-NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWindow* root)
+NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWindow* root, v8::Isolate* isolate)
{
// Check to see if this object is already wrapped.
if (object->InternalFieldCount() == npObjectInternalFieldCount) {
@@ -151,7 +151,7 @@ NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWind
// This is uninitialized memory, we need to clear it so that
// Persistent::Reset won't try to Dispose anything bogus.
v8npObject->v8Object.Clear();
- v8npObject->v8Object.Reset(v8::Isolate::GetCurrent(), object);
+ v8npObject->v8Object.Reset(isolate, object);
v8npObject->rootObject = root;
if (objectVector)
@@ -170,13 +170,12 @@ V8NPObject* npObjectToV8NPObject(NPObject* npObject)
return v8NpObject;
}
-void disposeUnderlyingV8Object(NPObject* npObject)
+void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate)
{
ASSERT(npObject);
V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
if (!v8NpObject)
return;
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NpObject->v8Object);
ASSERT(!v8Object->CreationContext().IsEmpty());
@@ -265,7 +264,7 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV
if (resultObject.IsEmpty())
return false;
- convertV8ObjectToNPVariant(resultObject, npObject, result);
+ convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
return true;
}
@@ -315,7 +314,7 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
if (resultObject.IsEmpty())
return false;
- convertV8ObjectToNPVariant(resultObject, npObject, result);
+ convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
return true;
}
@@ -336,7 +335,8 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
if (!v8NpObject)
return false;
- v8::HandleScope handleScope(v8::Isolate::GetCurrent());
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::HandleScope handleScope(isolate);
v8::Handle<v8::Context> context = toV8Context(npp, npObject);
if (context.IsEmpty())
return false;
@@ -361,7 +361,7 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
return false;
if (_NPN_IsAlive(npObject))
- convertV8ObjectToNPVariant(v8result, npObject, result);
+ convertV8ObjectToNPVariant(v8result, npObject, result, isolate);
return true;
}
@@ -386,7 +386,7 @@ bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NP
if (v8result.IsEmpty())
return false;
- convertV8ObjectToNPVariant(v8result, npObject, result);
+ convertV8ObjectToNPVariant(v8result, npObject, result, isolate);
return true;
}
@@ -603,7 +603,7 @@ bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uin
if (resultObject.IsEmpty())
return false;
- convertV8ObjectToNPVariant(resultObject, npObject, result);
+ convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
return true;
}
« no previous file with comments | « Source/bindings/v8/NPV8Object.h ('k') | Source/bindings/v8/ScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698