| Index: Source/bindings/core/v8/ScriptStreamer.h
|
| diff --git a/Source/bindings/core/v8/ScriptStreamer.h b/Source/bindings/core/v8/ScriptStreamer.h
|
| index 78fa1cbc7e2a387bc835345646d88e676ebe6160..4bcc7f741977fbbd560cbc74461d15847bacd93d 100644
|
| --- a/Source/bindings/core/v8/ScriptStreamer.h
|
| +++ b/Source/bindings/core/v8/ScriptStreamer.h
|
| @@ -82,7 +82,7 @@ public:
|
|
|
| // Called by ScriptStreamingTask when it has streamed all data to V8 and V8
|
| // has processed it.
|
| - void streamingComplete();
|
| + void streamingCompleteOnBackgroundThread();
|
|
|
| static void removeSmallScriptThresholdForTesting()
|
| {
|
| @@ -96,8 +96,9 @@ private:
|
| // streamed. Non-const for testing.
|
| static size_t kSmallScriptThreshold;
|
|
|
| - ScriptStreamer(ScriptResource*, v8::ScriptCompiler::StreamedSource::Encoding, PendingScript::Type);
|
| + ScriptStreamer(ScriptResource*, v8::ScriptCompiler::StreamedSource::Encoding, PendingScript::Type, bool blockMainThreadAfterLoading);
|
|
|
| + void streamingComplete();
|
| void notifyFinishedToClient();
|
|
|
| static const char* startedStreamingHistogramName(PendingScript::Type);
|
| @@ -118,7 +119,9 @@ private:
|
| ScriptResourceClient* m_client;
|
| WTF::OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> m_task;
|
| bool m_loadingFinished; // Whether loading from the network is done.
|
| - bool m_parsingFinished; // Whether the V8 side processing is done.
|
| + // Whether the V8 side processing is done. Will be used by the main thread
|
| + // and the streamer thread; guarded by m_mutex.
|
| + bool m_parsingFinished;
|
| bool m_firstDataChunkReceived;
|
|
|
| // Whether the script source code should be retrieved from the Resource
|
| @@ -130,6 +133,13 @@ private:
|
|
|
| // For recording metrics for different types of scripts separately.
|
| PendingScript::Type m_scriptType;
|
| +
|
| + // Whether the main thread should block and wait for the parsing to complete
|
| + // after the load has finished. See ScriptStreamer::notifyFinished for more
|
| + // information.
|
| + bool m_blockMainThreadAfterLoading;
|
| + Mutex m_mutex;
|
| + ThreadCondition m_parsingFinishedCondition;
|
| };
|
|
|
| } // namespace blink
|
|
|