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

Side by Side Diff: Source/core/html/parser/HTMLScriptRunner.cpp

Issue 298863010: Oilpan: have PendingScripts trace their script elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add PendingScript::m_element comment + GC plugin annotation. Created 6 years, 7 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) 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 Microtask::performCheckpoint(); 135 Microtask::performCheckpoint();
136 if (pendingScriptType == PendingScriptBlockingParser) { 136 if (pendingScriptType == PendingScriptBlockingParser) {
137 m_hasScriptsWaitingForResources = !m_document->isScriptExecutionRead y(); 137 m_hasScriptsWaitingForResources = !m_document->isScriptExecutionRead y();
138 // The parser cannot be unblocked as a microtask requested another r esource 138 // The parser cannot be unblocked as a microtask requested another r esource
139 if (m_hasScriptsWaitingForResources) 139 if (m_hasScriptsWaitingForResources)
140 return; 140 return;
141 } 141 }
142 } 142 }
143 143
144 // Clear the pending script before possible rentrancy from executeScript() 144 // Clear the pending script before possible rentrancy from executeScript()
145 RefPtr<Element> element = pendingScript.releaseElementAndClear(); 145 RefPtrWillBeRawPtr<Element> element = pendingScript.releaseElementAndClear() ;
146 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { 146 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) {
147 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); 147 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
148 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document); 148 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem enter(m_document);
149 if (errorOccurred) 149 if (errorOccurred)
150 scriptLoader->dispatchErrorEvent(); 150 scriptLoader->dispatchErrorEvent();
151 else { 151 else {
152 ASSERT(isExecutingScript()); 152 ASSERT(isExecutingScript());
153 scriptLoader->executeScript(sourceCode); 153 scriptLoader->executeScript(sourceCode);
154 element->dispatchEvent(createScriptLoadEvent()); 154 element->dispatchEvent(createScriptLoadEvent());
155 } 155 }
(...skipping 11 matching lines...) Expand all
167 void HTMLScriptRunner::stopWatchingForLoad(PendingScript& pendingScript) 167 void HTMLScriptRunner::stopWatchingForLoad(PendingScript& pendingScript)
168 { 168 {
169 ASSERT(pendingScript.watchingForLoad()); 169 ASSERT(pendingScript.watchingForLoad());
170 m_host->stopWatchingForLoad(pendingScript.resource()); 170 m_host->stopWatchingForLoad(pendingScript.resource());
171 pendingScript.setWatchingForLoad(false); 171 pendingScript.setWatchingForLoad(false);
172 } 172 }
173 173
174 // Implements the steps for 'An end tag whose tag name is "script"' 174 // Implements the steps for 'An end tag whose tag name is "script"'
175 // http://whatwg.org/html#scriptEndTag 175 // http://whatwg.org/html#scriptEndTag
176 // Script handling lives outside the tree builder to keep each class simple. 176 // Script handling lives outside the tree builder to keep each class simple.
177 void HTMLScriptRunner::execute(PassRefPtr<Element> scriptElement, const TextPosi tion& scriptStartPosition) 177 void HTMLScriptRunner::execute(PassRefPtrWillBeRawPtr<Element> scriptElement, co nst TextPosition& scriptStartPosition)
178 { 178 {
179 ASSERT(scriptElement); 179 ASSERT(scriptElement);
180 // FIXME: If scripting is disabled, always just return. 180 // FIXME: If scripting is disabled, always just return.
181 181
182 bool hadPreloadScanner = m_host->hasPreloadScanner(); 182 bool hadPreloadScanner = m_host->hasPreloadScanner();
183 183
184 // Try to execute the script given to us. 184 // Try to execute the script given to us.
185 runScript(scriptElement.get(), scriptStartPosition); 185 runScript(scriptElement.get(), scriptStartPosition);
186 186
187 if (hasParserBlockingScript()) { 187 if (hasParserBlockingScript()) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } else { 321 } else {
322 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition); 322 ScriptSourceCode sourceCode(script->textContent(), documentURLFo rScriptExecution(m_document), scriptStartPosition);
323 scriptLoader->executeScript(sourceCode); 323 scriptLoader->executeScript(sourceCode);
324 } 324 }
325 } else { 325 } else {
326 requestParsingBlockingScript(script); 326 requestParsingBlockingScript(script);
327 } 327 }
328 } 328 }
329 } 329 }
330 330
331 void HTMLScriptRunner::trace(Visitor* visitor)
332 {
333 visitor->trace(m_parserBlockingScript);
334 visitor->trace(m_scriptsToExecuteAfterParsing);
331 } 335 }
336
337 }
OLDNEW
« Source/core/dom/ScriptRunner.h ('K') | « Source/core/html/parser/HTMLScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698