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

Unified Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp

Issue 2697073002: [ES6 modules] Introduce ModuleScriptLoader (Closed)
Patch Set: rebased Created 3 years, 9 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/loader/modulescript/ModuleScriptLoaderRegistry.cpp
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8ca4d6c7e6aae78f3bbc0314a734bfc26f47d5d9
--- /dev/null
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoaderRegistry.cpp
@@ -0,0 +1,38 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/loader/modulescript/ModuleScriptLoaderRegistry.h"
+
+#include "core/loader/modulescript/ModuleScriptLoader.h"
+
+namespace blink {
+
+DEFINE_TRACE(ModuleScriptLoaderRegistry) {
+ visitor->trace(m_activeLoaders);
+}
+
+ModuleScriptLoader* ModuleScriptLoaderRegistry::fetch(
+ const ModuleScriptFetchRequest& request,
+ ModuleGraphLevel level,
+ Modulator* modulator,
+ ResourceFetcher* fetcher,
+ ModuleScriptLoaderClient* client) {
+ ModuleScriptLoader* loader =
+ ModuleScriptLoader::create(modulator, this, client);
+ DCHECK(loader->isInitialState());
+ m_activeLoaders.insert(loader);
+ loader->fetch(request, fetcher, level);
+ return loader;
+}
+
+void ModuleScriptLoaderRegistry::releaseFinishedLoader(
+ ModuleScriptLoader* loader) {
+ DCHECK(loader->hasFinished());
+
+ auto it = m_activeLoaders.find(loader);
+ DCHECK_NE(it, m_activeLoaders.end());
+ m_activeLoaders.erase(it);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698