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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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/WebThread.h" 10 #include "public/platform/WebThread.h"
11 #include "wtf/Functional.h" 11 #include "wtf/Functional.h"
12 #include "wtf/OwnPtr.h" 12 #include <memory>
13 #include "wtf/PassOwnPtr.h"
14
15 #include <v8.h> 13 #include <v8.h>
16 14
17 namespace blink { 15 namespace blink {
18 16
19 class ScriptStreamer; 17 class ScriptStreamer;
20 18
21 // A singleton thread for running background tasks for script streaming. 19 // A singleton thread for running background tasks for script streaming.
22 class CORE_EXPORT ScriptStreamerThread { 20 class CORE_EXPORT ScriptStreamerThread {
23 USING_FAST_MALLOC(ScriptStreamerThread); 21 USING_FAST_MALLOC(ScriptStreamerThread);
24 WTF_MAKE_NONCOPYABLE(ScriptStreamerThread); 22 WTF_MAKE_NONCOPYABLE(ScriptStreamerThread);
25 public: 23 public:
26 static void init(); 24 static void init();
27 static void shutdown(); 25 static void shutdown();
28 static ScriptStreamerThread* shared(); 26 static ScriptStreamerThread* shared();
29 27
30 void postTask(std::unique_ptr<CrossThreadClosure>); 28 void postTask(std::unique_ptr<CrossThreadClosure>);
31 29
32 bool isRunningTask() const 30 bool isRunningTask() const
33 { 31 {
34 MutexLocker locker(m_mutex); 32 MutexLocker locker(m_mutex);
35 return m_runningTask; 33 return m_runningTask;
36 } 34 }
37 35
38 void taskDone(); 36 void taskDone();
39 37
40 static void runScriptStreamingTask(PassOwnPtr<v8::ScriptCompiler::ScriptStre amingTask>, ScriptStreamer*); 38 static void runScriptStreamingTask(std::unique_ptr<v8::ScriptCompiler::Scrip tStreamingTask>, ScriptStreamer*);
41 39
42 private: 40 private:
43 ScriptStreamerThread() 41 ScriptStreamerThread()
44 : m_runningTask(false) { } 42 : m_runningTask(false) { }
45 43
46 bool isRunning() const 44 bool isRunning() const
47 { 45 {
48 return !!m_thread; 46 return !!m_thread;
49 } 47 }
50 48
51 WebThread& platformThread(); 49 WebThread& platformThread();
52 50
53 // 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
54 // 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.
55 OwnPtr<WebThread> m_thread; 53 std::unique_ptr<WebThread> m_thread;
56 bool m_runningTask; 54 bool m_runningTask;
57 mutable Mutex m_mutex; // Guards m_runningTask. 55 mutable Mutex m_mutex; // Guards m_runningTask.
58 }; 56 };
59 57
60 } // namespace blink 58 } // namespace blink
61 59
62 #endif // ScriptStreamerThread_h 60 #endif // ScriptStreamerThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698