OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 ScriptDebugServer_h | 31 #ifndef ScriptDebugServer_h |
32 #define ScriptDebugServer_h | 32 #define ScriptDebugServer_h |
33 | 33 |
34 | |
35 #include "InspectorBackendDispatcher.h" | 34 #include "InspectorBackendDispatcher.h" |
36 #include "bindings/v8/ScopedPersistent.h" | 35 #include "bindings/v8/ScopedPersistent.h" |
37 #include "core/inspector/ScriptBreakpoint.h" | 36 #include "core/inspector/ScriptBreakpoint.h" |
38 #include "core/inspector/ScriptDebugListener.h" | 37 #include "core/inspector/ScriptDebugListener.h" |
39 #include <v8-debug.h> | 38 #include <v8-debug.h> |
40 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
41 #include "wtf/Noncopyable.h" | 40 #include "wtf/Noncopyable.h" |
42 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
43 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
44 #include "wtf/text/StringHash.h" | 43 #include "wtf/text/StringHash.h" |
(...skipping 27 matching lines...) Expand all Loading... |
72 | 71 |
73 void setPauseOnNextStatement(bool pause); | 72 void setPauseOnNextStatement(bool pause); |
74 bool canBreakProgram(); | 73 bool canBreakProgram(); |
75 void breakProgram(); | 74 void breakProgram(); |
76 void continueProgram(); | 75 void continueProgram(); |
77 void stepIntoStatement(); | 76 void stepIntoStatement(); |
78 void stepOverStatement(const ScriptValue& frame); | 77 void stepOverStatement(const ScriptValue& frame); |
79 void stepOutOfFunction(const ScriptValue& frame); | 78 void stepOutOfFunction(const ScriptValue& frame); |
80 | 79 |
81 bool setScriptSource(const String& sourceID, const String& newContent, bool
preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc
riptValue* newCallFrames, ScriptObject* result); | 80 bool setScriptSource(const String& sourceID, const String& newContent, bool
preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc
riptValue* newCallFrames, ScriptObject* result); |
82 void updateCallStack(ScriptValue* callFrame); | 81 ScriptValue currentCallFrames(); |
83 | 82 |
84 class Task { | 83 class Task { |
85 public: | 84 public: |
86 virtual ~Task() { } | 85 virtual ~Task() { } |
87 virtual void run() = 0; | 86 virtual void run() = 0; |
88 }; | 87 }; |
89 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*); | 88 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*); |
90 void runPendingTasks(); | 89 void runPendingTasks(); |
91 | 90 |
92 bool isPaused(); | 91 bool isPaused(); |
93 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; } | 92 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; } |
94 | 93 |
95 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); | 94 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); |
96 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); | 95 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); |
97 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio
nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa
lue); | 96 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio
nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa
lue); |
98 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc,
v8::Handle<v8::Value> argv[]); | 97 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc,
v8::Handle<v8::Value> argv[]); |
99 | 98 |
100 virtual void compileScript(ScriptState*, const String& expression, const Str
ing& sourceURL, String* scriptId, String* exceptionMessage); | 99 virtual void compileScript(ScriptState*, const String& expression, const Str
ing& sourceURL, String* scriptId, String* exceptionMessage); |
101 virtual void clearCompiledScripts(); | 100 virtual void clearCompiledScripts(); |
102 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
sult, bool* wasThrown, String* exceptionMessage); | 101 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
sult, bool* wasThrown, String* exceptionMessage); |
103 virtual void setPreprocessorSource(const String&) { } | 102 virtual void setPreprocessorSource(const String&) { } |
104 virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) { } | 103 virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) { } |
105 virtual PassOwnPtr<ScriptSourceCode> preprocess(Frame*, const ScriptSourceCo
de&); | 104 virtual PassOwnPtr<ScriptSourceCode> preprocess(Frame*, const ScriptSourceCo
de&); |
106 virtual String preprocessEventListener(Frame*, const String& source, const S
tring& url, const String& functionName); | 105 virtual String preprocessEventListener(Frame*, const String& source, const S
tring& url, const String& functionName); |
107 | 106 |
108 protected: | 107 protected: |
109 explicit ScriptDebugServer(v8::Isolate*); | 108 explicit ScriptDebugServer(v8::Isolate*); |
110 virtual ~ScriptDebugServer(); | 109 virtual ~ScriptDebugServer(); |
111 | 110 |
112 ScriptValue currentCallFrame(); | |
113 | |
114 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
xt>) = 0; | 111 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
xt>) = 0; |
115 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; | 112 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; |
116 virtual void quitMessageLoopOnPause() = 0; | 113 virtual void quitMessageLoopOnPause() = 0; |
117 | 114 |
118 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; | 115 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; |
119 void handleProgramBreak(v8::Handle<v8::Object> executionState, v8::Handle<v8
::Value> exception, v8::Handle<v8::Array> hitBreakpoints); | 116 void handleProgramBreak(v8::Handle<v8::Object> executionState, v8::Handle<v8
::Value> exception, v8::Handle<v8::Array> hitBreakpoints); |
120 void handleProgramBreak(const v8::Debug::EventDetails&, v8::Handle<v8::Value
> exception, v8::Handle<v8::Array> hitBreakpointNumbers); | 117 void handleProgramBreak(const v8::Debug::EventDetails&, v8::Handle<v8::Value
> exception, v8::Handle<v8::Array> hitBreakpointNumbers); |
121 | 118 |
122 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails
); | 119 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails
); |
123 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); | 120 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); |
(...skipping 16 matching lines...) Expand all Loading... |
140 PassRefPtr<JavaScriptCallFrame> wrapCallFrames(v8::Handle<v8::Object> execut
ionState, int maximumLimit); | 137 PassRefPtr<JavaScriptCallFrame> wrapCallFrames(v8::Handle<v8::Object> execut
ionState, int maximumLimit); |
141 bool executeSkipPauseRequest(ScriptDebugListener::SkipPauseRequest, v8::Hand
le<v8::Object> executionState); | 138 bool executeSkipPauseRequest(ScriptDebugListener::SkipPauseRequest, v8::Hand
le<v8::Object> executionState); |
142 | 139 |
143 bool m_runningNestedMessageLoop; | 140 bool m_runningNestedMessageLoop; |
144 }; | 141 }; |
145 | 142 |
146 } // namespace WebCore | 143 } // namespace WebCore |
147 | 144 |
148 | 145 |
149 #endif // ScriptDebugServer_h | 146 #endif // ScriptDebugServer_h |
OLD | NEW |