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

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

Issue 11434015: Merge 135874 - freeV8NPObject: Skip trying to remove object from per context data's ObjectMap if th… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years 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 | « LayoutTests/platform/chromium/plugins/resources/empty2.html ('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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 static void freeV8NPObject(NPObject* npObject) 73 static void freeV8NPObject(NPObject* npObject)
74 { 74 {
75 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); 75 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
76 v8::HandleScope scope; 76 v8::HandleScope scope;
77 ASSERT(!v8NpObject->v8Object->CreationContext().IsEmpty()); 77 ASSERT(!v8NpObject->v8Object->CreationContext().IsEmpty());
78 if (V8PerContextData* perContextData = V8PerContextData::from(v8NpObject->v8 Object->CreationContext())) { 78 if (V8PerContextData* perContextData = V8PerContextData::from(v8NpObject->v8 Object->CreationContext())) {
79 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap(); 79 V8NPObjectMap* v8NPObjectMap = perContextData->v8NPObjectMap();
80 int v8ObjectHash = v8NpObject->v8Object->GetIdentityHash(); 80 int v8ObjectHash = v8NpObject->v8Object->GetIdentityHash();
81 ASSERT(v8ObjectHash); 81 ASSERT(v8ObjectHash);
82 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash); 82 V8NPObjectMap::iterator iter = v8NPObjectMap->find(v8ObjectHash);
83 ASSERT(iter != v8NPObjectMap->end()); 83 if (iter != v8NPObjectMap->end()) {
84 V8NPObjectVector& objects = iter->value; 84 V8NPObjectVector& objects = iter->value;
85 for (size_t index = 0; index < objects.size(); ++index) { 85 for (size_t index = 0; index < objects.size(); ++index) {
86 if (objects.at(index) == v8NpObject) { 86 if (objects.at(index) == v8NpObject) {
87 objects.remove(index); 87 objects.remove(index);
88 break; 88 break;
89 }
89 } 90 }
91 if (objects.isEmpty())
92 v8NPObjectMap->remove(v8ObjectHash);
90 } 93 }
91 if (objects.isEmpty())
92 v8NPObjectMap->remove(v8ObjectHash);
93 } 94 }
94 v8NpObject->v8Object.Dispose(); 95 v8NpObject->v8Object.Dispose();
95 free(v8NpObject); 96 free(v8NpObject);
96 } 97 }
97 98
98 static PassOwnArrayPtr<v8::Handle<v8::Value> > createValueListFromVariantArgs(co nst NPVariant* arguments, uint32_t argumentCount, NPObject* owner) 99 static PassOwnArrayPtr<v8::Handle<v8::Value> > createValueListFromVariantArgs(co nst NPVariant* arguments, uint32_t argumentCount, NPObject* owner)
99 { 100 {
100 OwnArrayPtr<v8::Handle<v8::Value> > argv = adoptArrayPtr(new v8::Handle<v8:: Value>[argumentCount]); 101 OwnArrayPtr<v8::Handle<v8::Value> > argv = adoptArrayPtr(new v8::Handle<v8:: Value>[argumentCount]);
101 for (uint32_t index = 0; index < argumentCount; index++) { 102 for (uint32_t index = 0; index < argumentCount; index++) {
102 const NPVariant* arg = &arguments[index]; 103 const NPVariant* arg = &arguments[index];
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 583
583 convertV8ObjectToNPVariant(resultObject, npObject, result); 584 convertV8ObjectToNPVariant(resultObject, npObject, result);
584 return true; 585 return true;
585 } 586 }
586 587
587 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)
588 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 589 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
589 590
590 return false; 591 return false;
591 } 592 }
OLDNEW
« no previous file with comments | « LayoutTests/platform/chromium/plugins/resources/empty2.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698