| OLD | NEW |
| 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 Loading... |
| 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 // Post a task to the main thread to signal that V8 has completed the | 70 m_streamer->streamingCompleteOnBackgroundThread(); |
| 71 // streaming. | |
| 72 callOnMainThread(WTF::bind(&ScriptStreamer::streamingComplete, m_streamer)); | |
| 73 ScriptStreamerThread::shared()->taskDone(); | 71 ScriptStreamerThread::shared()->taskDone(); |
| 74 } | 72 } |
| 75 | 73 |
| 76 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |