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

Side by Side Diff: Source/core/inspector/V8Debugger.h

Issue 1224553008: [DevTools] Move Script and enums from ScriptDebugListener to V8Debugger. (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/core/inspector/ScriptDebugListener.cpp ('k') | Source/core/inspector/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
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 16 matching lines...) Expand all
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 V8Debugger_h 31 #ifndef V8Debugger_h
32 #define V8Debugger_h 32 #define V8Debugger_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/InspectorTypeBuilder.h" 35 #include "core/InspectorTypeBuilder.h"
36 #include "core/inspector/ScriptBreakpoint.h" 36 #include "core/inspector/ScriptBreakpoint.h"
37 #include "core/inspector/ScriptDebugListener.h"
38 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
39 #include "wtf/Forward.h" 38 #include "wtf/Forward.h"
40 39
41 #include <v8-debug.h> 40 #include <v8-debug.h>
42 #include <v8.h> 41 #include <v8.h>
43 42
44 namespace blink { 43 namespace blink {
45 44
46 class ScriptState; 45 class ScriptState;
47 class ScriptDebugListener; 46 class ScriptDebugListener;
48 class ScriptValue; 47 class ScriptValue;
49 class JavaScriptCallFrame; 48 class JavaScriptCallFrame;
50 49
51 class CORE_EXPORT V8Debugger : public NoBaseWillBeGarbageCollectedFinalized<V8De bugger> { 50 class CORE_EXPORT V8Debugger : public NoBaseWillBeGarbageCollectedFinalized<V8De bugger> {
52 WTF_MAKE_NONCOPYABLE(V8Debugger); 51 WTF_MAKE_NONCOPYABLE(V8Debugger);
53 public: 52 public:
53 class Script {
yurys 2015/07/07 14:13:45 As discussed offline I'd rather we moved this clas
54 public:
55 Script();
56
57 String url() const { return m_url; }
58 bool hasSourceURL() const { return !m_sourceURL.isEmpty(); }
59 String sourceURL() const;
60 String sourceMappingURL() const { return m_sourceMappingURL; }
61 String source() const { return m_source; }
62 int startLine() const { return m_startLine; }
63 int startColumn() const { return m_startColumn; }
64 int endLine() const { return m_endLine; }
65 int endColumn() const { return m_endColumn; }
66 bool isContentScript() const { return m_isContentScript; }
67 bool isInternalScript() const { return m_isInternalScript; }
68
69 bool getBlackboxedState(unsigned blackboxGeneration, bool* isBlackboxed) const;
70 void setBlackboxedState(unsigned blackboxGeneration, bool isBlackboxed);
71
72 Script& setURL(const String&);
73 Script& setSourceURL(const String&);
74 Script& setSourceMappingURL(const String&);
75 Script& setSource(const String&);
76 Script& setStartLine(int);
77 Script& setStartColumn(int);
78 Script& setEndLine(int);
79 Script& setEndColumn(int);
80 Script& setIsContentScript(bool);
81 Script& setIsInternalScript(bool);
82
83 private:
84 String m_url;
85 String m_sourceURL;
86 String m_sourceMappingURL;
87 String m_source;
88 int m_startLine;
89 int m_startColumn;
90 int m_endLine;
91 int m_endColumn;
92 bool m_isContentScript;
93 bool m_isInternalScript;
94 // Used from outside for caching.
95 bool m_isBlackboxedURL;
96 unsigned m_blackboxGeneration;
97 };
98
99 enum SkipPauseRequest {
100 NoSkip,
101 Continue,
102 StepInto,
103 StepOut,
104 StepFrame
105 };
106
107 enum CompileResult {
108 CompileSuccess,
109 CompileError
110 };
111
112 struct ParsedScript {
113 String scriptId;
114 Script script;
115 CompileResult compileResult;
116 };
117
54 class CORE_EXPORT Client : public WillBeGarbageCollectedMixin { 118 class CORE_EXPORT Client : public WillBeGarbageCollectedMixin {
55 public: 119 public:
56 virtual ~Client() { } 120 virtual ~Client() { }
57 virtual v8::Local<v8::Object> compileDebuggerScript() = 0; 121 virtual v8::Local<v8::Object> compileDebuggerScript() = 0;
58 virtual ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Co ntext>) = 0; 122 virtual ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Co ntext>) = 0;
59 virtual void runMessageLoopOnPause(v8::Local<v8::Context>) = 0; 123 virtual void runMessageLoopOnPause(v8::Local<v8::Context>) = 0;
60 virtual void quitMessageLoopOnPause() = 0; 124 virtual void quitMessageLoopOnPause() = 0;
61 125
62 DEFINE_INLINE_VIRTUAL_TRACE() { } 126 DEFINE_INLINE_VIRTUAL_TRACE() { }
63 }; 127 };
64 128
65 static PassOwnPtrWillBeRawPtr<V8Debugger> create(v8::Isolate* isolate, Clien t* client) 129 static PassOwnPtrWillBeRawPtr<V8Debugger> create(v8::Isolate* isolate, Clien t* client)
66 { 130 {
67 return adoptPtrWillBeNoop(new V8Debugger(isolate, client)); 131 return adoptPtrWillBeNoop(new V8Debugger(isolate, client));
68 } 132 }
69 133
70 virtual ~V8Debugger(); 134 virtual ~V8Debugger();
71 DECLARE_VIRTUAL_TRACE(); 135 DECLARE_VIRTUAL_TRACE();
72 136
73 void enable(); 137 void enable();
74 void disable(); 138 void disable();
75 bool enabled() const; 139 bool enabled() const;
76 140
77 static void setContextDebugData(v8::Local<v8::Context>, const String& contex tDebugData); 141 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. 142 // 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. 143 // Only scripts whose debug data contains |contextDebugDataSubstring| substr ing will be reported.
80 // Passing empty string will result in reporting all scripts. 144 // Passing empty string will result in reporting all scripts.
81 void getCompiledScripts(const String& contextDebugDataSubstring, Vector<Scri ptDebugListener::ParsedScript>&); 145 void getCompiledScripts(const String& contextDebugDataSubstring, Vector<Pars edScript>&);
82 146
83 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber, bool interstatementLocation); 147 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber, bool interstatementLocation);
84 void removeBreakpoint(const String& breakpointId); 148 void removeBreakpoint(const String& breakpointId);
85 void setBreakpointsActivated(bool); 149 void setBreakpointsActivated(bool);
86 150
87 enum PauseOnExceptionsState { 151 enum PauseOnExceptionsState {
88 DontPauseOnExceptions, 152 DontPauseOnExceptions,
89 PauseOnAllExceptions, 153 PauseOnAllExceptions,
90 PauseOnUncaughtExceptions 154 PauseOnUncaughtExceptions
91 }; 155 };
(...skipping 29 matching lines...) Expand all
121 185
122 private: 186 private:
123 V8Debugger(v8::Isolate*, Client*); 187 V8Debugger(v8::Isolate*, Client*);
124 188
125 void compileDebuggerScript(); 189 void compileDebuggerScript();
126 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a rgc, v8::Local<v8::Value> argv[]); 190 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a rgc, v8::Local<v8::Value> argv[]);
127 v8::Local<v8::Object> debuggerScriptLocal() const; 191 v8::Local<v8::Object> debuggerScriptLocal() const;
128 v8::Local<v8::Context> debuggerContext() const; 192 v8::Local<v8::Context> debuggerContext() const;
129 void clearBreakpoints(); 193 void clearBreakpoints();
130 194
131 ScriptDebugListener::ParsedScript createParsedScript(v8::Local<v8::Object> s ourceObject, CompileResult); 195 ParsedScript createParsedScript(v8::Local<v8::Object> sourceObject, CompileR esult);
132 196
133 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&) ; 197 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); 198 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&); 199 static void v8DebugEventCallback(const v8::Debug::EventDetails&);
136 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const char* functionName); 200 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const char* functionName);
137 void handleV8DebugEvent(const v8::Debug::EventDetails&); 201 void handleV8DebugEvent(const v8::Debug::EventDetails&);
138 202
139 v8::Local<v8::String> v8InternalizedString(const char*) const; 203 v8::Local<v8::String> v8InternalizedString(const char*) const;
140 204
141 enum ScopeInfoDetails { 205 enum ScopeInfoDetails {
(...skipping 15 matching lines...) Expand all
157 v8::UniquePersistent<v8::FunctionTemplate> m_callFrameWrapperTemplate; 221 v8::UniquePersistent<v8::FunctionTemplate> m_callFrameWrapperTemplate;
158 v8::Local<v8::Object> m_executionState; 222 v8::Local<v8::Object> m_executionState;
159 RefPtr<ScriptState> m_pausedScriptState; 223 RefPtr<ScriptState> m_pausedScriptState;
160 bool m_runningNestedMessageLoop; 224 bool m_runningNestedMessageLoop;
161 }; 225 };
162 226
163 } // namespace blink 227 } // namespace blink
164 228
165 229
166 #endif // V8Debugger_h 230 #endif // V8Debugger_h
OLDNEW
« no previous file with comments | « Source/core/inspector/ScriptDebugListener.cpp ('k') | Source/core/inspector/V8Debugger.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698