Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: third_party/WebKit/Source/core/dom/ModuleMap.cpp

Issue 2842923002: Support Inline module script (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ddab410e6adee56c3ea7710b521d865f77a807ab..416aa978cec104801dc544f423831ad808f51538 100644
--- a/third_party/WebKit/Source/core/dom/ModuleMap.cpp
+++ b/third_party/WebKit/Source/core/dom/ModuleMap.cpp
@@ -33,14 +33,14 @@ class ModuleMap::Entry final : public GarbageCollectedFinalized<Entry>,
// This is only to be used from ScriptModuleResolver implementations.
ModuleScript* GetModuleScript() const;
+ // Implements ModuleScriptLoaderClient
+ void NotifyNewSingleModuleFinished(ModuleScript*) override;
+
private:
explicit Entry(ModuleMap*);
void DispatchFinishedNotificationAsync(SingleModuleClient*);
- // Implements ModuleScriptLoaderClient
- void NotifyNewSingleModuleFinished(ModuleScript*) override;
-
TraceWrapperMember<ModuleScript> module_script_;
Member<ModuleMap> map_;
@@ -150,6 +150,15 @@ void ModuleMap::FetchSingleModuleScript(const ModuleScriptFetchRequest& request,
entry->AddClient(client);
}
+void ModuleMap::SetInlineModuleScript(ModuleScript* module_script) {
+ MapImpl::AddResult result = map_.insert(
+ module_script->BaseURL(), TraceWrapperMember<Entry>(this, nullptr));
+ TraceWrapperMember<Entry>& entry = result.stored_value->value;
+ DCHECK(result.is_new_entry);
+ entry = TraceWrapperMember<Entry>(this, Entry::Create(this));
+ entry->NotifyNewSingleModuleFinished(module_script);
+}
+
ModuleScript* ModuleMap::GetFetchedModuleScript(const KURL& url) const {
MapImpl::const_iterator it = map_.find(url);
CHECK_NE(it, map_.end());

Powered by Google App Engine
This is Rietveld 408576698