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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.h

Issue 2544733002: Reland Script blocking resources tracking should be only done by Document::isScriptExecutionReady" (Closed)
Patch Set: Created 4 years 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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 ~HTMLScriptRunner(); 58 ~HTMLScriptRunner();
59 59
60 void detach(); 60 void detach();
61 61
62 // Processes the passed in script and any pending scripts if possible. 62 // Processes the passed in script and any pending scripts if possible.
63 void execute(Element* scriptToProcess, 63 void execute(Element* scriptToProcess,
64 const TextPosition& scriptStartPosition); 64 const TextPosition& scriptStartPosition);
65 65
66 void executeScriptsWaitingForLoad(Resource*); 66 void executeScriptsWaitingForLoad(Resource*);
67 bool hasScriptsWaitingForResources() const {
68 return m_hasScriptsWaitingForResources;
69 }
70 void executeScriptsWaitingForResources(); 67 void executeScriptsWaitingForResources();
71 bool executeScriptsWaitingForParsing(); 68 bool executeScriptsWaitingForParsing();
72 69
73 bool hasParserBlockingScript() const; 70 bool hasParserBlockingScript() const;
74 bool isExecutingScript() const { 71 bool isExecutingScript() const {
75 return !!m_reentryPermit->scriptNestingLevel(); 72 return !!m_reentryPermit->scriptNestingLevel();
76 } 73 }
77 74
78 // ResourceClient 75 // ResourceClient
79 void notifyFinished(Resource*) override; 76 void notifyFinished(Resource*) override;
80 String debugName() const override { return "HTMLScriptRunner"; } 77 String debugName() const override { return "HTMLScriptRunner"; }
81 78
82 DECLARE_TRACE(); 79 DECLARE_TRACE();
83 80
84 private: 81 private:
85 HTMLScriptRunner(HTMLParserReentryPermit*, Document*, HTMLScriptRunnerHost*); 82 HTMLScriptRunner(HTMLParserReentryPermit*, Document*, HTMLScriptRunnerHost*);
86 83
87 void executeParsingBlockingScript(); 84 void executeParsingBlockingScript();
88 void executePendingScriptAndDispatchEvent(PendingScript*, 85 void executePendingScriptAndDispatchEvent(PendingScript*,
89 ScriptStreamer::Type); 86 ScriptStreamer::Type);
90 void executeParsingBlockingScripts(); 87 void executeParsingBlockingScripts();
91 88
92 void requestParsingBlockingScript(Element*); 89 void requestParsingBlockingScript(Element*);
93 void requestDeferredScript(Element*); 90 void requestDeferredScript(Element*);
94 bool requestPendingScript(PendingScript*, Element*) const; 91 bool requestPendingScript(PendingScript*, Element*) const;
95 92
96 void runScript(Element*, const TextPosition& scriptStartPosition); 93 void runScript(Element*, const TextPosition& scriptStartPosition);
97 94
98 bool isPendingScriptReady(const PendingScript*); 95 bool isPendingScriptReady();
99 96
100 void stopWatchingResourceForLoad(Resource*); 97 void stopWatchingResourceForLoad(Resource*);
101 98
102 void possiblyFetchBlockedDocWriteScript(Resource*); 99 void possiblyFetchBlockedDocWriteScript(Resource*);
103 100
104 RefPtr<HTMLParserReentryPermit> m_reentryPermit; 101 RefPtr<HTMLParserReentryPermit> m_reentryPermit;
105 Member<Document> m_document; 102 Member<Document> m_document;
106 Member<HTMLScriptRunnerHost> m_host; 103 Member<HTMLScriptRunnerHost> m_host;
107 Member<PendingScript> m_parserBlockingScript; 104 Member<PendingScript> m_parserBlockingScript;
108 // http://www.whatwg.org/specs/web-apps/current-work/#list-of-scripts-that-wil l-execute-when-the-document-has-finished-parsing 105 // http://www.whatwg.org/specs/web-apps/current-work/#list-of-scripts-that-wil l-execute-when-the-document-has-finished-parsing
109 HeapDeque<Member<PendingScript>> m_scriptsToExecuteAfterParsing; 106 HeapDeque<Member<PendingScript>> m_scriptsToExecuteAfterParsing;
110
111 // We only want stylesheet loads to trigger script execution if script
112 // execution is currently stopped due to stylesheet loads, otherwise we'd
113 // cause nested script execution when parsing <style> tags since </style>
114 // tags can cause Document to call executeScriptsWaitingForResources.
115 bool m_hasScriptsWaitingForResources;
116 }; 107 };
117 108
118 } // namespace blink 109 } // namespace blink
119 110
120 #endif 111 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698