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

Unified Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.h

Issue 2799323002: [local; kouhei 2] kouhei's giant CL https://codereview.chromium.org/2555653002 (Closed)
Patch Set: Rebase 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/loader/modulescript/ModuleTreeLinker.h
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.h b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.h
new file mode 100644
index 0000000000000000000000000000000000000000..7aa5b631e40a1e4d405df0cf62295bc9c9032500
--- /dev/null
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.h
@@ -0,0 +1,85 @@
+// 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.
+
+#ifndef ModuleTreeLinker_h
+#define ModuleTreeLinker_h
+
+#include "core/dom/AncestorList.h"
+#include "core/dom/Modulator.h"
+
+namespace blink {
+
+class ModuleScriptFetchRequest;
+enum class ModuleGraphLevel;
+class ModuleTreeLinkerRegistry;
+
+// A ModuleTreeLinker is responsible for running and keeping intermediate states
+// for "internal module script graph fetching procedure" for a module graph tree
+// node.
+// https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure
+class ModuleTreeLinker final
+ : public GarbageCollectedFinalized<ModuleTreeLinker>,
+ public SingleModuleClient {
+ USING_GARBAGE_COLLECTED_MIXIN(ModuleTreeLinker);
+
+ public:
+ static ModuleTreeLinker* Fetch(const ModuleScriptFetchRequest&,
+ const AncestorList&,
+ ModuleGraphLevel,
+ Modulator*,
+ ModuleTreeLinkerRegistry*,
+ ModuleTreeClient*);
+ virtual ~ModuleTreeLinker() = default;
+ DECLARE_TRACE();
+
+ bool IsFetching() const {
+ return State::kFetchingSelf <= state_ && state_ < State::kFinished;
+ }
+ bool HasFinished() const { return state_ == State::kFinished; }
+
+ private:
+ ModuleTreeLinker(const AncestorList& ancestor_list_with_url,
+ Modulator*,
+ ModuleTreeLinkerRegistry*,
+ ModuleTreeClient*);
+
+ enum class State {
+ kInitial,
+ // Running fetch of the module script corresponding to the target node.
+ kFetchingSelf,
+ // Running fetch of descendants of the target node.
+ kFetchingDependencies,
+ // Instantiating m_moduleScript and the node descendants.
+ kInstantiating,
+ kFinished,
+ };
+ void AdvanceState(State);
+
+ void FetchSelf(const ModuleScriptFetchRequest&, ModuleGraphLevel);
+ // Implements SingleModuleClient
+ void NotifyModuleLoadFinished(ModuleScript*) override;
+
+ void FetchDescendants();
+ enum class DescendantLoad { kFailed, kSuccess };
+ void NotifyOneDescendantFinished(DescendantLoad was_success);
+
+ void Instantiate();
+ HeapHashSet<Member<ModuleScript>> UninstantiatedInclusiveDescendants();
+
+ class DependencyModuleClient;
+ friend class DependencyModuleClient;
+
+ Member<Modulator> modulator_;
+ Member<ModuleTreeLinkerRegistry> registry_;
+ Member<ModuleTreeClient> client_;
+ HashSet<KURL> ancestor_list_with_url_;
+ State state_ = State::kInitial;
+ Member<ModuleScript> module_script_;
+ size_t num_incomplete_descendants_ = 0;
+ HeapHashSet<Member<DependencyModuleClient>> dependency_clients_;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698