Chromium Code Reviews| Index: Source/bindings/core/v8/ScriptStreamer.h |
| diff --git a/Source/bindings/core/v8/ScriptStreamer.h b/Source/bindings/core/v8/ScriptStreamer.h |
| index c61e1337c796281606fc7a327a178078222dd4d3..aced27713e21d8f423cde608fbf66b9a8ce8c89e 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 setSmallScriptThresholdForTesting(size_t threshold) |
| { |
| @@ -96,10 +96,16 @@ 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); |
|
jochen (gone - plz use gerrit)
2014/10/23 09:40:59
nit. enum instead of bool maybe?
marja
2014/10/23 14:11:45
Done: Passing the mode here (as discussed).
|
| + void streamingComplete(); |
| void notifyFinishedToClient(); |
| + bool shouldBlockMainThread() const |
| + { |
| + return m_blockMainThreadAfterLoading && m_scriptType == PendingScript::ParsingBlocking; |
| + } |
| + |
| static const char* startedStreamingHistogramName(PendingScript::Type); |
| static bool startStreamingInternal(PendingScript&, Settings*, ScriptState*, PendingScript::Type); |
| @@ -118,7 +124,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; |
| // Whether we have received enough data to start the streaming. |
| bool m_haveEnoughDataForStreaming; |
| @@ -131,6 +139,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 |