OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ModuleScriptLoader_h | 5 #ifndef ModuleScriptLoader_h |
6 #define ModuleScriptLoader_h | 6 #define ModuleScriptLoader_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/loader/modulescript/ModuleScriptFetchRequest.h" | 9 #include "core/loader/modulescript/ModuleScriptFetchRequest.h" |
10 #include "core/loader/resource/ScriptResource.h" | 10 #include "core/loader/resource/ScriptResource.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 bool IsInitialState() const { return state_ == State::kInitial; } | 62 bool IsInitialState() const { return state_ == State::kInitial; } |
63 bool HasFinished() const { return state_ == State::kFinished; } | 63 bool HasFinished() const { return state_ == State::kFinished; } |
64 | 64 |
65 DECLARE_TRACE(); | 65 DECLARE_TRACE(); |
66 | 66 |
67 private: | 67 private: |
68 ModuleScriptLoader(Modulator*, | 68 ModuleScriptLoader(Modulator*, |
69 ModuleScriptLoaderRegistry*, | 69 ModuleScriptLoaderRegistry*, |
70 ModuleScriptLoaderClient*); | 70 ModuleScriptLoaderClient*); |
71 | 71 |
72 static ModuleScript* CreateModuleScript(const String& source_text, | |
73 const KURL&, | |
74 Modulator*, | |
75 const String& nonce, | |
76 ParserDisposition, | |
77 WebURLRequest::FetchCredentialsMode, | |
78 AccessControlStatus); | |
79 | |
80 void AdvanceState(State new_state); | 72 void AdvanceState(State new_state); |
81 #if DCHECK_IS_ON() | 73 #if DCHECK_IS_ON() |
82 static const char* StateToString(State); | 74 static const char* StateToString(State); |
83 #endif | 75 #endif |
84 | 76 |
85 // Implements ScriptResourceClient | 77 // Implements ScriptResourceClient |
86 void NotifyFinished(Resource*) override; | 78 void NotifyFinished(Resource*) override; |
87 String DebugName() const override { return "ModuleScriptLoader"; } | 79 String DebugName() const override { return "ModuleScriptLoader"; } |
88 | 80 |
89 static bool WasModuleLoadSuccessful(Resource*); | 81 static bool WasModuleLoadSuccessful(Resource*); |
90 | 82 |
91 Member<Modulator> modulator_; | 83 Member<Modulator> modulator_; |
92 State state_ = State::kInitial; | 84 State state_ = State::kInitial; |
93 String nonce_; | 85 String nonce_; |
94 ParserDisposition parser_state_; | 86 ParserDisposition parser_state_; |
95 Member<ModuleScript> module_script_; | 87 Member<ModuleScript> module_script_; |
96 Member<ModuleScriptLoaderRegistry> registry_; | 88 Member<ModuleScriptLoaderRegistry> registry_; |
97 Member<ModuleScriptLoaderClient> client_; | 89 Member<ModuleScriptLoaderClient> client_; |
98 #if DCHECK_IS_ON() | 90 #if DCHECK_IS_ON() |
99 KURL url_; | 91 KURL url_; |
100 #endif | 92 #endif |
101 }; | 93 }; |
102 | 94 |
103 } // namespace blink | 95 } // namespace blink |
104 | 96 |
105 #endif | 97 #endif |
OLD | NEW |