JSInspectedObjectWrapper::JSInspectedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, JSValue* wrappedPrototype) : JSQuarantinedObjectWrapper(unwrappedExec, unwrappedObject, wrappedPrototype) { WrapperMap* wrapperMap = wrappers().get(unwrappedGlobalObject()); if (!wrapperMap) { wrapperMap = new WrapperMap; wrappers().set(unwrappedGlobalObject(), wrapperMap); } ASSERT(!wrapperMap->contains(unwrappedObject)); wrapperMap->set(unwrappedObject, this); }
JSInspectedObjectWrapper::~JSInspectedObjectWrapper() { ASSERT(wrappers().contains(unwrappedGlobalObject())); WrapperMap* wrapperMap = wrappers().get(unwrappedGlobalObject()); ASSERT(wrapperMap->contains(unwrappedObject())); wrapperMap->remove(unwrappedObject()); if (wrapperMap->isEmpty()) { wrappers().remove(unwrappedGlobalObject()); delete wrapperMap; } }