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

Side by Side Diff: sky/engine/v8_inspector/ScriptDebugServer.h

Issue 922053002: Remove unused V8 integration code in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
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 SKY_ENGINE_V8_INSPECTOR_SCRIPTDEBUGSERVER_H_
32 #define SKY_ENGINE_V8_INSPECTOR_SCRIPTDEBUGSERVER_H_
33
34 #include "gen/v8_inspector/InspectorBackendDispatcher.h"
35 #include "sky/engine/bindings/core/v8/ScopedPersistent.h"
36 #include "sky/engine/core/inspector/ScriptCallStack.h"
37 #include "sky/engine/v8_inspector/ScriptBreakpoint.h"
38 #include "sky/engine/v8_inspector/ScriptDebugListener.h"
39 #include "sky/engine/wtf/HashMap.h"
40 #include "sky/engine/wtf/Noncopyable.h"
41 #include "sky/engine/wtf/PassOwnPtr.h"
42 #include "sky/engine/wtf/text/StringHash.h"
43 #include "sky/engine/wtf/text/WTFString.h"
44 #include "v8/include/v8-debug.h"
45 #include "v8/include/v8.h"
46
47 namespace blink {
48
49 class ScriptState;
50 class ScriptController;
51 class ScriptDebugListener;
52 class ScriptSourceCode;
53 class ScriptValue;
54 class JavaScriptCallFrame;
55
56 class ScriptDebugServer {
57 WTF_MAKE_NONCOPYABLE(ScriptDebugServer);
58 public:
59 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber, bool interstatementLocation);
60 void removeBreakpoint(const String& breakpointId);
61 void clearBreakpoints();
62 void setBreakpointsActivated(bool activated);
63
64 enum PauseOnExceptionsState {
65 DontPauseOnExceptions,
66 PauseOnAllExceptions,
67 PauseOnUncaughtExceptions
68 };
69 PauseOnExceptionsState pauseOnExceptionsState();
70 void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState );
71
72 void setPauseOnNextStatement(bool pause);
73 bool pausingOnNextStatement();
74 bool canBreakProgram();
75 void breakProgram();
76 void continueProgram();
77 void stepIntoStatement();
78 void stepOverStatement();
79 void stepOutOfFunction();
80
81 bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc riptValue* newCallFrames, RefPtr<JSONObject>* result);
82 ScriptValue currentCallFrames();
83 ScriptValue currentCallFramesForAsyncStack();
84 PassRefPtr<JavaScriptCallFrame> callFrameNoScopes(int index);
85 int frameCount();
86
87 static PassRefPtr<JavaScriptCallFrame> toJavaScriptCallFrameUnsafe(const Scr iptValue&);
88
89 class Task {
90 public:
91 virtual ~Task() { }
92 virtual void run() = 0;
93 };
94 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*);
95 void runPendingTasks();
96
97 bool isPaused();
98 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; }
99
100 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>);
101 v8::Local<v8::Value> collectionEntries(v8::Handle<v8::Object>&);
102 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&);
103 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa lue);
104 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]);
105
106 virtual void compileScript(ScriptState*, const String& expression, const Str ing& sourceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber, int* columnNumber, RefPtr<ScriptCallStack>* stackTrace);
107 virtual void clearCompiledScripts();
108 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re sult, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* colum nNumber, RefPtr<ScriptCallStack>* stackTrace);
109
110 protected:
111 explicit ScriptDebugServer(v8::Isolate*);
112 virtual ~ScriptDebugServer();
113
114 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte xt>) = 0;
115 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0;
116 virtual void quitMessageLoopOnPause() = 0;
117
118 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&) ;
119 void handleProgramBreak(ScriptState* pausedScriptState, v8::Handle<v8::Objec t> executionState, v8::Handle<v8::Value> exception, v8::Handle<v8::Array> hitBre akpoints);
120
121 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails );
122 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails);
123
124 void dispatchDidParseSource(ScriptDebugListener*, v8::Handle<v8::Object> sou rceObject, CompileResult);
125
126 void ensureDebuggerScriptCompiled();
127 void discardDebuggerScript();
128
129 PauseOnExceptionsState m_pauseOnExceptionsState;
130 ScopedPersistent<v8::Object> m_debuggerScript;
131 v8::Local<v8::Object> m_executionState;
132 RefPtr<ScriptState> m_pausedScriptState;
133 bool m_breakpointsActivated;
134 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate;
135 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts;
136 v8::Isolate* m_isolate;
137
138 private:
139 enum ScopeInfoDetails {
140 AllScopes,
141 FastAsyncScopes,
142 NoScopes // Should be the last option.
143 };
144
145 ScriptValue currentCallFramesInner(ScopeInfoDetails);
146
147 PassRefPtr<JavaScriptCallFrame> wrapCallFrames(int maximumLimit, ScopeInfoDe tails);
148
149 void handleV8AsyncTaskEvent(ScriptDebugListener*, ScriptState* pausedScriptS tate, v8::Handle<v8::Object> executionState, v8::Handle<v8::Object> eventData);
150
151 void handleV8PromiseEvent(ScriptDebugListener*, ScriptState* pausedScriptSta te, v8::Handle<v8::Object> executionState, v8::Handle<v8::Object> eventData);
152
153 bool m_runningNestedMessageLoop;
154 };
155
156 } // namespace blink
157
158
159 #endif // SKY_ENGINE_V8_INSPECTOR_SCRIPTDEBUGSERVER_H_
OLDNEW
« no previous file with comments | « sky/engine/v8_inspector/ScriptDebugListener.h ('k') | sky/engine/v8_inspector/ScriptDebugServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698