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

Side by Side Diff: Source/core/dom/ScriptLoader.cpp

Issue 645443004: Script streaming: stream async scripts too. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 m_willBeParserExecuted = true; 246 m_willBeParserExecuted = true;
247 m_readyToBeParserExecuted = true; 247 m_readyToBeParserExecuted = true;
248 } else if (client->hasSourceAttribute() && !client->asyncAttributeValue() && !m_forceAsync) { 248 } else if (client->hasSourceAttribute() && !client->asyncAttributeValue() && !m_forceAsync) {
249 m_willExecuteInOrder = true; 249 m_willExecuteInOrder = true;
250 m_pendingScript = PendingScript(m_element, m_resource.get()); 250 m_pendingScript = PendingScript(m_element, m_resource.get());
251 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun ner::IN_ORDER_EXECUTION); 251 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun ner::IN_ORDER_EXECUTION);
252 // Note that watchForLoad can immediately call notifyFinished. 252 // Note that watchForLoad can immediately call notifyFinished.
253 m_pendingScript.watchForLoad(this); 253 m_pendingScript.watchForLoad(this);
254 } else if (client->hasSourceAttribute()) { 254 } else if (client->hasSourceAttribute()) {
255 m_pendingScript = PendingScript(m_element, m_resource.get()); 255 m_pendingScript = PendingScript(m_element, m_resource.get());
256 LocalFrame* frame = m_element->document().frame();
257 if (frame) {
258 ScriptStreamer::startStreaming(m_pendingScript, frame->settings(), S criptState::forMainWorld(frame), PendingScript::Async);
259 }
256 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun ner::ASYNC_EXECUTION); 260 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun ner::ASYNC_EXECUTION);
257 // Note that watchForLoad can immediately call notifyFinished. 261 // Note that watchForLoad can immediately call notifyFinished.
258 m_pendingScript.watchForLoad(this); 262 m_pendingScript.watchForLoad(this);
259 } else { 263 } else {
260 // Reset line numbering for nested writes. 264 // Reset line numbering for nested writes.
261 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi on() : scriptStartPosition; 265 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi on() : scriptStartPosition;
262 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert ed) ? elementDocument.url() : KURL(); 266 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert ed) ? elementDocument.url() : KURL();
263 executeScript(ScriptSourceCode(scriptContent(), scriptURL, position)); 267 executeScript(ScriptSourceCode(scriptContent(), scriptURL, position));
264 } 268 }
265 269
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 if (isHTMLScriptLoader(element)) 460 if (isHTMLScriptLoader(element))
457 return toHTMLScriptElement(element)->loader(); 461 return toHTMLScriptElement(element)->loader();
458 462
459 if (isSVGScriptLoader(element)) 463 if (isSVGScriptLoader(element))
460 return toSVGScriptElement(element)->loader(); 464 return toSVGScriptElement(element)->loader();
461 465
462 return 0; 466 return 0;
463 } 467 }
464 468
465 } // namespace blink 469 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698