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..8f4572eb680c78c8e753dc3536a5cf5201e1c425 |
--- /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 KURL& url, |
+ const KURL& baseURL, |
+ Modulator* modulator, |
+ ResourceFetcher* fetcher, |
+ ModuleScriptLoaderClient* client) { |
+ ModuleScriptLoader* loader = |
+ ModuleScriptLoader::create(url, baseURL, modulator, this, client); |
+ DCHECK(loader->isInitialState()); |
+ m_activeLoaders.add(loader); |
+ loader->fetch(fetcher); |
+ return loader; |
+} |
+ |
+void ModuleScriptLoaderRegistry::releaseFinishedLoader( |
+ ModuleScriptLoader* loader) { |
+ DCHECK(loader->hasFinished()); |
+ |
+ auto it = m_activeLoaders.find(loader); |
+ DCHECK_NE(it, m_activeLoaders.end()); |
+ m_activeLoaders.remove(it); |
+} |
+ |
+} // namespace blink |