X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..14957cd040308e3eeec43d26bae5d76da13fcd85:/API/JSCallbackObject.cpp diff --git a/API/JSCallbackObject.cpp b/API/JSCallbackObject.cpp index 2fde0f8..6a7462a 100644 --- a/API/JSCallbackObject.cpp +++ b/API/JSCallbackObject.cpp @@ -27,15 +27,28 @@ #include "config.h" #include "JSCallbackObject.h" -#include "Collector.h" +#include "Heap.h" +#include namespace JSC { -ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); +ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); // Define the two types of JSCallbackObjects we support. -template <> const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; -template <> const ClassInfo JSCallbackObject::info = { "CallbackGlobalObject", 0, 0, 0 }; +template <> const ClassInfo JSCallbackObject::s_info = { "CallbackObject", &JSObjectWithGlobalObject::s_info, 0, 0 }; +template <> const ClassInfo JSCallbackObject::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0 }; +void JSCallbackObjectData::finalize(Handle handle, void* context) +{ + JSClassRef jsClass = static_cast(context); + JSObjectRef thisRef = toRef(asObject(handle.get())); + + for (; jsClass; jsClass = jsClass->parentClass) + if (JSObjectFinalizeCallback finalize = jsClass->finalize) + finalize(thisRef); + HandleSlot slot = handle.slot(); + HandleHeap::heapFor(slot)->deallocate(slot); +} + } // namespace JSC