OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8Debugger_h | 5 #ifndef V8Debugger_h |
6 #define V8Debugger_h | 6 #define V8Debugger_h |
7 | 7 |
8 #include "platform/inspector_protocol/InspectorProtocol.h" | 8 #include "platform/inspector_protocol/InspectorProtocol.h" |
9 #include "platform/v8_inspector/JavaScriptCallFrame.h" | 9 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
10 #include "platform/v8_inspector/V8DebuggerScript.h" | 10 #include "platform/v8_inspector/V8DebuggerScript.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 bool isPaused(); | 68 bool isPaused(); |
69 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } | 69 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
70 | 70 |
71 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } | 71 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
72 V8StackTraceImpl* currentAsyncCallChain(); | 72 V8StackTraceImpl* currentAsyncCallChain(); |
73 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); | 73 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
74 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>
); | 74 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>
); |
75 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); | 75 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); |
76 | 76 |
77 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Function>); | |
78 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Loc
al<v8::Value>); | 77 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Loc
al<v8::Value>); |
79 | 78 |
80 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
); | 79 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring
); |
81 void asyncTaskCanceled(void* task); | 80 void asyncTaskCanceled(void* task); |
82 void asyncTaskStarted(void* task); | 81 void asyncTaskStarted(void* task); |
83 void asyncTaskFinished(void* task); | 82 void asyncTaskFinished(void* task); |
84 void allAsyncTasksCanceled(); | 83 void allAsyncTasksCanceled(); |
85 | 84 |
86 void muteScriptParsedEvents(); | 85 void muteScriptParsedEvents(); |
87 void unmuteScriptParsedEvents(); | 86 void unmuteScriptParsedEvents(); |
88 | 87 |
89 private: | 88 private: |
90 void compileDebuggerScript(); | 89 void compileDebuggerScript(); |
91 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a
rgc, v8::Local<v8::Value> argv[]); | 90 v8::MaybeLocal<v8::Value> callDebuggerMethod(const char* functionName, int a
rgc, v8::Local<v8::Value> argv[]); |
92 v8::Local<v8::Context> debuggerContext() const; | 91 v8::Local<v8::Context> debuggerContext() const; |
93 void clearBreakpoints(); | 92 void clearBreakpoints(); |
94 | 93 |
95 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; | 94 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
; |
96 void handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::
Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hit
Breakpoints, bool isPromiseRejection = false); | 95 void handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::
Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hit
Breakpoints, bool isPromiseRejection = false); |
97 static void v8DebugEventCallback(const v8::Debug::EventDetails&); | 96 static void v8DebugEventCallback(const v8::Debug::EventDetails&); |
98 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); | 97 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, const
char* functionName); |
99 void handleV8DebugEvent(const v8::Debug::EventDetails&); | 98 void handleV8DebugEvent(const v8::Debug::EventDetails&); |
100 void handleV8AsyncTaskEvent(v8::Local<v8::Context>, v8::Local<v8::Object> ex
ecutionState, v8::Local<v8::Object> eventData); | 99 void handleV8AsyncTaskEvent(v8::Local<v8::Context>, v8::Local<v8::Object> ex
ecutionState, v8::Local<v8::Object> eventData); |
101 | 100 |
102 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Context>, v8::Local<v8:
:Object>); | 101 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Context>, v8::Local<v8:
:Object>); |
103 v8::Local<v8::Value> generatorObjectLocation(v8::Local<v8::Object>); | 102 v8::Local<v8::Value> generatorObjectLocation(v8::Local<v8::Context>, v8::Loc
al<v8::Object>); |
104 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::
Function>); | 103 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::
Function>); |
| 104 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>, v8::Local<v
8::Function>); |
105 | 105 |
106 v8::Isolate* m_isolate; | 106 v8::Isolate* m_isolate; |
107 V8InspectorImpl* m_inspector; | 107 V8InspectorImpl* m_inspector; |
108 int m_lastContextId; | 108 int m_lastContextId; |
109 int m_enableCount; | 109 int m_enableCount; |
110 bool m_breakpointsActivated; | 110 bool m_breakpointsActivated; |
111 v8::Global<v8::Object> m_debuggerScript; | 111 v8::Global<v8::Object> m_debuggerScript; |
112 v8::Global<v8::Context> m_debuggerContext; | 112 v8::Global<v8::Context> m_debuggerContext; |
113 v8::Local<v8::Object> m_executionState; | 113 v8::Local<v8::Object> m_executionState; |
114 v8::Local<v8::Context> m_pausedContext; | 114 v8::Local<v8::Context> m_pausedContext; |
115 bool m_runningNestedMessageLoop; | 115 bool m_runningNestedMessageLoop; |
116 int m_ignoreScriptParsedEventsCounter; | 116 int m_ignoreScriptParsedEventsCounter; |
117 | 117 |
118 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; | 118 using AsyncTaskToStackTrace = protocol::HashMap<void*, std::unique_ptr<V8Sta
ckTraceImpl>>; |
119 AsyncTaskToStackTrace m_asyncTaskStacks; | 119 AsyncTaskToStackTrace m_asyncTaskStacks; |
120 protocol::HashSet<void*> m_recurringTasks; | 120 protocol::HashSet<void*> m_recurringTasks; |
121 int m_maxAsyncCallStackDepth; | 121 int m_maxAsyncCallStackDepth; |
122 std::vector<void*> m_currentTasks; | 122 std::vector<void*> m_currentTasks; |
123 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; | 123 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
124 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; | 124 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
125 }; | 125 }; |
126 | 126 |
127 } // namespace blink | 127 } // namespace blink |
128 | 128 |
129 #endif // V8Debugger_h | 129 #endif // V8Debugger_h |
OLD | NEW |