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

Unified Diff: Source/core/dom/PendingScript.cpp

Issue 368283002: Stream scripts to V8 as they load - Blink side. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: renaming Created 6 years, 4 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
Index: Source/core/dom/PendingScript.cpp
diff --git a/Source/core/dom/PendingScript.cpp b/Source/core/dom/PendingScript.cpp
index 3808001d912aeea101fb1da68546781926476da4..426a35172fa6a0db2f1bd96108468a9d94cfc0da 100644
--- a/Source/core/dom/PendingScript.cpp
+++ b/Source/core/dom/PendingScript.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "core/dom/PendingScript.h"
+#include "bindings/core/v8/V8ScriptStreamer.h"
#include "core/dom/Element.h"
#include "core/fetch/ScriptResource.h"
@@ -33,6 +34,8 @@ namespace blink {
PendingScript::~PendingScript()
{
+ if (m_streamer)
+ m_streamer->cancel();
haraken 2014/08/17 16:05:28 Doing something non-trivial in a destructor is lik
marja 2014/08/20 11:45:56 This code turned out to be unnecessary after I ref
}
PassRefPtrWillBeRawPtr<Element> PendingScript::releaseElementAndClear()
@@ -45,11 +48,22 @@ PassRefPtrWillBeRawPtr<Element> PendingScript::releaseElementAndClear()
void PendingScript::setScriptResource(ScriptResource* resource)
{
+ ASSERT(!m_streamer);
setResource(resource);
}
void PendingScript::notifyFinished(Resource*)
{
+ if (m_streamer) {
+ m_streamer->notifyFinished();
+ }
+}
+
+void PendingScript::notifyAppendData(ScriptResource*)
+{
+ if (m_streamer) {
+ m_streamer->notifyAppendData();
+ }
}
void PendingScript::trace(Visitor* visitor)
@@ -57,4 +71,9 @@ void PendingScript::trace(Visitor* visitor)
visitor->trace(m_element);
}
+bool PendingScript::isStreaming() const
+{
+ return m_streamer && m_streamer->streamingInProgress();
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698