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" |
11 #include "wtf/OwnPtr.h" | 11 #include "wtf/OwnPtr.h" |
12 | 12 |
13 #include <v8.h> | 13 #include <v8.h> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class ScriptStreamer; | 17 class ScriptStreamer; |
18 | 18 |
19 // A singleton thread for running background tasks for script streaming. | 19 // A singleton thread for running background tasks for script streaming. |
20 class CORE_EXPORT ScriptStreamerThread { | 20 class CORE_EXPORT ScriptStreamerThread { |
| 21 WTF_MAKE_FAST_ALLOCATED(ScriptStreamerThread); |
21 WTF_MAKE_NONCOPYABLE(ScriptStreamerThread); | 22 WTF_MAKE_NONCOPYABLE(ScriptStreamerThread); |
22 public: | 23 public: |
23 static void init(); | 24 static void init(); |
24 static void shutdown(); | 25 static void shutdown(); |
25 static ScriptStreamerThread* shared(); | 26 static ScriptStreamerThread* shared(); |
26 | 27 |
27 void postTask(WebThread::Task*); | 28 void postTask(WebThread::Task*); |
28 | 29 |
29 bool isRunningTask() const | 30 bool isRunningTask() const |
30 { | 31 { |
(...skipping 19 matching lines...) Expand all Loading... |
50 // At the moment, we only use one thread, so we can only stream one script | 51 // At the moment, we only use one thread, so we can only stream one script |
51 // at a time. FIXME: Use a thread pool and stream multiple scripts. | 52 // at a time. FIXME: Use a thread pool and stream multiple scripts. |
52 WTF::OwnPtr<WebThread> m_thread; | 53 WTF::OwnPtr<WebThread> m_thread; |
53 bool m_runningTask; | 54 bool m_runningTask; |
54 mutable Mutex m_mutex; // Guards m_runningTask. | 55 mutable Mutex m_mutex; // Guards m_runningTask. |
55 }; | 56 }; |
56 | 57 |
57 } // namespace blink | 58 } // namespace blink |
58 | 59 |
59 #endif // ScriptStreamerThread_h | 60 #endif // ScriptStreamerThread_h |
OLD | NEW |