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

Side by Side Diff: Source/bindings/v8/ScriptDebugServer.h

Issue 351423002: Moved files under Source/bindings/v8 to Source/bindings/core/v8. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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/v8/ScriptController.cpp ('k') | Source/bindings/v8/ScriptDebugServer.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 ScriptDebugServer_h
32 #define ScriptDebugServer_h
33
34 #include "bindings/v8/ScopedPersistent.h"
35 #include "core/InspectorBackendDispatcher.h"
36 #include "core/inspector/ScriptBreakpoint.h"
37 #include "core/inspector/ScriptCallStack.h"
38 #include "core/inspector/ScriptDebugListener.h"
39 #include "wtf/HashMap.h"
40 #include "wtf/Noncopyable.h"
41 #include "wtf/PassOwnPtr.h"
42 #include "wtf/Vector.h"
43 #include "wtf/text/StringHash.h"
44 #include "wtf/text/WTFString.h"
45 #include <v8-debug.h>
46 #include <v8.h>
47
48 namespace WebCore {
49
50 class ScriptState;
51 class ScriptController;
52 class ScriptDebugListener;
53 class ScriptSourceCode;
54 class ScriptValue;
55 class JavaScriptCallFrame;
56
57 class ScriptDebugServer {
58 WTF_MAKE_NONCOPYABLE(ScriptDebugServer);
59 public:
60 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber, bool interstatementLocation);
61 void removeBreakpoint(const String& breakpointId);
62 void clearBreakpoints();
63 void setBreakpointsActivated(bool activated);
64
65 enum PauseOnExceptionsState {
66 DontPauseOnExceptions,
67 PauseOnAllExceptions,
68 PauseOnUncaughtExceptions
69 };
70 PauseOnExceptionsState pauseOnExceptionsState();
71 void setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState );
72
73 void setPauseOnNextStatement(bool pause);
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 PassRefPtrWillBeRawPtr<JavaScriptCallFrame> topCallFrameNoScopes();
85 int frameCount();
86
87 class Task {
88 public:
89 virtual ~Task() { }
90 virtual void run() = 0;
91 };
92 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*);
93 void runPendingTasks();
94
95 bool isPaused();
96 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; }
97
98 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>);
99 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&);
100 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa lue);
101 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]);
102
103 virtual void compileScript(ScriptState*, const String& expression, const Str ing& sourceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace);
104 virtual void clearCompiledScripts();
105 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re sult, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* colum nNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace);
106 virtual void setPreprocessorSource(const String&) { }
107 virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) { }
108 virtual PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSou rceCode&);
109 virtual String preprocessEventListener(LocalFrame*, const String& source, co nst String& url, const String& functionName);
110
111 virtual void muteWarningsAndDeprecations() { }
112 virtual void unmuteWarningsAndDeprecations() { }
113
114 protected:
115 explicit ScriptDebugServer(v8::Isolate*);
116 virtual ~ScriptDebugServer();
117
118 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte xt>) = 0;
119 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0;
120 virtual void quitMessageLoopOnPause() = 0;
121
122 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&) ;
123 void handleProgramBreak(ScriptState* pausedScriptState, v8::Handle<v8::Objec t> executionState, v8::Handle<v8::Value> exception, v8::Handle<v8::Array> hitBre akpoints);
124
125 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails );
126 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails);
127
128 void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Ob ject> sourceObject);
129
130 void ensureDebuggerScriptCompiled();
131 void discardDebuggerScript();
132
133 PauseOnExceptionsState m_pauseOnExceptionsState;
134 ScopedPersistent<v8::Object> m_debuggerScript;
135 v8::Local<v8::Object> m_executionState;
136 RefPtr<ScriptState> m_pausedScriptState;
137 bool m_breakpointsActivated;
138 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate;
139 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts;
140 v8::Isolate* m_isolate;
141
142 private:
143 enum ScopeInfoDetails {
144 AllScopes,
145 FastAsyncScopes,
146 NoScopes // Should be the last option.
147 };
148
149 ScriptValue currentCallFramesInner(ScopeInfoDetails);
150
151 PassRefPtrWillBeRawPtr<JavaScriptCallFrame> wrapCallFrames(int maximumLimit, ScopeInfoDetails);
152
153 bool m_runningNestedMessageLoop;
154 };
155
156 } // namespace WebCore
157
158
159 #endif // ScriptDebugServer_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptController.cpp ('k') | Source/bindings/v8/ScriptDebugServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698