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

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: extra new lines removed 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 21 matching lines...) Expand all
32 namespace blink { 32 namespace blink {
33 33
34 class Element; 34 class Element;
35 class ScriptLoaderClient; 35 class ScriptLoaderClient;
36 class ScriptSourceCode; 36 class ScriptSourceCode;
37 class LocalFrame; 37 class LocalFrame;
38 38
39 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>, public ScriptResourceClient { 39 class CORE_EXPORT ScriptLoader : public GarbageCollectedFinalized<ScriptLoader>, public ScriptResourceClient {
40 USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader); 40 USING_GARBAGE_COLLECTED_MIXIN(ScriptLoader);
41 public: 41 public:
42 static ScriptLoader* create(Element* element, bool createdByParser, bool isE valuated, bool createdDuringDocumentWrite = false) 42 static ScriptLoader* create(Element* element, bool createdByParser, bool isE valuated, bool createdDuringDocumentWrite = false, bool blockedDocWriteScriptAsy ncFetch = false)
43 { 43 {
44 return new ScriptLoader(element, createdByParser, isEvaluated, createdDu ringDocumentWrite); 44 return new ScriptLoader(element, createdByParser, isEvaluated, createdDu ringDocumentWrite, blockedDocWriteScriptAsyncFetch);
45 } 45 }
46 46
47 ~ScriptLoader() override; 47 ~ScriptLoader() override;
48 DECLARE_VIRTUAL_TRACE(); 48 DECLARE_VIRTUAL_TRACE();
49 49
50 Element* element() const { return m_element; } 50 Element* element() const { return m_element; }
51 51
52 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI nTypeAttribute }; 52 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI nTypeAttribute };
53 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); 53 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute);
54 54
(...skipping 26 matching lines...) Expand all
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_disallowedFetchForDocWr ittenScript; }
92
91 protected: 93 protected:
92 ScriptLoader(Element*, bool createdByParser, bool isEvaluated, bool createdD uringDocumentWrite); 94 ScriptLoader(Element*, bool createdByParser, bool isEvaluated, bool createdD uringDocumentWrite, bool blockedDocWriteScriptAsyncFetch);
93 95
94 private: 96 private:
95 bool ignoresLoadRequest() const; 97 bool ignoresLoadRequest() const;
96 bool isScriptForEventSupported() const; 98 bool isScriptForEventSupported() const;
97 void logScriptMimetype(ScriptResource*, LocalFrame*, String); 99 void logScriptMimetype(ScriptResource*, LocalFrame*, String);
98 100
99 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); 101 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption);
100 102
101 ScriptLoaderClient* client() const; 103 ScriptLoaderClient* client() const;
102 104
(...skipping 10 matching lines...) Expand all
113 bool m_parserInserted : 1; 115 bool m_parserInserted : 1;
114 bool m_isExternalScript : 1; 116 bool m_isExternalScript : 1;
115 bool m_alreadyStarted : 1; 117 bool m_alreadyStarted : 1;
116 bool m_haveFiredLoad : 1; 118 bool m_haveFiredLoad : 1;
117 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin g the script." 119 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin g the script."
118 bool m_readyToBeParserExecuted : 1; 120 bool m_readyToBeParserExecuted : 1;
119 bool m_willExecuteInOrder : 1; 121 bool m_willExecuteInOrder : 1;
120 bool m_willExecuteWhenDocumentFinishedParsing : 1; 122 bool m_willExecuteWhenDocumentFinishedParsing : 1;
121 bool m_forceAsync : 1; 123 bool m_forceAsync : 1;
122 const bool m_createdDuringDocumentWrite : 1; 124 const bool m_createdDuringDocumentWrite : 1;
125 bool m_disallowedFetchForDocWrittenScript : 1; // This script will be blocke d if not present in http cache.
Charlie Harrison 2016/08/19 21:24:27 Can these be combined into an enum flag?
shivanisha 2016/08/22 16:15:21 Done for readability and the fact that both of the
126 const bool m_blockedDocWriteScriptAsyncFetch : 1; // Non parser-blocking low est priority fetch for the blocked script.
Charlie Harrison 2016/08/19 21:24:27 The comment here doesn't really specify what the "
shivanisha 2016/08/22 16:15:21 done.
123 127
124 Member<PendingScript> m_pendingScript; 128 Member<PendingScript> m_pendingScript;
125 }; 129 };
126
127 ScriptLoader* toScriptLoaderIfPossible(Element*); 130 ScriptLoader* toScriptLoaderIfPossible(Element*);
128
129 } // namespace blink 131 } // namespace blink
130 132
131 #endif // ScriptLoader_h 133 #endif // ScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698