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

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

Issue 1303153005: Introduce WebTaskRunner Patch 3/5 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing #include Created 5 years, 3 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 #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/WebTaskRunner.h"
10 #include "public/platform/WebThread.h" 11 #include "public/platform/WebThread.h"
11 #include "wtf/OwnPtr.h" 12 #include "wtf/OwnPtr.h"
12 13
13 #include <v8.h> 14 #include <v8.h>
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class ScriptStreamer; 18 class ScriptStreamer;
18 19
19 // A singleton thread for running background tasks for script streaming. 20 // A singleton thread for running background tasks for script streaming.
20 class CORE_EXPORT ScriptStreamerThread { 21 class CORE_EXPORT ScriptStreamerThread {
21 WTF_MAKE_FAST_ALLOCATED(ScriptStreamerThread); 22 WTF_MAKE_FAST_ALLOCATED(ScriptStreamerThread);
22 WTF_MAKE_NONCOPYABLE(ScriptStreamerThread); 23 WTF_MAKE_NONCOPYABLE(ScriptStreamerThread);
23 public: 24 public:
24 static void init(); 25 static void init();
25 static void shutdown(); 26 static void shutdown();
26 static ScriptStreamerThread* shared(); 27 static ScriptStreamerThread* shared();
27 28
28 void postTask(WebThread::Task*); 29 void postTask(WebTaskRunner::Task*);
29 30
30 bool isRunningTask() const 31 bool isRunningTask() const
31 { 32 {
32 MutexLocker locker(m_mutex); 33 MutexLocker locker(m_mutex);
33 return m_runningTask; 34 return m_runningTask;
34 } 35 }
35 36
36 void taskDone(); 37 void taskDone();
37 38
38 static void runScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::Scrip tStreamingTask>, ScriptStreamer*); 39 static void runScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::Scrip tStreamingTask>, ScriptStreamer*);
(...skipping 12 matching lines...) Expand all
51 // At the moment, we only use one thread, so we can only stream one script 52 // At the moment, we only use one thread, so we can only stream one script
52 // at a time. FIXME: Use a thread pool and stream multiple scripts. 53 // at a time. FIXME: Use a thread pool and stream multiple scripts.
53 WTF::OwnPtr<WebThread> m_thread; 54 WTF::OwnPtr<WebThread> m_thread;
54 bool m_runningTask; 55 bool m_runningTask;
55 mutable Mutex m_mutex; // Guards m_runningTask. 56 mutable Mutex m_mutex; // Guards m_runningTask.
56 }; 57 };
57 58
58 } // namespace blink 59 } // namespace blink
59 60
60 #endif // ScriptStreamerThread_h 61 #endif // ScriptStreamerThread_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamer.cpp ('k') | Source/bindings/core/v8/ScriptStreamerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698