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

Side by Side Diff: Source/bindings/core/v8/ScriptStreamerThread.cpp

Issue 680493002: Revert "Script streaming: Add an option to make the main thread block (wait for parsing)" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/ScriptStreamerThread.h" 6 #include "bindings/core/v8/ScriptStreamerThread.h"
7 7
8 #include "bindings/core/v8/ScriptStreamer.h" 8 #include "bindings/core/v8/ScriptStreamer.h"
9 #include "platform/Task.h" 9 #include "platform/Task.h"
10 #include "platform/TraceEvent.h" 10 #include "platform/TraceEvent.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 ScriptStreamingTask::ScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::Scr iptStreamingTask> task, ScriptStreamer* streamer) 61 ScriptStreamingTask::ScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::Scr iptStreamingTask> task, ScriptStreamer* streamer)
62 : m_v8Task(task), m_streamer(streamer) { } 62 : m_v8Task(task), m_streamer(streamer) { }
63 63
64 void ScriptStreamingTask::run() 64 void ScriptStreamingTask::run()
65 { 65 {
66 TRACE_EVENT0("v8", "v8.parseOnBackground"); 66 TRACE_EVENT0("v8", "v8.parseOnBackground");
67 // Running the task can and will block: SourceStream::GetSomeData will get 67 // Running the task can and will block: SourceStream::GetSomeData will get
68 // called and it will block and wait for data from the network. 68 // called and it will block and wait for data from the network.
69 m_v8Task->Run(); 69 m_v8Task->Run();
70 m_streamer->streamingCompleteOnBackgroundThread(); 70 // Post a task to the main thread to signal that V8 has completed the
71 // streaming.
72 callOnMainThread(WTF::bind(&ScriptStreamer::streamingComplete, m_streamer));
71 ScriptStreamerThread::shared()->taskDone(); 73 ScriptStreamerThread::shared()->taskDone();
72 } 74 }
73 75
74 } // namespace blink 76 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamerTest.cpp ('k') | Source/bindings/core/v8/ScriptStreamingMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698