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 17 matching lines...) Expand all Loading... |
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 ScriptDebugServer_h | 31 #ifndef ScriptDebugServer_h |
32 #define ScriptDebugServer_h | 32 #define ScriptDebugServer_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" | 37 #include "core/inspector/ScriptDebugListener.h" |
38 #include "wtf/PassOwnPtr.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/Forward.h" |
39 | 40 |
40 #include <v8-debug.h> | 41 #include <v8-debug.h> |
41 #include <v8.h> | 42 #include <v8.h> |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class ScriptState; | 46 class ScriptState; |
46 class ScriptDebugListener; | 47 class ScriptDebugListener; |
47 class ScriptValue; | 48 class ScriptValue; |
48 class JavaScriptCallFrame; | 49 class JavaScriptCallFrame; |
49 | 50 |
50 class CORE_EXPORT ScriptDebugServer : public NoBaseWillBeGarbageCollectedFinaliz
ed<ScriptDebugServer> { | 51 class CORE_EXPORT ScriptDebugServer : public NoBaseWillBeGarbageCollectedFinaliz
ed<ScriptDebugServer> { |
51 WTF_MAKE_NONCOPYABLE(ScriptDebugServer); | 52 WTF_MAKE_NONCOPYABLE(ScriptDebugServer); |
52 public: | 53 public: |
53 virtual ~ScriptDebugServer(); | 54 class Client : public WillBeGarbageCollectedMixin { |
54 DECLARE_VIRTUAL_TRACE(); | |
55 | |
56 class Client { | |
57 public: | 55 public: |
58 virtual ~Client() { } | 56 virtual ~Client() { } |
59 virtual v8::Local<v8::Object> compileDebuggerScript() = 0; | 57 virtual v8::Local<v8::Object> compileDebuggerScript() = 0; |
60 virtual ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Co
ntext>) = 0; | 58 virtual ScriptDebugListener* getDebugListenerForContext(v8::Local<v8::Co
ntext>) = 0; |
61 virtual void runMessageLoopOnPause(v8::Local<v8::Context>) = 0; | 59 virtual void runMessageLoopOnPause(v8::Local<v8::Context>) = 0; |
62 virtual void quitMessageLoopOnPause() = 0; | 60 virtual void quitMessageLoopOnPause() = 0; |
| 61 |
| 62 DEFINE_INLINE_VIRTUAL_TRACE() { } |
63 }; | 63 }; |
64 | 64 |
| 65 static PassOwnPtrWillBeRawPtr<ScriptDebugServer> create(v8::Isolate* isolate
, Client* client) |
| 66 { |
| 67 return adoptPtrWillBeNoop(new ScriptDebugServer(isolate, client)); |
| 68 } |
| 69 |
| 70 virtual ~ScriptDebugServer(); |
| 71 DECLARE_VIRTUAL_TRACE(); |
| 72 |
65 void enable(); | 73 void enable(); |
66 void disable(); | 74 void disable(); |
67 bool enabled() const; | 75 bool enabled() const; |
68 | 76 |
69 static void setContextDebugData(v8::Local<v8::Context>, const String& contex
tDebugData); | 77 static void setContextDebugData(v8::Local<v8::Context>, const String& contex
tDebugData); |
70 // Each script inherits debug data from v8::Context where it has been compil
ed. | 78 // Each script inherits debug data from v8::Context where it has been compil
ed. |
71 // Only scripts whose debug data contains |contextDebugDataSubstring| substr
ing will be reported. | 79 // Only scripts whose debug data contains |contextDebugDataSubstring| substr
ing will be reported. |
72 // Passing empty string will result in reporting all scripts. | 80 // Passing empty string will result in reporting all scripts. |
73 void reportCompiledScripts(const String& contextDebugDataSubstring, ScriptDe
bugListener*); | 81 void reportCompiledScripts(const String& contextDebugDataSubstring, ScriptDe
bugListener*); |
74 | 82 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 122 |
115 bool isPaused(); | 123 bool isPaused(); |
116 | 124 |
117 v8::Local<v8::Value> functionScopes(v8::Local<v8::Function>); | 125 v8::Local<v8::Value> functionScopes(v8::Local<v8::Function>); |
118 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&); | 126 v8::Local<v8::Value> generatorObjectDetails(v8::Local<v8::Object>&); |
119 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&); | 127 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Object>&); |
120 v8::Local<v8::Value> getInternalProperties(v8::Local<v8::Object>&); | 128 v8::Local<v8::Value> getInternalProperties(v8::Local<v8::Object>&); |
121 v8::MaybeLocal<v8::Value> setFunctionVariableValue(v8::Local<v8::Value> func
tionValue, int scopeNumber, const String& variableName, v8::Local<v8::Value> new
Value); | 129 v8::MaybeLocal<v8::Value> setFunctionVariableValue(v8::Local<v8::Value> func
tionValue, int scopeNumber, const String& variableName, v8::Local<v8::Value> new
Value); |
122 | 130 |
123 v8::Isolate* isolate() const { return m_isolate; } | 131 v8::Isolate* isolate() const { return m_isolate; } |
124 explicit ScriptDebugServer(v8::Isolate*, Client*); | |
125 | 132 |
126 private: | 133 private: |
| 134 ScriptDebugServer(v8::Isolate*, Client*); |
| 135 |
127 void compileDebuggerScript(); | 136 void compileDebuggerScript(); |
128 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a
rgc, v8::Local<v8::Value> argv[]); | 137 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a
rgc, v8::Local<v8::Value> argv[]); |
129 v8::Local<v8::Object> debuggerScriptLocal() const; | 138 v8::Local<v8::Object> debuggerScriptLocal() const; |
130 v8::Local<v8::Context> debuggerContext() const; | 139 v8::Local<v8::Context> debuggerContext() const; |
131 void clearBreakpoints(); | 140 void clearBreakpoints(); |
132 | 141 |
133 void dispatchDidParseSource(ScriptDebugListener*, v8::Local<v8::Object> sour
ceObject, CompileResult); | 142 void dispatchDidParseSource(ScriptDebugListener*, v8::Local<v8::Object> sour
ceObject, CompileResult); |
134 | 143 |
135 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; | 144 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; |
136 void handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8::Object
> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakp
oints, bool isPromiseRejection = false); | 145 void handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8::Object
> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakp
oints, bool isPromiseRejection = false); |
(...skipping 24 matching lines...) Expand all Loading... |
161 RefPtr<ScriptState> m_pausedScriptState; | 170 RefPtr<ScriptState> m_pausedScriptState; |
162 bool m_runningNestedMessageLoop; | 171 bool m_runningNestedMessageLoop; |
163 class ThreadSafeTaskQueue; | 172 class ThreadSafeTaskQueue; |
164 OwnPtr<ThreadSafeTaskQueue> m_taskQueue; | 173 OwnPtr<ThreadSafeTaskQueue> m_taskQueue; |
165 }; | 174 }; |
166 | 175 |
167 } // namespace blink | 176 } // namespace blink |
168 | 177 |
169 | 178 |
170 #endif // ScriptDebugServer_h | 179 #endif // ScriptDebugServer_h |
OLD | NEW |