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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef MainThreadDebugger_h | 31 #ifndef MainThreadDebugger_h |
32 #define MainThreadDebugger_h | 32 #define MainThreadDebugger_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
36 #include "core/inspector/InspectorTaskRunner.h" | 36 #include "core/inspector/InspectorTaskRunner.h" |
37 #include "core/inspector/ThreadDebugger.h" | 37 #include "core/inspector/ThreadDebugger.h" |
38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
39 #include <memory> | |
40 #include <v8.h> | 39 #include <v8.h> |
41 | 40 |
42 namespace blink { | 41 namespace blink { |
43 | 42 |
44 class LocalFrame; | 43 class LocalFrame; |
45 class SecurityOrigin; | 44 class SecurityOrigin; |
46 | 45 |
47 class CORE_EXPORT MainThreadDebugger final : public ThreadDebugger { | 46 class CORE_EXPORT MainThreadDebugger final : public ThreadDebugger { |
48 WTF_MAKE_NONCOPYABLE(MainThreadDebugger); | 47 WTF_MAKE_NONCOPYABLE(MainThreadDebugger); |
49 public: | 48 public: |
50 class ClientMessageLoop { | 49 class ClientMessageLoop { |
51 USING_FAST_MALLOC(ClientMessageLoop); | 50 USING_FAST_MALLOC(ClientMessageLoop); |
52 public: | 51 public: |
53 virtual ~ClientMessageLoop() { } | 52 virtual ~ClientMessageLoop() { } |
54 virtual void run(LocalFrame*) = 0; | 53 virtual void run(LocalFrame*) = 0; |
55 virtual void quitNow() = 0; | 54 virtual void quitNow() = 0; |
56 }; | 55 }; |
57 | 56 |
58 explicit MainThreadDebugger(v8::Isolate*); | 57 explicit MainThreadDebugger(v8::Isolate*); |
59 ~MainThreadDebugger() override; | 58 ~MainThreadDebugger() override; |
60 | 59 |
61 static MainThreadDebugger* instance(); | 60 static MainThreadDebugger* instance(); |
62 static void interruptMainThreadAndRun(std::unique_ptr<InspectorTaskRunner::T
ask>); | 61 static void interruptMainThreadAndRun(std::unique_ptr<InspectorTaskRunner::T
ask>); |
63 | 62 |
64 InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } | 63 InspectorTaskRunner* taskRunner() const { return m_taskRunner.get(); } |
65 bool isWorker() override { return false; } | 64 bool isWorker() override { return false; } |
66 void setClientMessageLoop(std::unique_ptr<ClientMessageLoop>); | 65 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); |
67 int contextGroupId(LocalFrame*); | 66 int contextGroupId(LocalFrame*); |
68 void contextCreated(ScriptState*, LocalFrame*, SecurityOrigin*); | 67 void contextCreated(ScriptState*, LocalFrame*, SecurityOrigin*); |
69 void contextWillBeDestroyed(ScriptState*); | 68 void contextWillBeDestroyed(ScriptState*); |
70 | 69 |
71 void installAdditionalCommandLineAPI(v8::Local<v8::Context>, v8::Local<v8::O
bject>) override; | 70 void installAdditionalCommandLineAPI(v8::Local<v8::Context>, v8::Local<v8::O
bject>) override; |
72 | 71 |
73 v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*, v8::Local<v8::Context>) o
verride; | 72 v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*, v8::Local<v8::Context>) o
verride; |
74 protected: | 73 protected: |
75 void reportMessageToConsole(v8::Local<v8::Context>, ConsoleMessage*) overrid
e; | 74 void reportMessageToConsole(v8::Local<v8::Context>, ConsoleMessage*) overrid
e; |
76 | 75 |
77 private: | 76 private: |
78 // V8DebuggerClient implementation. | 77 // V8DebuggerClient implementation. |
79 void runMessageLoopOnPause(int contextGroupId) override; | 78 void runMessageLoopOnPause(int contextGroupId) override; |
80 void quitMessageLoopOnPause() override; | 79 void quitMessageLoopOnPause() override; |
81 void muteWarningsAndDeprecations() override; | 80 void muteWarningsAndDeprecations() override; |
82 void unmuteWarningsAndDeprecations() override; | 81 void unmuteWarningsAndDeprecations() override; |
83 void muteConsole() override; | 82 void muteConsole() override; |
84 void unmuteConsole() override; | 83 void unmuteConsole() override; |
85 bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Loca
l<v8::Context> target) override; | 84 bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Loca
l<v8::Context> target) override; |
86 int ensureDefaultContextInGroup(int contextGroupId) override; | 85 int ensureDefaultContextInGroup(int contextGroupId) override; |
87 | 86 |
88 std::unique_ptr<ClientMessageLoop> m_clientMessageLoop; | 87 OwnPtr<ClientMessageLoop> m_clientMessageLoop; |
89 std::unique_ptr<InspectorTaskRunner> m_taskRunner; | 88 OwnPtr<InspectorTaskRunner> m_taskRunner; |
90 | 89 |
91 static MainThreadDebugger* s_instance; | 90 static MainThreadDebugger* s_instance; |
92 | 91 |
93 static void querySelectorCallback(const v8::FunctionCallbackInfo<v8::Value>&
); | 92 static void querySelectorCallback(const v8::FunctionCallbackInfo<v8::Value>&
); |
94 static void querySelectorAllCallback(const v8::FunctionCallbackInfo<v8::Valu
e>&); | 93 static void querySelectorAllCallback(const v8::FunctionCallbackInfo<v8::Valu
e>&); |
95 static void xpathSelectorCallback(const v8::FunctionCallbackInfo<v8::Value>&
); | 94 static void xpathSelectorCallback(const v8::FunctionCallbackInfo<v8::Value>&
); |
96 }; | 95 }; |
97 | 96 |
98 } // namespace blink | 97 } // namespace blink |
99 | 98 |
100 | 99 |
101 #endif // MainThreadDebugger_h | 100 #endif // MainThreadDebugger_h |
OLD | NEW |