* GIWrapperBase::finalize: * * This should always be included in the Base::klass vtable. The destructors * of Prototype and Instance will be called in the finalize hook. It is not * necessary to include a finalize_impl() function in Prototype or Instance. * Any needed finalization should be done in ~Prototype() and ~Instance(). */
| 478 | * Any needed finalization should be done in ~Prototype() and ~Instance(). |
| 479 | */ |
| 480 | static void finalize(JS::GCContext* gcx, JSObject* obj) { |
| 481 | Base* priv = Base::for_js_nocheck(obj); |
| 482 | if (!priv) |
| 483 | return; // construction didn't finish |
| 484 | |
| 485 | // Call only GIWrapperBase's original method here, not any overrides; |
| 486 | // e.g., we don't want to deal with a read barrier in ObjectInstance. |
| 487 | static_cast<GIWrapperBase*>(priv)->debug_lifecycle(obj, "Finalize"); |
| 488 | |
| 489 | if (priv->is_prototype()) { |
| 490 | GType gtype = priv->to_prototype()->gtype(); |
| 491 | remove_prototype_associated_memory(gtype, obj); |
| 492 | priv->to_prototype()->finalize_impl(gcx, obj); |
| 493 | } else { |
| 494 | priv->to_instance()->finalize_impl(gcx, obj); |
| 495 | } |
| 496 | |
| 497 | Base::unset_private(obj); |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * GIWrapperBase::trace: |
nothing calls this directly
no test coverage detected