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

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: Rebased. Created 4 years, 3 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::DoNotFetchDocWrittenScript; }
92 void setFetchDocWrittenScriptDeferIdle();
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 DoNotFetchDocWrittenScript,
132 // If a parser blocking doc.written script was not fetched and was not
133 // present in the http cache, send a GET for it with an interventions
134 // header to allow the server to know of the intervention. This fetch
135 // will be using DeferOption::IdleLoad to keep it out of the critical
136 // path.
137 FetchDocWrittenScriptDeferIdle,
haraken 2016/09/07 01:47:36 FetchDocWrittenScriptInIdleTask ?
shivanisha 2016/09/15 20:35:08 used DeferIdle in the name to convey the usage of
138 };
139
140 DocumentWriteIntervention m_documentWriteIntervention;
141
124 Member<PendingScript> m_pendingScript; 142 Member<PendingScript> m_pendingScript;
125 }; 143 };
126 144
127 ScriptLoader* toScriptLoaderIfPossible(Element*); 145 ScriptLoader* toScriptLoaderIfPossible(Element*);
128 146
129 } // namespace blink 147 } // namespace blink
130 148
131 #endif // ScriptLoader_h 149 #endif // ScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698