| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void clearStepping(); | 103 void clearStepping(); |
| 104 | 104 |
| 105 bool setScriptSource(const String& sourceID, const String& newContent, bool
preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc
riptValue* newCallFrames, RefPtr<JSONObject>* result); | 105 bool setScriptSource(const String& sourceID, const String& newContent, bool
preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc
riptValue* newCallFrames, RefPtr<JSONObject>* result); |
| 106 ScriptValue currentCallFrames(); | 106 ScriptValue currentCallFrames(); |
| 107 ScriptValue currentCallFramesForAsyncStack(); | 107 ScriptValue currentCallFramesForAsyncStack(); |
| 108 PassRefPtrWillBeRawPtr<JavaScriptCallFrame> callFrameNoScopes(int index); | 108 PassRefPtrWillBeRawPtr<JavaScriptCallFrame> callFrameNoScopes(int index); |
| 109 int frameCount(); | 109 int frameCount(); |
| 110 | 110 |
| 111 static PassRefPtrWillBeRawPtr<JavaScriptCallFrame> toJavaScriptCallFrameUnsa
fe(const ScriptValue&); | 111 static PassRefPtrWillBeRawPtr<JavaScriptCallFrame> toJavaScriptCallFrameUnsa
fe(const ScriptValue&); |
| 112 | 112 |
| 113 class Task { | |
| 114 public: | |
| 115 virtual ~Task() { } | |
| 116 virtual void run() = 0; | |
| 117 }; | |
| 118 // This method can be called on any thread. It is caller's responsibility to
make sure that | |
| 119 // this V8Debugger and corresponding v8::Isolate exist while this method is
running. | |
| 120 void interruptAndRun(PassOwnPtr<Task>); | |
| 121 void runPendingTasks(); | |
| 122 | |
| 123 bool isPaused(); | 113 bool isPaused(); |
| 124 | 114 |
| 125 v8::Local<v8::Value> functionScopes(v8::Local<v8::Function>); | 115 v8::Local<v8::Value> functionScopes(v8::Local<v8::Function>); |
| 126 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&); | 116 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&); |
| 127 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&); | 117 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&); |
| 128 v8::MaybeLocal<v8::Value> setFunctionVariableValue(v8::Local<v8::Value> func
tionValue, int scopeNumber, const String& variableName, v8::Local<v8::Value> new
Value); | 118 v8::MaybeLocal<v8::Value> setFunctionVariableValue(v8::Local<v8::Value> func
tionValue, int scopeNumber, const String& variableName, v8::Local<v8::Value> new
Value); |
| 129 | 119 |
| 130 v8::Isolate* isolate() const { return m_isolate; } | 120 v8::Isolate* isolate() const { return m_isolate; } |
| 131 | 121 |
| 132 private: | 122 private: |
| 133 V8Debugger(v8::Isolate*, Client*); | 123 V8Debugger(v8::Isolate*, Client*); |
| 134 | 124 |
| 135 void compileDebuggerScript(); | 125 void compileDebuggerScript(); |
| 136 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a
rgc, v8::Local<v8::Value> argv[]); | 126 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a
rgc, v8::Local<v8::Value> argv[]); |
| 137 v8::Local<v8::Object> debuggerScriptLocal() const; | 127 v8::Local<v8::Object> debuggerScriptLocal() const; |
| 138 v8::Local<v8::Context> debuggerContext() const; | 128 v8::Local<v8::Context> debuggerContext() const; |
| 139 void clearBreakpoints(); | 129 void clearBreakpoints(); |
| 140 | 130 |
| 141 void dispatchDidParseSource(ScriptDebugListener*, v8::Local<v8::Object> sour
ceObject, CompileResult); | 131 void dispatchDidParseSource(ScriptDebugListener*, v8::Local<v8::Object> sour
ceObject, CompileResult); |
| 142 | 132 |
| 143 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; | 133 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; |
| 144 void handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8::Object
> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakp
oints, bool isPromiseRejection = false); | 134 void handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8::Object
> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakp
oints, bool isPromiseRejection = false); |
| 145 static void v8InterruptCallback(v8::Isolate*, void*); | |
| 146 static void v8DebugEventCallback(const v8::Debug::EventDetails&); | 135 static void v8DebugEventCallback(const v8::Debug::EventDetails&); |
| 147 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); | 136 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); |
| 148 void handleV8DebugEvent(const v8::Debug::EventDetails&); | 137 void handleV8DebugEvent(const v8::Debug::EventDetails&); |
| 149 | 138 |
| 150 v8::Local<v8::String> v8InternalizedString(const char*) const; | 139 v8::Local<v8::String> v8InternalizedString(const char*) const; |
| 151 | 140 |
| 152 enum ScopeInfoDetails { | 141 enum ScopeInfoDetails { |
| 153 AllScopes, | 142 AllScopes, |
| 154 FastAsyncScopes, | 143 FastAsyncScopes, |
| 155 NoScopes // Should be the last option. | 144 NoScopes // Should be the last option. |
| 156 }; | 145 }; |
| 157 ScriptValue currentCallFramesInner(ScopeInfoDetails); | 146 ScriptValue currentCallFramesInner(ScopeInfoDetails); |
| 158 PassRefPtrWillBeRawPtr<JavaScriptCallFrame> wrapCallFrames(int maximumLimit,
ScopeInfoDetails); | 147 PassRefPtrWillBeRawPtr<JavaScriptCallFrame> wrapCallFrames(int maximumLimit,
ScopeInfoDetails); |
| 159 void handleV8AsyncTaskEvent(ScriptDebugListener*, ScriptState* pausedScriptS
tate, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); | 148 void handleV8AsyncTaskEvent(ScriptDebugListener*, ScriptState* pausedScriptS
tate, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); |
| 160 void handleV8PromiseEvent(ScriptDebugListener*, ScriptState* pausedScriptSta
te, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); | 149 void handleV8PromiseEvent(ScriptDebugListener*, ScriptState* pausedScriptSta
te, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData); |
| 161 | 150 |
| 162 v8::Isolate* m_isolate; | 151 v8::Isolate* m_isolate; |
| 163 Client* m_client; | 152 Client* m_client; |
| 164 bool m_breakpointsActivated; | 153 bool m_breakpointsActivated; |
| 165 v8::UniquePersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; | 154 v8::UniquePersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; |
| 166 v8::UniquePersistent<v8::Object> m_debuggerScript; | 155 v8::UniquePersistent<v8::Object> m_debuggerScript; |
| 167 v8::UniquePersistent<v8::Context> m_debuggerContext; | 156 v8::UniquePersistent<v8::Context> m_debuggerContext; |
| 168 v8::Local<v8::Object> m_executionState; | 157 v8::Local<v8::Object> m_executionState; |
| 169 RefPtr<ScriptState> m_pausedScriptState; | 158 RefPtr<ScriptState> m_pausedScriptState; |
| 170 bool m_runningNestedMessageLoop; | 159 bool m_runningNestedMessageLoop; |
| 171 class ThreadSafeTaskQueue; | |
| 172 OwnPtr<ThreadSafeTaskQueue> m_taskQueue; | |
| 173 }; | 160 }; |
| 174 | 161 |
| 175 } // namespace blink | 162 } // namespace blink |
| 176 | 163 |
| 177 | 164 |
| 178 #endif // V8Debugger_h | 165 #endif // V8Debugger_h |
| OLD | NEW |