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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.h

Issue 2696653004: [Script Spec Annotation] Annotate and refactor script element's flags (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 bool willExecuteWhenDocumentFinishedParsing() const { 84 bool willExecuteWhenDocumentFinishedParsing() const {
85 return m_willExecuteWhenDocumentFinishedParsing; 85 return m_willExecuteWhenDocumentFinishedParsing;
86 } 86 }
87 ScriptResource* resource() { return m_resource.get(); } 87 ScriptResource* resource() { return m_resource.get(); }
88 88
89 void setHaveFiredLoadEvent(bool haveFiredLoad) { 89 void setHaveFiredLoadEvent(bool haveFiredLoad) {
90 m_haveFiredLoad = haveFiredLoad; 90 m_haveFiredLoad = haveFiredLoad;
91 } 91 }
92 bool isParserInserted() const { return m_parserInserted; } 92 bool isParserInserted() const { return m_parserInserted; }
93 bool alreadyStarted() const { return m_alreadyStarted; } 93 bool alreadyStarted() const { return m_alreadyStarted; }
94 bool forceAsync() const { return m_forceAsync; } 94 bool isNonBlocking() const { return m_nonBlocking; }
95 95
96 // Helper functions used by our parent classes. 96 // Helper functions used by our parent classes.
97 void didNotifySubtreeInsertionsToDocument(); 97 void didNotifySubtreeInsertionsToDocument();
98 void childrenChanged(); 98 void childrenChanged();
99 void handleSourceAttribute(const String& sourceUrl); 99 void handleSourceAttribute(const String& sourceUrl);
100 void handleAsyncAttribute(); 100 void handleAsyncAttribute();
101 101
102 virtual bool isReady() const { 102 virtual bool isReady() const {
103 return m_pendingScript && m_pendingScript->isReady(); 103 return m_pendingScript && m_pendingScript->isReady();
104 } 104 }
(...skipping 30 matching lines...) Expand all
135 135
136 ScriptLoaderClient* client() const; 136 ScriptLoaderClient* client() const;
137 137
138 // PendingScriptClient 138 // PendingScriptClient
139 void pendingScriptFinished(PendingScript*) override; 139 void pendingScriptFinished(PendingScript*) override;
140 140
141 Member<Element> m_element; 141 Member<Element> m_element;
142 Member<ScriptResource> m_resource; 142 Member<ScriptResource> m_resource;
143 WTF::OrdinalNumber m_startLineNumber; 143 WTF::OrdinalNumber m_startLineNumber;
144 144
145 bool m_parserInserted : 1; 145 // https://html.spec.whatwg.org/#script-processing-model
146 bool m_isExternalScript : 1; 146 // "A script element has several associated pieces of state.":
147 bool m_alreadyStarted : 1; 147
148 bool m_haveFiredLoad : 1; 148 // https://html.spec.whatwg.org/#already-started
kouhei (in TOK) 2017/02/13 21:31:09 Should we // "Initially, script elements must have
hiroshige 2017/02/13 21:46:53 Done. Applied the same to other flags and modifies
149 bool m_alreadyStarted;
150
151 // https://html.spec.whatwg.org/#parser-inserted
152 bool m_parserInserted;
153
154 // https://html.spec.whatwg.org/#non-blocking
155 bool m_nonBlocking;
hiroshige 2017/02/13 21:17:25 Renamed from m_forceAsync.
156
157 // https://html.spec.whatwg.org/#ready-to-be-parser-executed
158 // "Initially, script elements must have this flag unset"
159 bool m_readyToBeParserExecuted = false;
160
161 // https://html.spec.whatwg.org/#concept-script-type
162 // TODO(hiroshige): Implement "script's type".
hiroshige 2017/02/13 21:17:25 I'm not sure whether we'll implement the script ty
kouhei (in TOK) 2017/02/13 21:31:09 sgtm
163
164 // https://html.spec.whatwg.org/#concept-script-external
165 bool m_isExternalScript;
166
167 bool m_haveFiredLoad;
168
149 // Same as "The parser will handle executing the script." 169 // Same as "The parser will handle executing the script."
150 bool m_willBeParserExecuted : 1; 170 bool m_willBeParserExecuted;
151 bool m_readyToBeParserExecuted : 1; 171
152 bool m_willExecuteWhenDocumentFinishedParsing : 1; 172 bool m_willExecuteWhenDocumentFinishedParsing;
153 bool m_forceAsync : 1; 173
154 const bool m_createdDuringDocumentWrite : 1; 174 const bool m_createdDuringDocumentWrite;
155 175
156 ScriptRunner::AsyncExecutionType m_asyncExecType; 176 ScriptRunner::AsyncExecutionType m_asyncExecType;
157 enum DocumentWriteIntervention { 177 enum DocumentWriteIntervention {
158 DocumentWriteInterventionNone = 0, 178 DocumentWriteInterventionNone = 0,
159 // Based on what shouldDisallowFetchForMainFrameScript() returns. 179 // Based on what shouldDisallowFetchForMainFrameScript() returns.
160 // This script will be blocked if not present in http cache. 180 // This script will be blocked if not present in http cache.
161 DoNotFetchDocWrittenScript, 181 DoNotFetchDocWrittenScript,
162 // If a parser blocking doc.written script was not fetched and was not 182 // If a parser blocking doc.written script was not fetched and was not
163 // present in the http cache, send a GET for it with an interventions 183 // present in the http cache, send a GET for it with an interventions
164 // header to allow the server to know of the intervention. This fetch 184 // header to allow the server to know of the intervention. This fetch
165 // will be using DeferOption::IdleLoad to keep it out of the critical 185 // will be using DeferOption::IdleLoad to keep it out of the critical
166 // path. 186 // path.
167 FetchDocWrittenScriptDeferIdle, 187 FetchDocWrittenScriptDeferIdle,
168 }; 188 };
169 189
170 DocumentWriteIntervention m_documentWriteIntervention; 190 DocumentWriteIntervention m_documentWriteIntervention;
171 191
172 Member<PendingScript> m_pendingScript; 192 Member<PendingScript> m_pendingScript;
173 }; 193 };
174 194
175 ScriptLoader* toScriptLoaderIfPossible(Element*); 195 ScriptLoader* toScriptLoaderIfPossible(Element*);
176 196
177 } // namespace blink 197 } // namespace blink
178 198
179 #endif // ScriptLoader_h 199 #endif // ScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698