| 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/ScriptDebugServer.h" | 34 #include "sky/engine/bindings/core/v8/ScriptDebugServer.h" |
| 35 #include "bindings/core/v8/ScriptPreprocessor.h" | 35 #include "sky/engine/bindings/core/v8/ScriptPreprocessor.h" |
| 36 #include "wtf/Forward.h" | 36 #include "sky/engine/wtf/Forward.h" |
| 37 #include "wtf/RefCounted.h" | 37 #include "sky/engine/wtf/RefCounted.h" |
| 38 #include <v8.h> | 38 #include "v8/include/v8.h" |
| 39 |
| 40 // This whole file will move to namespace inspector. |
| 41 namespace inspector { |
| 42 class InspectorHost; |
| 43 } |
| 39 | 44 |
| 40 namespace blink { | 45 namespace blink { |
| 41 | 46 |
| 42 class Page; | |
| 43 class ScriptController; | 47 class ScriptController; |
| 44 class ScriptPreprocessor; | 48 class ScriptPreprocessor; |
| 45 class ScriptSourceCode; | 49 class ScriptSourceCode; |
| 46 | 50 |
| 47 class PageScriptDebugServer final : public ScriptDebugServer { | 51 class PageScriptDebugServer final : public ScriptDebugServer { |
| 48 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); | 52 WTF_MAKE_NONCOPYABLE(PageScriptDebugServer); |
| 49 public: | 53 public: |
| 50 static PageScriptDebugServer& shared(); | 54 static PageScriptDebugServer& shared(); |
| 51 | 55 |
| 52 static void setMainThreadIsolate(v8::Isolate*); | 56 static void setMainThreadIsolate(v8::Isolate*); |
| 53 | 57 |
| 54 void addListener(ScriptDebugListener*, Page*); | 58 void addListener(ScriptDebugListener*, inspector::InspectorHost*); |
| 55 void removeListener(ScriptDebugListener*, Page*); | 59 void removeListener(ScriptDebugListener*, inspector::InspectorHost*); |
| 56 | 60 |
| 57 static void interruptAndRun(PassOwnPtr<Task>); | 61 static void interruptAndRun(PassOwnPtr<Task>); |
| 58 | 62 |
| 59 class ClientMessageLoop { | 63 class ClientMessageLoop { |
| 60 public: | 64 public: |
| 61 virtual ~ClientMessageLoop() { } | 65 virtual ~ClientMessageLoop() { } |
| 62 virtual void run(Page*) = 0; | 66 virtual void run(inspector::InspectorHost*) = 0; |
| 63 virtual void quitNow() = 0; | 67 virtual void quitNow() = 0; |
| 64 }; | 68 }; |
| 65 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); | 69 void setClientMessageLoop(PassOwnPtr<ClientMessageLoop>); |
| 66 | 70 |
| 67 virtual void compileScript(ScriptState*, const String& expression, const Str
ing& sourceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber,
int* columnNumber, RefPtr<ScriptCallStack>* stackTrace) override; | 71 virtual void compileScript(ScriptState*, const String& expression, const Str
ing& sourceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber,
int* columnNumber, RefPtr<ScriptCallStack>* stackTrace) override; |
| 68 virtual void clearCompiledScripts() override; | 72 virtual void clearCompiledScripts() override; |
| 69 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
sult, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* colum
nNumber, RefPtr<ScriptCallStack>* stackTrace) override; | 73 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
sult, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* colum
nNumber, RefPtr<ScriptCallStack>* stackTrace) override; |
| 70 virtual void setPreprocessorSource(const String&) override; | 74 virtual void setPreprocessorSource(const String&) override; |
| 71 virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) overrid
e; | 75 virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) overrid
e; |
| 72 virtual PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSou
rceCode&) override; | 76 virtual PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSou
rceCode&) override; |
| 73 virtual String preprocessEventListener(LocalFrame*, const String& source, co
nst String& url, const String& functionName) override; | 77 virtual String preprocessEventListener(LocalFrame*, const String& source, co
nst String& url, const String& functionName) override; |
| 74 virtual void clearPreprocessor() override; | 78 virtual void clearPreprocessor() override; |
| 75 | 79 |
| 76 virtual void muteWarningsAndDeprecations() override; | 80 virtual void muteWarningsAndDeprecations() override; |
| 77 virtual void unmuteWarningsAndDeprecations() override; | 81 virtual void unmuteWarningsAndDeprecations() override; |
| 78 | 82 |
| 79 private: | 83 private: |
| 80 PageScriptDebugServer(); | 84 PageScriptDebugServer(); |
| 81 virtual ~PageScriptDebugServer(); | 85 virtual ~PageScriptDebugServer(); |
| 82 | 86 |
| 83 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
xt>) override; | 87 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
xt>) override; |
| 84 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) override; | 88 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) override; |
| 85 virtual void quitMessageLoopOnPause() override; | 89 virtual void quitMessageLoopOnPause() override; |
| 86 | 90 |
| 87 typedef HashMap<Page*, ScriptDebugListener*> ListenersMap; | 91 typedef HashMap<inspector::InspectorHost*, ScriptDebugListener*> ListenersMa
p; |
| 88 ListenersMap m_listenersMap; | 92 ListenersMap m_listenersMap; |
| 89 OwnPtr<ClientMessageLoop> m_clientMessageLoop; | 93 OwnPtr<ClientMessageLoop> m_clientMessageLoop; |
| 90 Page* m_pausedPage; | 94 inspector::InspectorHost* m_pausedHost; |
| 91 HashMap<String, String> m_compiledScriptURLs; | 95 HashMap<String, String> m_compiledScriptURLs; |
| 92 | 96 |
| 93 OwnPtr<ScriptSourceCode> m_preprocessorSourceCode; | 97 OwnPtr<ScriptSourceCode> m_preprocessorSourceCode; |
| 94 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; | 98 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; |
| 95 bool canPreprocess(LocalFrame*); | 99 bool canPreprocess(LocalFrame*); |
| 96 static v8::Isolate* s_mainThreadIsolate; | 100 static v8::Isolate* s_mainThreadIsolate; |
| 97 }; | 101 }; |
| 98 | 102 |
| 99 } // namespace blink | 103 } // namespace blink |
| 100 | 104 |
| 101 | 105 |
| 102 #endif // PageScriptDebugServer_h | 106 #endif // PageScriptDebugServer_h |
| OLD | NEW |