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

Unified Diff: Source/core/html/parser/HTMLScriptRunner.cpp

Issue 288673002: Make ScriptLoader into a ResourceOwner (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/parser/HTMLScriptRunner.h ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLScriptRunner.cpp
diff --git a/Source/core/html/parser/HTMLScriptRunner.cpp b/Source/core/html/parser/HTMLScriptRunner.cpp
index 91e008b4ca370d5714c448ded81c215f60c1d77e..6a66243a9f6a0a17540d401b21443727dee5ebc5 100644
--- a/Source/core/html/parser/HTMLScriptRunner.cpp
+++ b/Source/core/html/parser/HTMLScriptRunner.cpp
@@ -244,9 +244,9 @@ bool HTMLScriptRunner::executeScriptsWaitingForParsing()
return true;
}
-void HTMLScriptRunner::requestParsingBlockingScript(Element* element)
+void HTMLScriptRunner::requestParsingBlockingScript(const ResourcePtr<ScriptResource>& resource, Element* element)
{
- if (!requestPendingScript(m_parserBlockingScript, element))
+ if (!requestPendingScript(resource, m_parserBlockingScript, element))
return;
ASSERT(m_parserBlockingScript.resource());
@@ -258,27 +258,26 @@ void HTMLScriptRunner::requestParsingBlockingScript(Element* element)
watchForLoad(m_parserBlockingScript);
}
-void HTMLScriptRunner::requestDeferredScript(Element* element)
+void HTMLScriptRunner::requestDeferredScript(const ResourcePtr<ScriptResource>& resource, Element* element)
{
PendingScript pendingScript;
- if (!requestPendingScript(pendingScript, element))
+ if (!requestPendingScript(resource, pendingScript, element))
return;
ASSERT(pendingScript.resource());
m_scriptsToExecuteAfterParsing.append(pendingScript);
}
-bool HTMLScriptRunner::requestPendingScript(PendingScript& pendingScript, Element* script) const
+bool HTMLScriptRunner::requestPendingScript(const ResourcePtr<ScriptResource>& resource, PendingScript& pendingScript, Element* script) const
{
ASSERT(!pendingScript.element());
pendingScript.setElement(script);
// This should correctly return 0 for empty or invalid srcValues.
- ScriptResource* resource = toScriptLoaderIfPossible(script)->resource().get();
if (!resource) {
notImplemented(); // Dispatch error event.
return false;
}
- pendingScript.setScriptResource(resource);
+ pendingScript.setScriptResource(resource.get());
return true;
}
@@ -307,13 +306,13 @@ void HTMLScriptRunner::runScript(Element* script, const TextPosition& scriptStar
InsertionPointRecord insertionPointRecord(m_host->inputStream());
NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);
- scriptLoader->prepareScript(scriptStartPosition);
+ ScriptPrep prep = scriptLoader->prepareScript(scriptStartPosition);
if (!scriptLoader->willBeParserExecuted())
return;
if (scriptLoader->willExecuteWhenDocumentFinishedParsing()) {
- requestDeferredScript(script);
+ requestDeferredScript(prep.resource(), script);
} else if (scriptLoader->readyToBeParserExecuted()) {
if (m_scriptNestingLevel == 1) {
m_parserBlockingScript.setElement(script);
@@ -323,7 +322,7 @@ void HTMLScriptRunner::runScript(Element* script, const TextPosition& scriptStar
scriptLoader->executeScript(sourceCode);
}
} else {
- requestParsingBlockingScript(script);
+ requestParsingBlockingScript(prep.resource(), script);
}
}
}
« no previous file with comments | « Source/core/html/parser/HTMLScriptRunner.h ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698