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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp

Issue 1667843003: Make Resource RefCountedWillBeGarbageCollectedFinalized, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + address review comments Created 4 years, 10 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: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
index 2dc568e38f54a08ef9626390ed84c894adfe69da..1cf24ad0ab7f5201110a47cc63aa1079a36684d4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -577,11 +577,11 @@ void ScriptStreamer::notifyFinished(Resource* resource)
notifyFinishedToClient();
}
-ScriptStreamer::ScriptStreamer(ScriptResource* resource, Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunner* loadingTaskRunner)
- : m_resource(resource)
+ScriptStreamer::ScriptStreamer(PendingScript* script, Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunner* loadingTaskRunner)
+ : m_pendingScript(script)
+ , m_resource(script->resource())
, m_detached(false)
, m_stream(0)
- , m_client(0)
, m_loadingFinished(false)
, m_parsingFinished(false)
, m_haveEnoughDataForStreaming(false)
@@ -600,6 +600,7 @@ ScriptStreamer::~ScriptStreamer()
DEFINE_TRACE(ScriptStreamer)
{
+ visitor->trace(m_pendingScript);
visitor->trace(m_resource);
}
@@ -642,8 +643,7 @@ void ScriptStreamer::notifyFinishedToClient()
if (!isFinished())
return;
- if (m_client)
- m_client->notifyFinished(m_resource);
+ m_pendingScript->streamingFinished();
}
bool ScriptStreamer::startStreamingInternal(PendingScript* script, Type scriptType, Settings* settings, ScriptState* scriptState, WebTaskRunner* loadingTaskRunner)
@@ -679,7 +679,7 @@ bool ScriptStreamer::startStreamingInternal(PendingScript* script, Type scriptTy
// The Resource might go out of scope if the script is no longer
// needed. This makes PendingScript notify the ScriptStreamer when it is
// destroyed.
- script->setStreamer(ScriptStreamer::create(resource, scriptType, scriptState, compileOption, loadingTaskRunner));
+ script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState, compileOption, loadingTaskRunner));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698