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

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

Issue 2800683005: Introduce PendingScript::startStreamingIfPossible() (Closed)
Patch Set: Rebase Created 3 years, 8 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) 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 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 // 4th Clause: 452 // 4th Clause:
453 // - "If the script's type is "classic", and the element has a src attribute" 453 // - "If the script's type is "classic", and the element has a src attribute"
454 // TODO(hiroshige): Check the script's type and implement "module" case. 454 // TODO(hiroshige): Check the script's type and implement "module" case.
455 if (m_element->hasSourceAttribute()) { 455 if (m_element->hasSourceAttribute()) {
456 // "The element must be added to the set of scripts that will execute 456 // "The element must be added to the set of scripts that will execute
457 // as soon as possible of the node document of the script element at the 457 // as soon as possible of the node document of the script element at the
458 // time the prepare a script algorithm started." 458 // time the prepare a script algorithm started."
459 m_pendingScript = PendingScript::create(m_element.get(), m_resource.get()); 459 m_pendingScript = PendingScript::create(m_element.get(), m_resource.get());
460 m_asyncExecType = ScriptRunner::Async; 460 m_asyncExecType = ScriptRunner::Async;
461 LocalFrame* frame = m_element->document().frame(); 461 m_pendingScript->startStreamingIfPossible(&m_element->document(),
462 if (frame) { 462 ScriptStreamer::Async);
463 ScriptState* scriptState = toScriptStateForMainWorld(frame);
464 if (scriptState)
465 ScriptStreamer::startStreaming(
466 m_pendingScript.get(), ScriptStreamer::Async, frame->settings(),
467 scriptState, frame->frameScheduler()->loadingTaskRunner());
468 }
469 // TODO(hiroshige): Here |contextDocument| is used as "node document" 463 // TODO(hiroshige): Here |contextDocument| is used as "node document"
470 // while Step 14 uses |elementDocument| as "node document". Fix this. 464 // while Step 14 uses |elementDocument| as "node document". Fix this.
471 contextDocument->scriptRunner()->queueScriptForExecution(this, 465 contextDocument->scriptRunner()->queueScriptForExecution(this,
472 m_asyncExecType); 466 m_asyncExecType);
473 // Note that watchForLoad can immediately call pendingScriptFinished. 467 // Note that watchForLoad can immediately call pendingScriptFinished.
474 m_pendingScript->watchForLoad(this); 468 m_pendingScript->watchForLoad(this);
475 // The part "When the script is ready..." is implemented in 469 // The part "When the script is ready..." is implemented in
476 // ScriptRunner::notifyScriptReady(). 470 // ScriptRunner::notifyScriptReady().
477 // TODO(hiroshige): Annotate it. 471 // TODO(hiroshige): Annotate it.
478 472
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 // then abort these steps at this point. The script is not executed. 865 // then abort these steps at this point. The script is not executed.
872 return equalIgnoringCase(eventAttribute, "onload") || 866 return equalIgnoringCase(eventAttribute, "onload") ||
873 equalIgnoringCase(eventAttribute, "onload()"); 867 equalIgnoringCase(eventAttribute, "onload()");
874 } 868 }
875 869
876 String ScriptLoader::scriptContent() const { 870 String ScriptLoader::scriptContent() const {
877 return m_element->textFromChildren(); 871 return m_element->textFromChildren();
878 } 872 }
879 873
880 } // namespace blink 874 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698