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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 years, 10 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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); 134 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash);
135 if (iter != v8NPObjectMap->end()) { 135 if (iter != v8NPObjectMap->end()) {
136 V8NPObjectVector& objects = iter->value; 136 V8NPObjectVector& objects = iter->value;
137 for (size_t index = 0; index < objects.size(); ++index) { 137 for (size_t index = 0; index < objects.size(); ++index) {
138 V8NPObject* v8npObject = objects.at(index); 138 V8NPObject* v8npObject = objects.at(index);
139 if (v8npObject->v8Object == object && v8npObject->rootObject == root) { 139 if (v8npObject->v8Object == object && v8npObject->rootObject == root) {
140 _NPN_RetainObject(&v8npObject->object); 140 _NPN_RetainObject(&v8npObject->object);
141 return reinterpret_cast<NPObject*>(v8npObject); 141 return reinterpret_cast<NPObject*>(v8npObject);
142 } 142 }
143 } 143 }
144 objectVector = &iter->value;
144 } else { 145 } else {
145 iter = v8NPObjectMap->set(v8ObjectHash, V8NPObjectVector()).iterator ; 146 objectVector = &v8NPObjectMap->set(v8ObjectHash, V8NPObjectVector()) .storedValue->value;
146 } 147 }
147 objectVector = &iter->value;
148 } 148 }
149 149
150 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp , &V8NPObjectClass)); 150 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(_NPN_CreateObject(npp , &V8NPObjectClass));
151 // This is uninitialized memory, we need to clear it so that 151 // This is uninitialized memory, we need to clear it so that
152 // Persistent::Reset won't try to Dispose anything bogus. 152 // Persistent::Reset won't try to Dispose anything bogus.
153 new (&v8npObject->v8Object) v8::Persistent<v8::Object>(); 153 new (&v8npObject->v8Object) v8::Persistent<v8::Object>();
154 v8npObject->v8Object.Reset(isolate, object); 154 v8npObject->v8Object.Reset(isolate, object);
155 v8npObject->rootObject = root; 155 v8npObject->rootObject = root;
156 156
157 if (objectVector) 157 if (objectVector)
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 604
605 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); 605 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
606 return true; 606 return true;
607 } 607 }
608 608
609 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct) 609 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct)
610 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 610 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
611 611
612 return false; 612 return false;
613 } 613 }
OLDNEW
« no previous file with comments | « Source/bindings/v8/DOMWrapperWorld.cpp ('k') | Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698