OLD | NEW |
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 if (isWrappedNPObject(object)) { | 133 if (isWrappedNPObject(object)) { |
134 NPObject* returnValue = v8ObjectToNPObject(object); | 134 NPObject* returnValue = v8ObjectToNPObject(object); |
135 _NPN_RetainObject(returnValue); | 135 _NPN_RetainObject(returnValue); |
136 return returnValue; | 136 return returnValue; |
137 } | 137 } |
138 | 138 |
139 V8NPObjectVector* objectVector = 0; | 139 V8NPObjectVector* objectVector = 0; |
140 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati
onContext())) { | 140 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati
onContext())) { |
141 int v8ObjectHash = object->GetIdentityHash(); | 141 int v8ObjectHash = object->GetIdentityHash(); |
142 ASSERT(v8ObjectHash); | 142 ASSERT(v8ObjectHash); |
143 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); | 143 V8NPObjectMap* v8NPObjectMap = perContextData->getV8NPObjectMap(); |
144 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); | 144 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); |
145 if (iter != v8NPObjectMap->end()) { | 145 if (iter != v8NPObjectMap->end()) { |
146 V8NPObjectVector& objects = iter->value; | 146 V8NPObjectVector& objects = iter->value; |
147 for (size_t index = 0; index < objects.size(); ++index) { | 147 for (size_t index = 0; index < objects.size(); ++index) { |
148 V8NPObject* v8npObject = objects.at(index); | 148 V8NPObject* v8npObject = objects.at(index); |
149 if (v8npObject->v8Object == object && v8npObject->rootObject ==
root) { | 149 if (v8npObject->v8Object == object && v8npObject->rootObject ==
root) { |
150 _NPN_RetainObject(&v8npObject->object); | 150 _NPN_RetainObject(&v8npObject->object); |
151 return reinterpret_cast<NPObject*>(v8npObject); | 151 return reinterpret_cast<NPObject*>(v8npObject); |
152 } | 152 } |
153 } | 153 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void disposeUnderlyingV8Object(v8::Isolate* isolate, NPObject* npObject) | 188 void disposeUnderlyingV8Object(v8::Isolate* isolate, NPObject* npObject) |
189 { | 189 { |
190 ASSERT(npObject); | 190 ASSERT(npObject); |
191 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); | 191 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); |
192 if (!v8NpObject) | 192 if (!v8NpObject) |
193 return; | 193 return; |
194 v8::HandleScope scope(isolate); | 194 v8::HandleScope scope(isolate); |
195 v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NpObj
ect->v8Object); | 195 v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::New(isolate, v8NpObj
ect->v8Object); |
196 ASSERT(!v8Object->CreationContext().IsEmpty()); | 196 ASSERT(!v8Object->CreationContext().IsEmpty()); |
197 if (V8PerContextData* perContextData = V8PerContextData::from(v8Object->Crea
tionContext())) { | 197 if (V8PerContextData* perContextData = V8PerContextData::from(v8Object->Crea
tionContext())) { |
198 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); | 198 V8NPObjectMap* v8NPObjectMap = perContextData->getV8NPObjectMap(); |
199 int v8ObjectHash = v8Object->GetIdentityHash(); | 199 int v8ObjectHash = v8Object->GetIdentityHash(); |
200 ASSERT(v8ObjectHash); | 200 ASSERT(v8ObjectHash); |
201 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); | 201 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); |
202 if (iter != v8NPObjectMap->end()) { | 202 if (iter != v8NPObjectMap->end()) { |
203 V8NPObjectVector& objects = iter->value; | 203 V8NPObjectVector& objects = iter->value; |
204 for (size_t index = 0; index < objects.size(); ++index) { | 204 for (size_t index = 0; index < objects.size(); ++index) { |
205 if (objects.at(index) == v8NpObject) { | 205 if (objects.at(index) == v8NpObject) { |
206 objects.remove(index); | 206 objects.remove(index); |
207 break; | 207 break; |
208 } | 208 } |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 convertV8ObjectToNPVariant(scriptState->isolate(), resultObject, npObjec
t, result); | 610 convertV8ObjectToNPVariant(scriptState->isolate(), resultObject, npObjec
t, result); |
611 return true; | 611 return true; |
612 } | 612 } |
613 | 613 |
614 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 614 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
615 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 615 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
616 | 616 |
617 return false; | 617 return false; |
618 } | 618 } |
OLD | NEW |