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

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

Issue 651163002: Script streaming: Add an option to make the main thread block (wait for parsing) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 6 years, 2 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 "platform/TaskSynchronizer.h" 8 #include "platform/TaskSynchronizer.h"
9 #include "public/platform/WebThread.h" 9 #include "public/platform/WebThread.h"
10 #include "wtf/OwnPtr.h" 10 #include "wtf/OwnPtr.h"
(...skipping 24 matching lines...) Expand all
35 35
36 private: 36 private:
37 ScriptStreamerThread() 37 ScriptStreamerThread()
38 : m_runningTask(false) { } 38 : m_runningTask(false) { }
39 39
40 bool isRunning() const 40 bool isRunning() const
41 { 41 {
42 return !!m_thread; 42 return !!m_thread;
43 } 43 }
44 44
45 void markAsCompleted(TaskSynchronizer* taskSynchronizer)
46 {
47 taskSynchronizer->taskCompleted();
48 }
49
50 blink::WebThread& platformThread(); 45 blink::WebThread& platformThread();
51 46
52 // At the moment, we only use one thread, so we can only stream one script 47 // At the moment, we only use one thread, so we can only stream one script
53 // at a time. FIXME: Use a thread pool and stream multiple scripts. 48 // at a time. FIXME: Use a thread pool and stream multiple scripts.
54 WTF::OwnPtr<blink::WebThread> m_thread; 49 WTF::OwnPtr<blink::WebThread> m_thread;
55 bool m_runningTask; 50 bool m_runningTask;
56 mutable Mutex m_mutex; // Guards m_runningTask. 51 mutable Mutex m_mutex; // Guards m_runningTask.
57 }; 52 };
58 53
59 class ScriptStreamingTask : public WebThread::Task { 54 class ScriptStreamingTask : public WebThread::Task {
60 WTF_MAKE_NONCOPYABLE(ScriptStreamingTask); 55 WTF_MAKE_NONCOPYABLE(ScriptStreamingTask);
61 public: 56 public:
62 ScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask> , ScriptStreamer*); 57 ScriptStreamingTask(WTF::PassOwnPtr<v8::ScriptCompiler::ScriptStreamingTask> , ScriptStreamer*);
63 virtual void run() override; 58 virtual void run() override;
64 59
65 private: 60 private:
66 WTF::OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> m_v8Task; 61 WTF::OwnPtr<v8::ScriptCompiler::ScriptStreamingTask> m_v8Task;
67 ScriptStreamer* m_streamer; 62 ScriptStreamer* m_streamer;
68 }; 63 };
69 64
70 65
71 } // namespace blink 66 } // namespace blink
72 67
73 #endif // ScriptStreamerThread_h 68 #endif // ScriptStreamerThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698