Bug 1625789, optimize CustomElement constructors out from cycle collection graph, r=mccr8

Using the method name GetExistingCustomElements() to match CustomElements(), even though
they both return CustomElementRegistry.

Differential Revision: https://phabricator.services.mozilla.com/D69853

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Olli Pettay 2020-04-06 18:21:59 +00:00
Родитель 524917fc68
Коммит a2961d74e7
5 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -1244,6 +1244,15 @@ already_AddRefed<nsISupports> CustomElementRegistry::CallGetCustomInterface(
return wrapper.forget(); return wrapper.forget();
} }
void CustomElementRegistry::TraceDefinitions(JSTracer* aTrc) {
for (auto iter = mCustomDefinitions.Iter(); !iter.Done(); iter.Next()) {
RefPtr<CustomElementDefinition>& definition = iter.Data();
if (definition && definition->mConstructor) {
mozilla::TraceScriptHolder(definition->mConstructor, aTrc);
}
}
}
//----------------------------------------------------- //-----------------------------------------------------
// CustomElementReactionsStack // CustomElementReactionsStack

Просмотреть файл

@ -466,6 +466,8 @@ class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
elements->PutEntry(elem); elements->PutEntry(elem);
} }
void TraceDefinitions(JSTracer* aTrc);
private: private:
~CustomElementRegistry(); ~CustomElementRegistry();

Просмотреть файл

@ -31,6 +31,7 @@
#include "mozilla/dom/ChromeMessageBroadcaster.h" #include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/ContentFrameMessageManager.h" #include "mozilla/dom/ContentFrameMessageManager.h"
#include "mozilla/dom/ContentProcessMessageManager.h" #include "mozilla/dom/ContentProcessMessageManager.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/ParentProcessMessageManager.h" #include "mozilla/dom/ParentProcessMessageManager.h"
#include "mozilla/dom/BrowserChild.h" #include "mozilla/dom/BrowserChild.h"
@ -467,6 +468,10 @@ void mozilla::dom::TraceBlackJS(JSTracer* aTrc, bool aIsShutdownGC) {
if (elm) { if (elm) {
elm->TraceListeners(aTrc); elm->TraceListeners(aTrc);
} }
CustomElementRegistry* cer = inner->GetExistingCustomElements();
if (cer) {
cer->TraceDefinitions(aTrc);
}
} }
} }

Просмотреть файл

@ -2163,6 +2163,10 @@ CustomElementRegistry* nsGlobalWindowInner::CustomElements() {
return mCustomElements; return mCustomElements;
} }
CustomElementRegistry* nsGlobalWindowInner::GetExistingCustomElements() {
return mCustomElements;
}
Performance* nsPIDOMWindowInner::GetPerformance() { Performance* nsPIDOMWindowInner::GetPerformance() {
CreatePerformanceObjectIfNeeded(); CreatePerformanceObjectIfNeeded();
return mPerformance; return mPerformance;

Просмотреть файл

@ -587,6 +587,7 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
mozilla::dom::Location* Location() override; mozilla::dom::Location* Location() override;
nsHistory* GetHistory(mozilla::ErrorResult& aError); nsHistory* GetHistory(mozilla::ErrorResult& aError);
mozilla::dom::CustomElementRegistry* CustomElements() override; mozilla::dom::CustomElementRegistry* CustomElements() override;
mozilla::dom::CustomElementRegistry* GetExistingCustomElements();
mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError); mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError); mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError); mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);