Chromium Code Reviews| 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..8ce6e819a638ff70124e79c37e370defb715cf10 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(); |
|
yhirano
2017/04/05 05:56:46
ditto
kouhei (in TOK)
2017/04/05 07:51:43
Done.
|
| // 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,8 @@ 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 +61,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( |
| @@ -108,6 +115,11 @@ DEFINE_TRACE(ModuleMap) { |
| visitor->trace(m_modulator); |
| } |
| +DEFINE_TRACE_WRAPPERS(ModuleMap) { |
| + for (const auto& it : m_map) |
| + visitor->traceWrappers(it.value); |
| +} |
| + |
| 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. |