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

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

Issue 11791021: Merge 137964 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 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/WebCore/ChangeLog ('k') | no next file » | 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 * 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 V8NPObjectVector* objectVector = 0; 148 V8NPObjectVector* objectVector = 0;
149 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati onContext())) { 149 if (V8PerContextData* perContextData = V8PerContextData::from(object->Creati onContext())) {
150 int v8ObjectHash = object->GetIdentityHash(); 150 int v8ObjectHash = object->GetIdentityHash();
151 ASSERT(v8ObjectHash); 151 ASSERT(v8ObjectHash);
152 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); 152 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap();
153 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); 153 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash);
154 if (iter != v8NPObjectMap->end()) { 154 if (iter != v8NPObjectMap->end()) {
155 V8NPObjectVector& objects = iter->value; 155 V8NPObjectVector& objects = iter->value;
156 for (size_t index = 0; index < objects.size(); ++index) { 156 for (size_t index = 0; index < objects.size(); ++index) {
157 V8NPObject* v8npObject = objects.at(index); 157 V8NPObject* v8npObject = objects.at(index);
158 if (v8npObject->rootObject == root) { 158 if (v8npObject->v8Object == object && v8npObject->rootObject == root) {
159 ASSERT(v8npObject->v8Object == object);
160 _NPN_RetainObject(&v8npObject->object); 159 _NPN_RetainObject(&v8npObject->object);
161 return reinterpret_cast<NPObject*>(v8npObject); 160 return reinterpret_cast<NPObject*>(v8npObject);
162 } 161 }
163 } 162 }
164 } else { 163 } else {
165 iter = v8NPObjectMap->set(v8ObjectHash, V8NPObjectVector()).iterator ; 164 iter = v8NPObjectMap->set(v8ObjectHash, V8NPObjectVector()).iterator ;
166 objectVector = &iter->value;
167 } 165 }
166 objectVector = &iter->value;
168 } 167 }
169 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp , &V8NPObjectClass)); 168 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp , &V8NPObjectClass));
170 v8npObject->v8Object = v8::Persistent<v8::Object>::New(object); 169 v8npObject->v8Object = v8::Persistent<v8::Object>::New(object);
171 v8npObject->rootObject = root; 170 v8npObject->rootObject = root;
172 171
173 if (objectVector) 172 if (objectVector)
174 objectVector->append(v8npObject); 173 objectVector->append(v8npObject);
175 174
176 return reinterpret_cast<NPObject*>(v8npObject); 175 return reinterpret_cast<NPObject*>(v8npObject);
177 } 176 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 583
585 convertV8ObjectToNPVariant(resultObject, npObject, result); 584 convertV8ObjectToNPVariant(resultObject, npObject, result);
586 return true; 585 return true;
587 } 586 }
588 587
589 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct) 588 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct)
590 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 589 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
591 590
592 return false; 591 return false;
593 } 592 }
OLDNEW
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698