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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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 PageScriptDebugServer_h | 31 #ifndef PageScriptDebugServer_h |
32 #define PageScriptDebugServer_h | 32 #define PageScriptDebugServer_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptDebugServer.h" | 34 #include "bindings/core/v8/ScriptDebugServer.h" |
35 #include "bindings/core/v8/ScriptPreprocessor.h" | 35 #include "bindings/core/v8/ScriptSourceCode.h" |
36 #include <v8.h> | 36 #include <v8.h> |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class Page; | 40 class Page; |
41 class ScriptPreprocessor; | 41 class ScriptPreprocessor; |
42 class ScriptSourceCode; | |
43 | 42 |
44 class PageScriptDebugServer final : public ScriptDebugServer { | 43 class PageScriptDebugServer final : public ScriptDebugServer { |
45 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); | 44 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); |
46 public: | 45 public: |
47 static PageScriptDebugServer& shared(); | 46 static PageScriptDebugServer& shared(); |
48 | 47 |
| 48 ~PageScriptDebugServer() override; |
| 49 void trace(Visitor*) override; |
| 50 |
49 static void setMainThreadIsolate(v8::Isolate*); | 51 static void setMainThreadIsolate(v8::Isolate*); |
50 | 52 |
51 void addListener(ScriptDebugListener*, Page*); | 53 void addListener(ScriptDebugListener*, Page*); |
52 void removeListener(ScriptDebugListener*, Page*); | 54 void removeListener(ScriptDebugListener*, Page*); |
53 | 55 |
54 static void interruptAndRun(PassOwnPtr<Task>); | 56 static void interruptAndRun(PassOwnPtr<Task>); |
55 | 57 |
56 class ClientMessageLoop { | 58 class ClientMessageLoop { |
57 public: | 59 public: |
58 virtual ~ClientMessageLoop() { } | 60 virtual ~ClientMessageLoop() { } |
59 virtual void run(Page*) = 0; | 61 virtual void run(Page*) = 0; |
60 virtual void quitNow() = 0; | 62 virtual void quitNow() = 0; |
61 }; | 63 }; |
62 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); | 64 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); |
63 | 65 |
64 void compileScript(ScriptState*, const String& expression, const String& sou
rceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber, int* co
lumnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) override; | 66 void compileScript(ScriptState*, const String& expression, const String& sou
rceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber, int* co
lumnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) override; |
65 void clearCompiledScripts() override; | 67 void clearCompiledScripts() override; |
66 void runScript(ScriptState*, const String& scriptId, ScriptValue* result, bo
ol* wasThrown, String* exceptionDetailsText, int* lineNumber, int* columnNumber,
RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) override; | 68 void runScript(ScriptState*, const String& scriptId, ScriptValue* result, bo
ol* wasThrown, String* exceptionDetailsText, int* lineNumber, int* columnNumber,
RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) override; |
67 void setPreprocessorSource(const String&) override; | 69 void setPreprocessorSource(const String&) override; |
68 void preprocessBeforeCompile(const v8::Debug::EventDetails&) override; | 70 void preprocessBeforeCompile(const v8::Debug::EventDetails&) override; |
69 PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSourceCode&
) override; | 71 ScriptSourceCode preprocess(LocalFrame*, const ScriptSourceCode&) override; |
70 String preprocessEventListener(LocalFrame*, const String& source, const Stri
ng& url, const String& functionName) override; | 72 String preprocessEventListener(LocalFrame*, const String& source, const Stri
ng& url, const String& functionName) override; |
71 void clearPreprocessor() override; | 73 void clearPreprocessor() override; |
72 | 74 |
73 void muteWarningsAndDeprecations() override; | 75 void muteWarningsAndDeprecations() override; |
74 void unmuteWarningsAndDeprecations() override; | 76 void unmuteWarningsAndDeprecations() override; |
75 | 77 |
76 private: | 78 private: |
77 PageScriptDebugServer(); | 79 PageScriptDebugServer(); |
78 ~PageScriptDebugServer() override; | |
79 | 80 |
80 ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Context>) ove
rride; | 81 ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Context>) ove
rride; |
81 void runMessageLoopOnPause(v8::Handle<v8::Context>) override; | 82 void runMessageLoopOnPause(v8::Handle<v8::Context>) override; |
82 void quitMessageLoopOnPause() override; | 83 void quitMessageLoopOnPause() override; |
83 | 84 |
84 typedef HashMap<Page*, ScriptDebugListener*> ListenersMap; | 85 using ListenersMap = WillBeHeapHashMap<RawPtrWillBeMember<Page>, ScriptDebug
Listener*>; |
85 ListenersMap m_listenersMap; | 86 ListenersMap m_listenersMap; |
86 OwnPtr<ClientMessageLoop> m_clientMessageLoop; | 87 OwnPtr<ClientMessageLoop> m_clientMessageLoop; |
87 Page* m_pausedPage; | 88 RawPtrWillBeMember<Page> m_pausedPage; |
88 HashMap<String, String> m_compiledScriptURLs; | 89 HashMap<String, String> m_compiledScriptURLs; |
89 | 90 |
90 OwnPtr<ScriptSourceCode> m_preprocessorSourceCode; | 91 ScriptSourceCode m_preprocessorSourceCode; |
91 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; | 92 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; |
92 bool canPreprocess(LocalFrame*); | 93 bool canPreprocess(LocalFrame*); |
93 static v8::Isolate* s_mainThreadIsolate; | 94 static v8::Isolate* s_mainThreadIsolate; |
94 }; | 95 }; |
95 | 96 |
96 } // namespace blink | 97 } // namespace blink |
97 | 98 |
98 | 99 |
99 #endif // PageScriptDebugServer_h | 100 #endif // PageScriptDebugServer_h |
OLD | NEW |