Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: Source/bindings/core/v8/V8Debugger.h

Issue 1216863004: [DevTools] Move debugger classes to core/inspector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/MainThreadDebugger.cpp ('k') | Source/bindings/core/v8/V8Debugger.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #ifndef V8Debugger_h
32 #define V8Debugger_h
33
34 #include "core/CoreExport.h"
35 #include "core/InspectorTypeBuilder.h"
36 #include "core/inspector/ScriptBreakpoint.h"
37 #include "core/inspector/ScriptDebugListener.h"
38 #include "platform/heap/Handle.h"
39 #include "wtf/Forward.h"
40
41 #include <v8-debug.h>
42 #include <v8.h>
43
44 namespace blink {
45
46 class ScriptState;
47 class ScriptDebugListener;
48 class ScriptValue;
49 class JavaScriptCallFrame;
50
51 class CORE_EXPORT V8Debugger : public NoBaseWillBeGarbageCollectedFinalized<V8De bugger> {
52 WTF_MAKE_NONCOPYABLE(V8Debugger);
53 public:
54 class CORE_EXPORT Client : public WillBeGarbageCollectedMixin {
55 public:
56 virtual ~Client() { }
57 virtual v8::Local<v8::Object> compileDebuggerScript() = 0;
58 virtual ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Co ntext>) = 0;
59 virtual void runMessageLoopOnPause(v8::Local<v8::Context>) = 0;
60 virtual void quitMessageLoopOnPause() = 0;
61
62 DEFINE_INLINE_VIRTUAL_TRACE() { }
63 };
64
65 static PassOwnPtrWillBeRawPtr<V8Debugger> create(v8::Isolate* isolate, Clien t* client)
66 {
67 return adoptPtrWillBeNoop(new V8Debugger(isolate, client));
68 }
69
70 virtual ~V8Debugger();
71 DECLARE_VIRTUAL_TRACE();
72
73 void enable();
74 void disable();
75 bool enabled() const;
76
77 static void setContextDebugData(v8::Local<v8::Context>, const String& contex tDebugData);
78 // Each script inherits debug data from v8::Context where it has been compil ed.
79 // Only scripts whose debug data contains |contextDebugDataSubstring| substr ing will be reported.
80 // Passing empty string will result in reporting all scripts.
81 void reportCompiledScripts(const String& contextDebugDataSubstring, ScriptDe bugListener*);
82
83 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber, bool interstatementLocation);
84 void removeBreakpoint(const String& breakpointId);
85 void setBreakpointsActivated(bool);
86
87 enum PauseOnExceptionsState {
88 DontPauseOnExceptions,
89 PauseOnAllExceptions,
90 PauseOnUncaughtExceptions
91 };
92 PauseOnExceptionsState pauseOnExceptionsState();
93 void setPauseOnExceptionsState(PauseOnExceptionsState);
94
95 void setPauseOnNextStatement(bool);
96 bool pausingOnNextStatement();
97 bool canBreakProgram();
98 void breakProgram();
99 void continueProgram();
100 void stepIntoStatement();
101 void stepOverStatement();
102 void stepOutOfFunction();
103 void clearStepping();
104
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();
107 ScriptValue currentCallFramesForAsyncStack();
108 PassRefPtr<JavaScriptCallFrame> callFrameNoScopes(int index);
109 int frameCount();
110
111 static PassRefPtr<JavaScriptCallFrame> toJavaScriptCallFrameUnsafe(const Scr iptValue&);
112
113 bool isPaused();
114
115 v8::Local<v8::Value> functionScopes(v8::Local<v8::Function>);
116 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&);
117 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&);
118 v8::MaybeLocal<v8::Value> setFunctionVariableValue(v8::Local<v8::Value> func tionValue, int scopeNumber, const String& variableName, v8::Local<v8::Value> new Value);
119
120 v8::Isolate* isolate() const { return m_isolate; }
121
122 private:
123 V8Debugger(v8::Isolate*, Client*);
124
125 void compileDebuggerScript();
126 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a rgc, v8::Local<v8::Value> argv[]);
127 v8::Local<v8::Object> debuggerScriptLocal() const;
128 v8::Local<v8::Context> debuggerContext() const;
129 void clearBreakpoints();
130
131 void dispatchDidParseSource(ScriptDebugListener*, v8::Local<v8::Object> sour ceObject, CompileResult);
132
133 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&) ;
134 void handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8::Object > executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakp oints, bool isPromiseRejection = false);
135 static void v8DebugEventCallback(const v8::Debug::EventDetails&);
136 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const char* functionName);
137 void handleV8DebugEvent(const v8::Debug::EventDetails&);
138
139 v8::Local<v8::String> v8InternalizedString(const char*) const;
140
141 enum ScopeInfoDetails {
142 AllScopes,
143 FastAsyncScopes,
144 NoScopes // Should be the last option.
145 };
146 ScriptValue currentCallFramesInner(ScopeInfoDetails);
147 PassRefPtr<JavaScriptCallFrame> wrapCallFrames(int maximumLimit, ScopeInfoDe tails);
148 void handleV8AsyncTaskEvent(ScriptDebugListener*, ScriptState* pausedScriptS tate, 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);
150
151 v8::Isolate* m_isolate;
152 Client* m_client;
153 bool m_breakpointsActivated;
154 v8::UniquePersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate;
155 v8::UniquePersistent<v8::Object> m_debuggerScript;
156 v8::UniquePersistent<v8::Context> m_debuggerContext;
157 v8::UniquePersistent<v8::FunctionTemplate> m_callFrameWrapperTemplate;
158 v8::Local<v8::Object> m_executionState;
159 RefPtr<ScriptState> m_pausedScriptState;
160 bool m_runningNestedMessageLoop;
161 };
162
163 } // namespace blink
164
165
166 #endif // V8Debugger_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/MainThreadDebugger.cpp ('k') | Source/bindings/core/v8/V8Debugger.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698