1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_MODULESCRIPT_WORKER_MODULE_SCRIPT_FETCHER_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_MODULESCRIPT_WORKER_MODULE_SCRIPT_FETCHER_H_ 7 8 #include "third_party/blink/renderer/core/loader/modulescript/module_script_fetcher.h" 9 10 namespace blink { 11 12 class WorkerGlobalScope; 13 14 // WorkerModuleScriptFetcher is an implementation of ModuleScriptFetcher 15 // interface for WebWorkers. This implements the custom "perform the fetch" hook 16 // defined in the HTML spec: 17 // https://html.spec.whatwg.org/C/#fetching-scripts-perform-fetch 18 // https://html.spec.whatwg.org/C/#worker-processing-model 19 class CORE_EXPORT WorkerModuleScriptFetcher final 20 : public GarbageCollected<WorkerModuleScriptFetcher>, 21 public ModuleScriptFetcher { 22 USING_GARBAGE_COLLECTED_MIXIN(WorkerModuleScriptFetcher); 23 24 public: 25 WorkerModuleScriptFetcher(WorkerGlobalScope*, 26 util::PassKey<ModuleScriptLoader>); 27 28 // Implements ModuleScriptFetcher. 29 void Fetch(FetchParameters&, 30 ResourceFetcher*, 31 ModuleGraphLevel, 32 ModuleScriptFetcher::Client*) override; 33 34 void Trace(Visitor*) override; 35 36 private: 37 // Implements ResourceClient 38 void NotifyFinished(Resource*) override; DebugName()39 String DebugName() const override { return "WorkerModuleScriptFetcher"; } 40 41 const Member<WorkerGlobalScope> global_scope_; 42 43 Member<ResourceFetcher> fetch_client_settings_object_fetcher_; 44 Member<Client> client_; 45 ModuleGraphLevel level_; 46 }; 47 48 } // namespace blink 49 50 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_MODULESCRIPT_WORKER_MODULE_SCRIPT_FETCHER_H_ 51