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