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 13 matching lines...) Expand all Loading... | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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/Nullable.h" | |
34 #include "bindings/core/v8/ScriptDebugServer.h" | 35 #include "bindings/core/v8/ScriptDebugServer.h" |
35 #include "bindings/core/v8/ScriptPreprocessor.h" | 36 #include "bindings/core/v8/ScriptSourceCode.h" |
36 #include <v8.h> | 37 #include <v8.h> |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class Page; | 41 class Page; |
41 class ScriptPreprocessor; | 42 class ScriptPreprocessor; |
42 class ScriptSourceCode; | |
43 | 43 |
44 class PageScriptDebugServer final : public ScriptDebugServer { | 44 class PageScriptDebugServer final : public ScriptDebugServer { |
45 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); | 45 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); |
46 public: | 46 public: |
47 static PageScriptDebugServer& shared(); | 47 static PageScriptDebugServer& shared(); |
48 | 48 |
49 ~PageScriptDebugServer() override; | |
50 void trace(Visitor*) override; | |
51 | |
49 static void setMainThreadIsolate(v8::Isolate*); | 52 static void setMainThreadIsolate(v8::Isolate*); |
50 | 53 |
51 void addListener(ScriptDebugListener*, Page*); | 54 void addListener(ScriptDebugListener*, Page*); |
52 void removeListener(ScriptDebugListener*, Page*); | 55 void removeListener(ScriptDebugListener*, Page*); |
53 | 56 |
54 static void interruptAndRun(PassOwnPtr<Task>); | 57 static void interruptAndRun(PassOwnPtr<Task>); |
55 | 58 |
56 class ClientMessageLoop { | 59 class ClientMessageLoop { |
57 public: | 60 public: |
58 virtual ~ClientMessageLoop() { } | 61 virtual ~ClientMessageLoop() { } |
59 virtual void run(Page*) = 0; | 62 virtual void run(Page*) = 0; |
60 virtual void quitNow() = 0; | 63 virtual void quitNow() = 0; |
61 }; | 64 }; |
62 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); | 65 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); |
63 | 66 |
64 void compileScript(ScriptState*, const String& expression, const String& sou rceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber, int* co lumnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) override; | 67 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; | 68 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; | 69 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; | 70 void setPreprocessorSource(const String&) override; |
68 void preprocessBeforeCompile(const v8::Debug::EventDetails&) override; | 71 void preprocessBeforeCompile(const v8::Debug::EventDetails&) override; |
69 PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSourceCode& ) override; | 72 Nullable<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSourceCode&) override; |
haraken
2015/01/22 02:11:54
Using Nullable<> looks a bit tricky. At the moment
| |
70 String preprocessEventListener(LocalFrame*, const String& source, const Stri ng& url, const String& functionName) override; | 73 String preprocessEventListener(LocalFrame*, const String& source, const Stri ng& url, const String& functionName) override; |
71 void clearPreprocessor() override; | 74 void clearPreprocessor() override; |
72 | 75 |
73 void muteWarningsAndDeprecations() override; | 76 void muteWarningsAndDeprecations() override; |
74 void unmuteWarningsAndDeprecations() override; | 77 void unmuteWarningsAndDeprecations() override; |
75 | 78 |
76 private: | 79 private: |
77 PageScriptDebugServer(); | 80 PageScriptDebugServer(); |
78 ~PageScriptDebugServer() override; | |
79 | 81 |
80 ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Context>) ove rride; | 82 ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Context>) ove rride; |
81 void runMessageLoopOnPause(v8::Handle<v8::Context>) override; | 83 void runMessageLoopOnPause(v8::Handle<v8::Context>) override; |
82 void quitMessageLoopOnPause() override; | 84 void quitMessageLoopOnPause() override; |
83 | 85 |
84 typedef HashMap<Page*, ScriptDebugListener*> ListenersMap; | 86 using ListenersMap = WillBeHeapHashMap<RawPtrWillBeMember<Page>, ScriptDebug Listener*>; |
85 ListenersMap m_listenersMap; | 87 ListenersMap m_listenersMap; |
86 OwnPtr<ClientMessageLoop> m_clientMessageLoop; | 88 OwnPtr<ClientMessageLoop> m_clientMessageLoop; |
87 Page* m_pausedPage; | 89 RawPtrWillBeMember<Page> m_pausedPage; |
88 HashMap<String, String> m_compiledScriptURLs; | 90 HashMap<String, String> m_compiledScriptURLs; |
89 | 91 |
90 OwnPtr<ScriptSourceCode> m_preprocessorSourceCode; | 92 Nullable<ScriptSourceCode> m_preprocessorSourceCode; |
91 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; | 93 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; |
92 bool canPreprocess(LocalFrame*); | 94 bool canPreprocess(LocalFrame*); |
93 static v8::Isolate* s_mainThreadIsolate; | 95 static v8::Isolate* s_mainThreadIsolate; |
94 }; | 96 }; |
95 | 97 |
96 } // namespace blink | 98 } // namespace blink |
97 | 99 |
98 | 100 |
99 #endif // PageScriptDebugServer_h | 101 #endif // PageScriptDebugServer_h |
OLD | NEW |