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 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 V8NPObjectVector* objectVector = 0; | 147 V8NPObjectVector* objectVector = 0; |
148 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati
onContext())) { | 148 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati
onContext())) { |
149 int v8ObjectHash = object->GetIdentityHash(); | 149 int v8ObjectHash = object->GetIdentityHash(); |
150 ASSERT(v8ObjectHash); | 150 ASSERT(v8ObjectHash); |
151 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); | 151 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); |
152 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); | 152 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); |
153 if (iter != v8NPObjectMap->end()) { | 153 if (iter != v8NPObjectMap->end()) { |
154 V8NPObjectVector& objects = iter->value; | 154 V8NPObjectVector& objects = iter->value; |
155 for (size_t index = 0; index < objects.size(); ++index) { | 155 for (size_t index = 0; index < objects.size(); ++index) { |
156 V8NPObject* v8npObject = objects.at(index); | 156 V8NPObject* v8npObject = objects.at(index); |
157 if (v8npObject->rootObject == root) { | 157 if (v8npObject->v8Object == object && v8npObject->rootObject ==
root) { |
158 ASSERT(v8npObject->v8Object == object); | |
159 _NPN_RetainObject(&v8npObject->object); | 158 _NPN_RetainObject(&v8npObject->object); |
160 return reinterpret_cast<NPObject*>(v8npObject); | 159 return reinterpret_cast<NPObject*>(v8npObject); |
161 } | 160 } |
162 } | 161 } |
163 } else { | 162 } else { |
164 iter = v8NPObjectMap->set(v8ObjectHash, V8NPObjectVector()).iterator
; | 163 iter = v8NPObjectMap->set(v8ObjectHash, V8NPObjectVector()).iterator
; |
165 objectVector = &iter->value; | |
166 } | 164 } |
| 165 objectVector = &iter->value; |
167 } | 166 } |
168 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp
, &V8NPObjectClass)); | 167 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp
, &V8NPObjectClass)); |
169 v8npObject->v8Object = v8::Persistent<v8::Object>::New(object); | 168 v8npObject->v8Object = v8::Persistent<v8::Object>::New(object); |
170 v8npObject->rootObject = root; | 169 v8npObject->rootObject = root; |
171 | 170 |
172 if (objectVector) | 171 if (objectVector) |
173 objectVector->append(v8npObject); | 172 objectVector->append(v8npObject); |
174 | 173 |
175 return reinterpret_cast<NPObject*>(v8npObject); | 174 return reinterpret_cast<NPObject*>(v8npObject); |
176 } | 175 } |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 582 |
584 convertV8ObjectToNPVariant(resultObject, npObject, result); | 583 convertV8ObjectToNPVariant(resultObject, npObject, result); |
585 return true; | 584 return true; |
586 } | 585 } |
587 | 586 |
588 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 587 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
589 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 588 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
590 | 589 |
591 return false; | 590 return false; |
592 } | 591 } |
OLD | NEW |