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

Unified Diff: third_party/WebKit/Source/core/dom/ModulatorImpl.h

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: address haraken/yhirano comments Created 3 years, 11 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/ModulatorImpl.h
diff --git a/third_party/WebKit/Source/core/dom/ModulatorImpl.h b/third_party/WebKit/Source/core/dom/ModulatorImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..17b57c96eea9bcb5f03ebf5415470f205ad7a8cd
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ModulatorImpl.h
@@ -0,0 +1,77 @@
+// 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 ModulatorImpl_h
+#define ModulatorImpl_h
+
+#include "bindings/core/v8/ScriptModule.h"
+#include "bindings/core/v8/V8PerIsolateData.h"
+#include "core/dom/Modulator.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class Document;
+class ModuleMap;
+class ModuleScriptLoaderRegistry;
+class ModuleTreeLinkerRegistry;
+class ResourceFetcher;
+class ScriptState;
+class WebTaskRunner;
+
+class ModulatorImpl final : public GarbageCollectedFinalized<Modulator>,
+ public Modulator {
+ USING_GARBAGE_COLLECTED_MIXIN(ModulatorImpl);
+
+ public:
+ static ModulatorImpl* create(RefPtr<ScriptState>, Document&);
dominicc (has gone to gerrit) 2017/01/11 03:23:48 Probably fine, but what would the parameter list l
kouhei (in TOK) 2017/01/13 05:41:28 The idea was to eventually have create(State, Work
+
+ virtual ~ModulatorImpl();
+ DECLARE_TRACE();
+
+ private:
+ // Implements Modulator
+
+ ScriptModuleResolver* scriptModuleResolver() override {
+ return m_scriptModuleResolver.get();
+ }
+ WebTaskRunner* taskRunner() override { return m_taskRunner.get(); }
+
+ void fetchTree(const KURL&, const KURL& baseURL, ModuleTreeClient*) override;
+ void fetchSingle(
+ const KURL&,
+ const KURL& baseURL,
+ SingleModuleClient*
+ /*, a fetch client settings object, a destination, a cryptographic nonce, a parser state, a credentials mode, a module map settings object, a referrer, and a top-level module fetch flag*/)
+ override;
+ void fetchNewSingleModule(
+ const KURL&,
+ const KURL& baseURL,
+ ModuleScriptLoaderClient*
+ /*, a fetch client settings object, a destination, a cryptographic nonce, a parser state, a credentials mode, a module map settings object, a referrer, and a top-level module fetch flag*/)
+ override;
+
+ ModuleScript* retrieveFetchedModuleScript(const KURL&) override;
+
+ ScriptModule compileModule(const String& script,
dominicc (has gone to gerrit) 2017/01/11 03:23:48 I feel like there's a second interface here called
+ const String& urlStr) override;
+ bool instantiateModule(ScriptModule) override;
+ Vector<String> moduleRequestsFromScriptModule(ScriptModule) override;
+ void executeModule(ScriptModule) override;
+
+ private:
+ ModulatorImpl(RefPtr<ScriptState>, WebTaskRunner*, ResourceFetcher*);
+
+ RefPtr<ScriptState> m_scriptState;
+ std::unique_ptr<WebTaskRunner> m_taskRunner;
+ Member<ResourceFetcher> m_fetcher;
+ Member<ModuleMap> m_map;
+ Member<ModuleScriptLoaderRegistry> m_loaderRegistry;
+ Member<ModuleTreeLinkerRegistry> m_treeLinkerRegistry;
+ Member<ScriptModuleResolver> m_scriptModuleResolver;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698