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

Side by Side Diff: Source/bindings/core/v8/NPV8Object.cpp

Issue 667583003: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Created 6 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
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.h ('k') | Source/bindings/core/v8/PageScriptDebugServer.cpp » ('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) 2004, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // FIXME: Comments on why use malloc and free. 69 // FIXME: Comments on why use malloc and free.
70 static NPObject* allocV8NPObject(NPP, NPClass*) 70 static NPObject* allocV8NPObject(NPP, NPClass*)
71 { 71 {
72 return static_cast<NPObject*>(malloc(sizeof(V8NPObject))); 72 return static_cast<NPObject*>(malloc(sizeof(V8NPObject)));
73 } 73 }
74 74
75 static void freeV8NPObject(NPObject* npObject) 75 static void freeV8NPObject(NPObject* npObject)
76 { 76 {
77 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); 77 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
78 disposeUnderlyingV8Object(npObject, v8::Isolate::GetCurrent()); 78 disposeUnderlyingV8Object(v8::Isolate::GetCurrent(), npObject);
79 free(v8NpObject); 79 free(v8NpObject);
80 } 80 }
81 81
82 static NPClass V8NPObjectClass = { 82 static NPClass V8NPObjectClass = {
83 NP_CLASS_STRUCT_VERSION, 83 NP_CLASS_STRUCT_VERSION,
84 allocV8NPObject, 84 allocV8NPObject,
85 freeV8NPObject, 85 freeV8NPObject,
86 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 86 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
87 }; 87 };
88 88
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 bool isWrappedNPObject(v8::Handle<v8::Object> object) 128 bool isWrappedNPObject(v8::Handle<v8::Object> object)
129 { 129 {
130 if (object->InternalFieldCount() == npObjectInternalFieldCount) { 130 if (object->InternalFieldCount() == npObjectInternalFieldCount) {
131 const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(ob ject->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex)); 131 const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(ob ject->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex));
132 return typeInfo == npObjectTypeInfo(); 132 return typeInfo == npObjectTypeInfo();
133 } 133 }
134 return false; 134 return false;
135 } 135 }
136 136
137 NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, LocalDO MWindow* root, v8::Isolate* isolate) 137 NPObject* npCreateV8ScriptObject(v8::Isolate* isolate, NPP npp, v8::Handle<v8::O bject> object, LocalDOMWindow* root)
138 { 138 {
139 // Check to see if this object is already wrapped. 139 // Check to see if this object is already wrapped.
140 if (isWrappedNPObject(object)) { 140 if (isWrappedNPObject(object)) {
141 NPObject* returnValue = v8ObjectToNPObject(object); 141 NPObject* returnValue = v8ObjectToNPObject(object);
142 _NPN_RetainObject(returnValue); 142 _NPN_RetainObject(returnValue);
143 return returnValue; 143 return returnValue;
144 } 144 }
145 145
146 V8NPObjectVector* objectVector = 0; 146 V8NPObjectVector* objectVector = 0;
147 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati onContext())) { 147 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati onContext())) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (v8NpObject->v8Object.IsEmpty()) 185 if (v8NpObject->v8Object.IsEmpty())
186 return 0; 186 return 0;
187 return v8NpObject; 187 return v8NpObject;
188 } 188 }
189 189
190 ScriptWrappableBase* npObjectToScriptWrappableBase(NPObject* npObject) 190 ScriptWrappableBase* npObjectToScriptWrappableBase(NPObject* npObject)
191 { 191 {
192 return reinterpret_cast<ScriptWrappableBase*>(npObject); 192 return reinterpret_cast<ScriptWrappableBase*>(npObject);
193 } 193 }
194 194
195 void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate) 195 void disposeUnderlyingV8Object(v8::Isolate* isolate, NPObject* npObject)
196 { 196 {
197 ASSERT(npObject); 197 ASSERT(npObject);
198 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); 198 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
199 if (!v8NpObject) 199 if (!v8NpObject)
200 return; 200 return;
201 v8::HandleScope scope(isolate); 201 v8::HandleScope scope(isolate);
202 v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NpOb ject->v8Object); 202 v8::Handle<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NpOb ject->v8Object);
203 ASSERT(!v8Object->CreationContext().IsEmpty()); 203 ASSERT(!v8Object->CreationContext().IsEmpty());
204 if (V8PerContextData* perContextData = V8PerContextData::from(v8Object->Crea tionContext())) { 204 if (V8PerContextData* perContextData = V8PerContextData::from(v8Object->Crea tionContext())) {
205 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); 205 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap();
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); 617 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
618 return true; 618 return true;
619 } 619 }
620 620
621 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct) 621 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct)
622 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 622 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
623 623
624 return false; 624 return false;
625 } 625 }
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.h ('k') | Source/bindings/core/v8/PageScriptDebugServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698