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

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

Issue 2260303002: Sending an async GET request for doc.written blocked scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nate's feedback Created 4 years, 4 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void handleAsyncAttribute(); 81 void handleAsyncAttribute();
82 82
83 virtual bool isReady() const { return m_pendingScript && m_pendingScript->is Ready(); } 83 virtual bool isReady() const { return m_pendingScript && m_pendingScript->is Ready(); }
84 bool errorOccurred() const { return m_pendingScript && m_pendingScript->erro rOccurred(); } 84 bool errorOccurred() const { return m_pendingScript && m_pendingScript->erro rOccurred(); }
85 85
86 // Clears the connection to the PendingScript (and Element and Resource). 86 // Clears the connection to the PendingScript (and Element and Resource).
87 void detach(); 87 void detach();
88 88
89 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite; } 89 bool wasCreatedDuringDocumentWrite() { return m_createdDuringDocumentWrite; }
90 90
91 bool disallowedFetchForDocWrittenScript() { return m_documentWriteInterventi on == DocumentWriteIntervention::DisallowedFetchForDocWrittenScript; }
haraken 2016/08/23 00:30:39 disallowedFetchForDocWrittenScript => shouldFetchD
shivanisha 2016/08/24 17:47:40 Named it as disallowedFetchForDocWrittenScript so
92 void setBlockedDocWriteScriptAsyncFetch();
haraken 2016/08/23 00:30:39 "BlockedDocWrite" sounds a bit strange to me. Is t
shivanisha 2016/08/24 17:47:40 Here blocking is used not in the sense of parser-b
93
91 protected: 94 protected:
92 ScriptLoader(Element*, bool createdByParser, bool isEvaluated, bool createdD uringDocumentWrite); 95 ScriptLoader(Element*, bool createdByParser, bool isEvaluated, bool createdD uringDocumentWrite);
93 96
94 private: 97 private:
95 bool ignoresLoadRequest() const; 98 bool ignoresLoadRequest() const;
96 bool isScriptForEventSupported() const; 99 bool isScriptForEventSupported() const;
97 void logScriptMimetype(ScriptResource*, LocalFrame*, String); 100 void logScriptMimetype(ScriptResource*, LocalFrame*, String);
98 101
99 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); 102 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption);
100 103
(...skipping 13 matching lines...) Expand all
114 bool m_isExternalScript : 1; 117 bool m_isExternalScript : 1;
115 bool m_alreadyStarted : 1; 118 bool m_alreadyStarted : 1;
116 bool m_haveFiredLoad : 1; 119 bool m_haveFiredLoad : 1;
117 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin g the script." 120 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin g the script."
118 bool m_readyToBeParserExecuted : 1; 121 bool m_readyToBeParserExecuted : 1;
119 bool m_willExecuteInOrder : 1; 122 bool m_willExecuteInOrder : 1;
120 bool m_willExecuteWhenDocumentFinishedParsing : 1; 123 bool m_willExecuteWhenDocumentFinishedParsing : 1;
121 bool m_forceAsync : 1; 124 bool m_forceAsync : 1;
122 const bool m_createdDuringDocumentWrite : 1; 125 const bool m_createdDuringDocumentWrite : 1;
123 126
127 enum DocumentWriteIntervention {
128 DocumentWriteInterventionNone = 0,
129 // Based on what shouldDisallowFetchForMainFrameScript() returns.
130 // This script will be blocked if not present in http cache.
131 DisallowedFetchForDocWrittenScript,
haraken 2016/08/23 00:30:39 DoNotFetchDocWrittenScript ?
shivanisha 2016/08/24 17:47:40 Named such so that it is consistent with shouldDis
132 // Is it a fetch (non parser-blocking, lowest priority) for the blocked script.
133 AsyncLowPriorityFetchForBlockedScript,
haraken 2016/08/23 00:30:39 FetchDocWrittenScriptAsynchrously ?
shivanisha 2016/08/24 17:47:40 Wanted to say that it is a fetch for a script whos
134 };
135
136 DocumentWriteIntervention m_documentWriteIntervention;
137
124 Member<PendingScript> m_pendingScript; 138 Member<PendingScript> m_pendingScript;
125 }; 139 };
126 140
127 ScriptLoader* toScriptLoaderIfPossible(Element*); 141 ScriptLoader* toScriptLoaderIfPossible(Element*);
128 142
129 } // namespace blink 143 } // namespace blink
130 144
131 #endif // ScriptLoader_h 145 #endif // ScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698