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

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

Issue 2540653002: Revert of 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 }
67 void executeScriptsWaitingForResources(); 70 void executeScriptsWaitingForResources();
68 bool executeScriptsWaitingForParsing(); 71 bool executeScriptsWaitingForParsing();
69 72
70 bool hasParserBlockingScript() const; 73 bool hasParserBlockingScript() const;
71 bool isExecutingScript() const { 74 bool isExecutingScript() const {
72 return !!m_reentryPermit->scriptNestingLevel(); 75 return !!m_reentryPermit->scriptNestingLevel();
73 } 76 }
74 77
75 // ResourceClient 78 // ResourceClient
76 void notifyFinished(Resource*) override; 79 void notifyFinished(Resource*) override;
77 String debugName() const override { return "HTMLScriptRunner"; } 80 String debugName() const override { return "HTMLScriptRunner"; }
78 81
79 DECLARE_TRACE(); 82 DECLARE_TRACE();
80 83
81 private: 84 private:
82 HTMLScriptRunner(HTMLParserReentryPermit*, Document*, HTMLScriptRunnerHost*); 85 HTMLScriptRunner(HTMLParserReentryPermit*, Document*, HTMLScriptRunnerHost*);
83 86
84 void executeParsingBlockingScript(); 87 void executeParsingBlockingScript();
85 void executePendingScriptAndDispatchEvent(PendingScript*, 88 void executePendingScriptAndDispatchEvent(PendingScript*,
86 ScriptStreamer::Type); 89 ScriptStreamer::Type);
87 void executeParsingBlockingScripts(); 90 void executeParsingBlockingScripts();
88 91
89 void requestParsingBlockingScript(Element*); 92 void requestParsingBlockingScript(Element*);
90 void requestDeferredScript(Element*); 93 void requestDeferredScript(Element*);
91 bool requestPendingScript(PendingScript*, Element*) const; 94 bool requestPendingScript(PendingScript*, Element*) const;
92 95
93 void runScript(Element*, const TextPosition& scriptStartPosition); 96 void runScript(Element*, const TextPosition& scriptStartPosition);
94 97
95 bool isPendingScriptReady(); 98 bool isPendingScriptReady(const PendingScript*);
96 99
97 void stopWatchingResourceForLoad(Resource*); 100 void stopWatchingResourceForLoad(Resource*);
98 101
99 void possiblyFetchBlockedDocWriteScript(Resource*); 102 void possiblyFetchBlockedDocWriteScript(Resource*);
100 103
101 RefPtr<HTMLParserReentryPermit> m_reentryPermit; 104 RefPtr<HTMLParserReentryPermit> m_reentryPermit;
102 Member<Document> m_document; 105 Member<Document> m_document;
103 Member<HTMLScriptRunnerHost> m_host; 106 Member<HTMLScriptRunnerHost> m_host;
104 Member<PendingScript> m_parserBlockingScript; 107 Member<PendingScript> m_parserBlockingScript;
105 // http://www.whatwg.org/specs/web-apps/current-work/#list-of-scripts-that-wil l-execute-when-the-document-has-finished-parsing 108 // http://www.whatwg.org/specs/web-apps/current-work/#list-of-scripts-that-wil l-execute-when-the-document-has-finished-parsing
106 HeapDeque<Member<PendingScript>> m_scriptsToExecuteAfterParsing; 109 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;
107 }; 116 };
108 117
109 } // namespace blink 118 } // namespace blink
110 119
111 #endif 120 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698