Index: third_party/WebKit/Source/core/dom/PendingScript.cpp |
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.cpp b/third_party/WebKit/Source/core/dom/PendingScript.cpp |
index 4771069d7d7d2441578ca73f93d1c3db92347f33..049af533de121697d441094207a27a7c9f46b217 100644 |
--- a/third_party/WebKit/Source/core/dom/PendingScript.cpp |
+++ b/third_party/WebKit/Source/core/dom/PendingScript.cpp |
@@ -26,7 +26,12 @@ |
#include "core/dom/PendingScript.h" |
#include "bindings/core/v8/ScriptSourceCode.h" |
+#include "bindings/core/v8/ScriptState.h" |
+#include "bindings/core/v8/V8Binding.h" |
+#include "core/dom/Document.h" |
#include "core/dom/ScriptElementBase.h" |
+#include "core/dom/TaskRunnerHelper.h" |
+#include "core/frame/LocalFrame.h" |
#include "core/frame/SubresourceIntegrity.h" |
#include "platform/SharedBuffer.h" |
#include "wtf/CurrentTime.h" |
@@ -273,4 +278,19 @@ void PendingScript::onPurgeMemory() { |
m_streamer = nullptr; |
} |
+void PendingScript::startStreamingIfPossible( |
+ Document* document, |
+ ScriptStreamer::Type streamerType) { |
+ if (!document->frame()) |
+ return; |
+ |
+ ScriptState* scriptState = toScriptStateForMainWorld(document->frame()); |
+ if (!scriptState) |
+ return; |
+ |
+ ScriptStreamer::startStreaming( |
+ this, streamerType, document->frame()->settings(), scriptState, |
+ TaskRunnerHelper::get(TaskType::Networking, document)); |
+} |
+ |
} // namespace blink |