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

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

Issue 1402933002: Revert "Post loading tasks on the appropriate WebFrameScheduler's queue." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 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 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 7c178f92e957a916aaaa2bc39b0934728b41cad6..d38e6ccfb0438278a3ef60a1d04628207d2d40ba 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp
@@ -18,7 +18,6 @@
#include "platform/ThreadSafeFunctional.h"
#include "platform/TraceEvent.h"
#include "public/platform/Platform.h"
-#include "public/platform/WebScheduler.h"
#include "wtf/MainThread.h"
#include "wtf/text/TextEncodingRegistry.h"
@@ -163,7 +162,7 @@ private:
class SourceStream : public v8::ScriptCompiler::ExternalSourceStream {
WTF_MAKE_NONCOPYABLE(SourceStream);
public:
- explicit SourceStream(WebTaskRunner* loadingTaskRunner)
+ SourceStream()
: v8::ScriptCompiler::ExternalSourceStream()
, m_cancelled(false)
, m_finished(false)
@@ -171,7 +170,6 @@ public:
, m_queueTailPosition(0)
, m_bookmarkPosition(0)
, m_lengthOfBOM(0)
- , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone()))
{
}
@@ -221,7 +219,7 @@ public:
}
// Inform main thread to re-queue the data.
- m_loadingTaskRunner->postTask(
+ Platform::current()->mainThread()->taskRunner()->postTask(
FROM_HERE, bind(&SourceStream::fetchDataFromResourceBuffer, this, 0));
}
@@ -372,18 +370,16 @@ private:
// We store this separately, to avoid having to guard all
// m_queueLeadPosition references with a mutex.
unsigned m_lengthOfBOM; // Used by both threads; guarded by m_mutex.
-
- OwnPtr<WebTaskRunner> m_loadingTaskRunner;
};
size_t ScriptStreamer::kSmallScriptThreshold = 30 * 1024;
-void ScriptStreamer::startStreaming(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState, WebTaskRunner* loadingTaskRunner)
+void ScriptStreamer::startStreaming(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState)
{
// We don't yet know whether the script will really be streamed. E.g.,
// suppressing streaming for short scripts is done later. Record only the
// sure negative cases here.
- bool startedStreaming = startStreamingInternal(script, scriptType, settings, scriptState, loadingTaskRunner);
+ bool startedStreaming = startStreamingInternal(script, scriptType, settings, scriptState);
if (!startedStreaming)
Platform::current()->histogramEnumeration(startedStreamingHistogramName(scriptType), 0, 2);
}
@@ -425,7 +421,7 @@ void ScriptStreamer::streamingCompleteOnBackgroundThread()
// notifyFinished might already be called, or it might be called in the
// future (if the parsing finishes earlier because of a parse error).
- m_loadingTaskRunner->postTask(FROM_HERE, threadSafeBind(&ScriptStreamer::streamingComplete, AllowCrossThreadAccess(this)));
+ Platform::current()->mainThread()->taskRunner()->postTask(FROM_HERE, threadSafeBind(&ScriptStreamer::streamingComplete, AllowCrossThreadAccess(this)));
// The task might delete ScriptStreamer, so it's not safe to do anything
// after posting it. Note that there's no way to guarantee that this
@@ -517,7 +513,7 @@ void ScriptStreamer::notifyAppendData(ScriptResource* resource)
ASSERT(!m_stream);
ASSERT(!m_source);
- m_stream = new SourceStream(m_loadingTaskRunner.get());
+ m_stream = new SourceStream();
// m_source takes ownership of m_stream.
m_source = adoptPtr(new v8::ScriptCompiler::StreamedSource(m_stream, m_encoding));
@@ -568,7 +564,7 @@ void ScriptStreamer::notifyFinished(Resource* resource)
notifyFinishedToClient();
}
-ScriptStreamer::ScriptStreamer(ScriptResource* resource, PendingScript::Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunner* loadingTaskRunner)
+ScriptStreamer::ScriptStreamer(ScriptResource* resource, PendingScript::Type scriptType, ScriptState* scriptState, v8::ScriptCompiler::CompileOptions compileOptions)
: m_resource(resource)
, m_detached(false)
, m_stream(0)
@@ -581,7 +577,6 @@ ScriptStreamer::ScriptStreamer(ScriptResource* resource, PendingScript::Type scr
, m_scriptState(scriptState)
, m_scriptType(scriptType)
, m_encoding(v8::ScriptCompiler::StreamedSource::TWO_BYTE) // Unfortunately there's no dummy encoding value in the enum; let's use one we don't stream.
- , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone()))
{
}
@@ -637,7 +632,7 @@ void ScriptStreamer::notifyFinishedToClient()
m_client->notifyFinished(m_resource);
}
-bool ScriptStreamer::startStreamingInternal(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState, WebTaskRunner* loadingTaskRunner)
+bool ScriptStreamer::startStreamingInternal(PendingScript& script, PendingScript::Type scriptType, Settings* settings, ScriptState* scriptState)
{
ASSERT(isMainThread());
ASSERT(scriptState->contextIsValid());
@@ -670,7 +665,7 @@ bool ScriptStreamer::startStreamingInternal(PendingScript& script, PendingScript
// 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(resource, scriptType, scriptState, compileOption));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698