Issue #2251 - Expose ghost window unlinking to release builds.

This commit is contained in:
FranklinDM 2024-02-12 16:54:50 +08:00 • committed by roytam1
commit 97a40adc75
5 changed files with 0 additions and 12 deletions

View file

@ -2302,13 +2302,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
#ifdef DEBUG
void void
nsGlobalWindow::RiskyUnlink() nsGlobalWindow::RiskyUnlink()
{ {
NS_CYCLE_COLLECTION_INNERNAME.Unlink(this); NS_CYCLE_COLLECTION_INNERNAME.Unlink(this);
} }
#endif
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow)
if (tmp->mCachedXBLPrototypeHandlers) { if (tmp->mCachedXBLPrototypeHandlers) {

View file

@ -597,11 +597,9 @@ public:
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow, NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
nsIDOMEventTarget) nsIDOMEventTarget)
#ifdef DEBUG
// Call Unlink on this window. This may cause bad things to happen, so use // Call Unlink on this window. This may cause bad things to happen, so use
// with caution. // with caution.
void RiskyUnlink(); void RiskyUnlink();
#endif
virtual JSObject* virtual JSObject*
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override; GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override;

View file

@ -829,7 +829,6 @@ nsWindowMemoryReporter::KillCheckTimer()
} }
} }
#ifdef DEBUG
/* static */ void /* static */ void
nsWindowMemoryReporter::UnlinkGhostWindows() nsWindowMemoryReporter::UnlinkGhostWindows()
{ {
@ -866,4 +865,3 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
} }
} }
} }
#endif

View file

@ -150,13 +150,11 @@ public:
static void Init(); static void Init();
#ifdef DEBUG
/** /**
* Unlink all known ghost windows, to enable investigating what caused them * Unlink all known ghost windows, to enable investigating what caused them
* to become ghost windows in the first place. * to become ghost windows in the first place.
*/ */
static void UnlinkGhostWindows(); static void UnlinkGhostWindows();
#endif
static nsWindowMemoryReporter* Get(); static nsWindowMemoryReporter* Get();
void ObserveDOMWindowDetached(nsGlobalWindow* aWindow); void ObserveDOMWindowDetached(nsGlobalWindow* aWindow);

View file

@ -2664,12 +2664,8 @@ nsXPCComponents_Utils::SchedulePreciseShrinkingGC(ScheduledGCCallback* aCallback
NS_IMETHODIMP NS_IMETHODIMP
nsXPCComponents_Utils::UnlinkGhostWindows() nsXPCComponents_Utils::UnlinkGhostWindows()
{ {
#ifdef DEBUG
nsWindowMemoryReporter::UnlinkGhostWindows(); nsWindowMemoryReporter::UnlinkGhostWindows();
return NS_OK; return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP