| 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 #ifndef ScriptStreamerThread_h | 5 #ifndef ScriptStreamerThread_h |
| 6 #define ScriptStreamerThread_h | 6 #define ScriptStreamerThread_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "platform/TaskSynchronizer.h" | 9 #include "platform/TaskSynchronizer.h" |
| 10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 ScriptStreamerThread() | 38 ScriptStreamerThread() |
| 39 : m_runningTask(false) { } | 39 : m_runningTask(false) { } |
| 40 | 40 |
| 41 bool isRunning() const | 41 bool isRunning() const |
| 42 { | 42 { |
| 43 return !!m_thread; | 43 return !!m_thread; |
| 44 } | 44 } |
| 45 | 45 |
| 46 blink::WebThread& platformThread(); | 46 WebThread& platformThread(); |
| 47 | 47 |
| 48 // At the moment, we only use one thread, so we can only stream one script | 48 // At the moment, we only use one thread, so we can only stream one script |
| 49 // at a time. FIXME: Use a thread pool and stream multiple scripts. | 49 // at a time. FIXME: Use a thread pool and stream multiple scripts. |
| 50 WTF::OwnPtr<blink::WebThread> m_thread; | 50 WTF::OwnPtr<WebThread> m_thread; |
| 51 bool m_runningTask; | 51 bool m_runningTask; |
| 52 mutable Mutex m_mutex; // Guards m_runningTask. | 52 mutable Mutex m_mutex; // Guards m_runningTask. |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 class ScriptStreamingTask : public WebThread::Task { | 55 class ScriptStreamingTask : public WebThread::Task { |
| 56 WTF_MAKE_NONCOPYABLE(ScriptStreamingTask); | 56 WTF_MAKE_NONCOPYABLE(ScriptStreamingTask); |
| 57 public: | 57 public: |
| 58 ScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask>
, ScriptStreamer*); | 58 ScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask>
, ScriptStreamer*); |
| 59 virtual void run() override; | 59 virtual void run() override; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 WTF::OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> m_v8Task; | 62 WTF::OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> m_v8Task; |
| 63 ScriptStreamer* m_streamer; | 63 ScriptStreamer* m_streamer; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 | 66 |
| 67 } // namespace blink | 67 } // namespace blink |
| 68 | 68 |
| 69 #endif // ScriptStreamerThread_h | 69 #endif // ScriptStreamerThread_h |
| OLD | NEW |