Index: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp |
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0cad0240cf9fd83a409d996b2346ac7d3b415e12 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinkerRegistry.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/ModuleTreeLinkerRegistry.h" |
+ |
+#include "core/loader/modulescript/ModuleTreeLinker.h" |
+#include "platform/weborigin/KURL.h" |
+#include "platform/weborigin/KURLHash.h" |
+ |
+namespace blink { |
+ |
+DEFINE_TRACE(ModuleTreeLinkerRegistry) { |
+ visitor->trace(m_activeTreeLinkers); |
+} |
+ |
+ModuleTreeLinker* ModuleTreeLinkerRegistry::fetch(const KURL& url, |
+ const KURL& baseURL, |
+ HashSet<KURL> ancestorList, |
+ Modulator* modulator, |
+ ModuleTreeClient* client) { |
+ ModuleTreeLinker* fetcher = ModuleTreeLinker::fetch( |
+ url, baseURL, std::move(ancestorList), modulator, this, client); |
+ DCHECK(fetcher->isFetching()); |
+ m_activeTreeLinkers.add(fetcher); |
+ return fetcher; |
+} |
+ |
+void ModuleTreeLinkerRegistry::releaseFinishedFetcher( |
+ ModuleTreeLinker* fetcher) { |
+ DCHECK(fetcher->hasFinished()); |
+ |
+ auto it = m_activeTreeLinkers.find(fetcher); |
+ DCHECK_NE(it, m_activeTreeLinkers.end()); |
+ m_activeTreeLinkers.remove(it); |
+} |
+ |
+} // namespace blink |