OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef MainThreadDebugger_h | 31 #ifndef MainThreadDebugger_h |
32 #define MainThreadDebugger_h | 32 #define MainThreadDebugger_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/inspector/InspectorTaskRunner.h" | 35 #include "core/inspector/InspectorTaskRunner.h" |
36 #include "core/inspector/ScriptDebuggerBase.h" | 36 #include "core/inspector/v8/V8DebuggerClient.h" |
37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
38 #include <v8.h> | 38 #include <v8.h> |
39 | 39 |
40 namespace WTF { | 40 namespace WTF { |
41 class Mutex; | 41 class Mutex; |
42 } | 42 } |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 class LocalFrame; | 46 class LocalFrame; |
| 47 class V8Debugger; |
47 | 48 |
48 class CORE_EXPORT MainThreadDebugger final : public ScriptDebuggerBase { | 49 class CORE_EXPORT MainThreadDebugger final : public V8DebuggerClient { |
49 WTF_MAKE_NONCOPYABLE(MainThreadDebugger); | 50 WTF_MAKE_NONCOPYABLE(MainThreadDebugger); |
50 public: | 51 public: |
51 class ClientMessageLoop { | 52 class ClientMessageLoop { |
52 USING_FAST_MALLOC(ClientMessageLoop); | 53 USING_FAST_MALLOC(ClientMessageLoop); |
53 public: | 54 public: |
54 virtual ~ClientMessageLoop() { } | 55 virtual ~ClientMessageLoop() { } |
55 virtual void run(LocalFrame*) = 0; | 56 virtual void run(LocalFrame*) = 0; |
56 virtual void quitNow() = 0; | 57 virtual void quitNow() = 0; |
57 }; | 58 }; |
58 | 59 |
59 static PassOwnPtr<MainThreadDebugger> create(PassOwnPtr<ClientMessageLoop> c
lientMessageLoop, v8::Isolate* isolate) | 60 static PassOwnPtr<MainThreadDebugger> create(PassOwnPtr<ClientMessageLoop> c
lientMessageLoop, v8::Isolate* isolate) |
60 { | 61 { |
61 return adoptPtr(new MainThreadDebugger(clientMessageLoop, isolate)); | 62 return adoptPtr(new MainThreadDebugger(clientMessageLoop, isolate)); |
62 } | 63 } |
63 | 64 |
64 ~MainThreadDebugger() override; | 65 ~MainThreadDebugger() override; |
65 | 66 |
66 static void initializeContext(v8::Local<v8::Context>, LocalFrame*, int world
Id); | 67 static void initializeContext(v8::Local<v8::Context>, LocalFrame*, int world
Id); |
67 static int contextGroupId(LocalFrame*); | 68 static int contextGroupId(LocalFrame*); |
68 | 69 |
69 static MainThreadDebugger* instance(); | 70 static MainThreadDebugger* instance(); |
70 static void interruptMainThreadAndRun(PassOwnPtr<InspectorTaskRunner::Task>)
; | 71 static void interruptMainThreadAndRun(PassOwnPtr<InspectorTaskRunner::Task>)
; |
71 InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } | 72 InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } |
| 73 V8Debugger* debugger() const { return m_debugger.get(); } |
72 | 74 |
73 private: | 75 private: |
74 MainThreadDebugger(PassOwnPtr<ClientMessageLoop>, v8::Isolate*); | 76 MainThreadDebugger(PassOwnPtr<ClientMessageLoop>, v8::Isolate*); |
75 | 77 |
| 78 // V8DebuggerClient implementation. |
| 79 v8::Local<v8::Object> compileDebuggerScript() override; |
76 void runMessageLoopOnPause(int contextGroupId) override; | 80 void runMessageLoopOnPause(int contextGroupId) override; |
77 void quitMessageLoopOnPause() override; | 81 void quitMessageLoopOnPause() override; |
78 | 82 |
79 static WTF::Mutex& creationMutex(); | 83 static WTF::Mutex& creationMutex(); |
80 | 84 |
| 85 v8::Isolate* m_isolate; |
| 86 OwnPtr<V8Debugger> m_debugger; |
81 OwnPtr<ClientMessageLoop> m_clientMessageLoop; | 87 OwnPtr<ClientMessageLoop> m_clientMessageLoop; |
82 OwnPtr<InspectorTaskRunner> m_taskRunner; | 88 OwnPtr<InspectorTaskRunner> m_taskRunner; |
83 | 89 |
84 static MainThreadDebugger* s_instance; | 90 static MainThreadDebugger* s_instance; |
85 }; | 91 }; |
86 | 92 |
87 } // namespace blink | 93 } // namespace blink |
88 | 94 |
89 | 95 |
90 #endif // MainThreadDebugger_h | 96 #endif // MainThreadDebugger_h |
OLD | NEW |