Index: third_party/WebKit/Source/core/dom/ModuleMap.cpp |
diff --git a/third_party/WebKit/Source/core/dom/ModuleMap.cpp b/third_party/WebKit/Source/core/dom/ModuleMap.cpp |
index e68643d4201fe5e3d5f451d62686b9032b9173ae..a96d691d3f86aa6d4e394c5e05998e1dc4df5848 100644 |
--- a/third_party/WebKit/Source/core/dom/ModuleMap.cpp |
+++ b/third_party/WebKit/Source/core/dom/ModuleMap.cpp |
@@ -16,6 +16,7 @@ namespace blink { |
// Entry struct represents a value in "module map" spec object. |
// https://html.spec.whatwg.org/multipage/webappapis.html#module-map |
class ModuleMap::Entry final : public GarbageCollectedFinalized<Entry>, |
+ public TraceWrapperBase, |
public ModuleScriptLoaderClient { |
USING_GARBAGE_COLLECTED_MIXIN(ModuleMap::Entry); |
@@ -24,6 +25,7 @@ class ModuleMap::Entry final : public GarbageCollectedFinalized<Entry>, |
~Entry() override {} |
DECLARE_TRACE(); |
+ DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
// Notify fetched |m_moduleScript| to the client asynchronously. |
void addClient(SingleModuleClient*); |
@@ -39,7 +41,7 @@ class ModuleMap::Entry final : public GarbageCollectedFinalized<Entry>, |
// Implements ModuleScriptLoaderClient |
void notifyNewSingleModuleFinished(ModuleScript*) override; |
- Member<ModuleScript> m_moduleScript; |
+ TraceWrapperMember<ModuleScript> m_moduleScript; |
Member<ModuleMap> m_map; |
// Correspond to the HTML spec: "fetching" state. |
@@ -48,7 +50,7 @@ class ModuleMap::Entry final : public GarbageCollectedFinalized<Entry>, |
HeapHashSet<Member<SingleModuleClient>> m_clients; |
}; |
-ModuleMap::Entry::Entry(ModuleMap* map) : m_map(map) { |
+ModuleMap::Entry::Entry(ModuleMap* map) : m_moduleScript(this, nullptr), m_map(map) { |
DCHECK(m_map); |
} |
@@ -58,6 +60,10 @@ DEFINE_TRACE(ModuleMap::Entry) { |
visitor->trace(m_clients); |
} |
+DEFINE_TRACE_WRAPPERS(ModuleMap::Entry) { |
+ visitor->traceWrappers(m_moduleScript); |
+} |
+ |
void ModuleMap::Entry::dispatchFinishedNotificationAsync( |
SingleModuleClient* client) { |
m_map->modulator()->taskRunner()->postTask( |
@@ -99,7 +105,7 @@ ModuleScript* ModuleMap::Entry::getModuleScript() const { |
return m_moduleScript.get(); |
} |
-ModuleMap::ModuleMap(Modulator* modulator) : m_modulator(modulator) { |
+ModuleMap::ModuleMap(Modulator* modulator) : m_modulator(this, modulator) { |
DCHECK(modulator); |
} |
@@ -108,6 +114,12 @@ DEFINE_TRACE(ModuleMap) { |
visitor->trace(m_modulator); |
} |
+DEFINE_TRACE_WRAPPERS(ModuleMap) { |
+ for (const auto& it : m_map) |
+ visitor->traceWrappers(it.value); |
+ visitor->traceWrappers(m_modulator); |
+} |
+ |
void ModuleMap::fetchSingleModuleScript(const ModuleScriptFetchRequest& request, |
ModuleGraphLevel level, |
SingleModuleClient* client) { |
@@ -120,9 +132,9 @@ void ModuleMap::fetchSingleModuleScript(const ModuleScriptFetchRequest& request, |
// entry's value changes, then queue a task on the networking task source to |
// proceed with running the following steps. |
MapImpl::AddResult result = m_map.insert(request.url(), nullptr); |
- Member<Entry>& entry = result.storedValue->value; |
+ TraceWrapperMember<Entry>& entry = result.storedValue->value; |
if (result.isNewEntry) { |
- entry = Entry::create(this); |
+ entry = TraceWrapperMember<Entry>(this, Entry::create(this)); |
// Steps 4-9 loads a new single module script. |
// Delegates to ModuleScriptLoader via Modulator. |