| 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-2009 Google, Inc. All rights reserved. | 3 * Copyright (C) 2007-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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 int size = set->size(); | 411 int size = set->size(); |
| 412 #endif | 412 #endif |
| 413 NPObject* sub_object = *(set->begin()); | 413 NPObject* sub_object = *(set->begin()); |
| 414 // The sub-object should not be a owner! | 414 // The sub-object should not be a owner! |
| 415 ASSERT(rootObjectMap.find(sub_object) == rootObjectMap.end()); | 415 ASSERT(rootObjectMap.find(sub_object) == rootObjectMap.end()); |
| 416 | 416 |
| 417 // First, unregister the object. | 417 // First, unregister the object. |
| 418 set->remove(sub_object); | 418 set->remove(sub_object); |
| 419 liveObjectMap.remove(sub_object); | 419 liveObjectMap.remove(sub_object); |
| 420 | 420 |
| 421 // Script objects hold a refernce to their DOMWindow*, which is goin
g away if |
| 422 // we're unregistering the associated owner NPObject. Clear it out. |
| 423 if (sub_object->_class == npScriptObjectClass) { |
| 424 V8NPObject* v8npObject = reinterpret_cast<V8NPObject*>(sub_objec
t); |
| 425 v8npObject->rootObject = 0; |
| 426 } |
| 427 |
| 421 // Remove the JS references to the object. | 428 // Remove the JS references to the object. |
| 422 forgetV8ObjectForNPObject(sub_object); | 429 forgetV8ObjectForNPObject(sub_object); |
| 423 | 430 |
| 424 ASSERT(set->size() < size); | 431 ASSERT(set->size() < size); |
| 425 } | 432 } |
| 426 delete set; | 433 delete set; |
| 427 rootObjectMap.remove(npObject); | 434 rootObjectMap.remove(npObject); |
| 428 } else { | 435 } else { |
| 429 NPRootObjectMap::iterator ownerEntry = rootObjectMap.find(owner); | 436 NPRootObjectMap::iterator ownerEntry = rootObjectMap.find(owner); |
| 430 if (ownerEntry != rootObjectMap.end()) { | 437 if (ownerEntry != rootObjectMap.end()) { |
| 431 NPObjectSet* list = ownerEntry->second; | 438 NPObjectSet* list = ownerEntry->second; |
| 432 ASSERT(list->find(npObject) != list->end()); | 439 ASSERT(list->find(npObject) != list->end()); |
| 433 list->remove(npObject); | 440 list->remove(npObject); |
| 434 } | 441 } |
| 435 } | 442 } |
| 436 | 443 |
| 437 liveObjectMap.remove(npObject); | 444 liveObjectMap.remove(npObject); |
| 438 forgetV8ObjectForNPObject(npObject); | 445 forgetV8ObjectForNPObject(npObject); |
| 439 } | 446 } |
| 440 | 447 |
| 441 bool _NPN_IsAlive(NPObject* npObject) | 448 bool _NPN_IsAlive(NPObject* npObject) |
| 442 { | 449 { |
| 443 return liveObjectMap.find(npObject) != liveObjectMap.end(); | 450 return liveObjectMap.find(npObject) != liveObjectMap.end(); |
| 444 } | 451 } |
| 445 | 452 |
| 446 } // extern "C" | 453 } // extern "C" |
| OLD | NEW |