OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/Collections.h" | |
9 #include "platform/inspector_protocol/Platform.h" | 8 #include "platform/inspector_protocol/Platform.h" |
10 #include "platform/inspector_protocol/String16.h" | 9 #include "platform/inspector_protocol/String16.h" |
11 #include "platform/v8_inspector/public/V8ConsoleTypes.h" | 10 #include "platform/v8_inspector/public/V8ConsoleTypes.h" |
12 | 11 |
13 #include <v8.h> | 12 #include <v8.h> |
14 #include <vector> | |
15 | 13 |
16 namespace blink { | 14 namespace blink { |
17 | 15 |
18 class V8ContextInfo; | 16 class V8ContextInfo; |
19 class V8DebuggerClient; | 17 class V8DebuggerClient; |
20 class V8InspectorSession; | 18 class V8InspectorSession; |
21 class V8InspectorSessionClient; | 19 class V8InspectorSessionClient; |
22 class V8StackTrace; | 20 class V8StackTrace; |
23 | 21 |
24 namespace protocol { | 22 namespace protocol { |
25 class DictionaryValue; | |
26 class FrontendChannel; | 23 class FrontendChannel; |
27 } | 24 } |
28 | 25 |
29 class PLATFORM_EXPORT V8Debugger { | 26 class PLATFORM_EXPORT V8Debugger { |
30 public: | 27 public: |
31 static std::unique_ptr<V8Debugger> create(v8::Isolate*, V8DebuggerClient*); | 28 static std::unique_ptr<V8Debugger> create(v8::Isolate*, V8DebuggerClient*); |
32 virtual ~V8Debugger() { } | 29 virtual ~V8Debugger() { } |
33 | 30 |
| 31 // Contexts instrumentation. |
34 virtual void contextCreated(const V8ContextInfo&) = 0; | 32 virtual void contextCreated(const V8ContextInfo&) = 0; |
35 virtual void contextDestroyed(v8::Local<v8::Context>) = 0; | 33 virtual void contextDestroyed(v8::Local<v8::Context>) = 0; |
36 // TODO(dgozman): remove this one. | |
37 virtual void resetContextGroup(int contextGroupId) = 0; | 34 virtual void resetContextGroup(int contextGroupId) = 0; |
| 35 |
| 36 // Various instrumentation. |
38 virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0; | 37 virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0; |
39 virtual void didExecuteScript(v8::Local<v8::Context>) = 0; | 38 virtual void didExecuteScript(v8::Local<v8::Context>) = 0; |
40 virtual void idleStarted() = 0; | 39 virtual void idleStarted() = 0; |
41 virtual void idleFinished() = 0; | 40 virtual void idleFinished() = 0; |
42 // TODO(dgozman): remove requestIdentifier and workerId. | |
43 virtual bool addConsoleMessage(int contextGroupId, MessageSource, MessageLev
el, const String16& message, const String16& url, unsigned lineNumber, unsigned
columnNumber, std::unique_ptr<V8StackTrace>, int scriptId, const String16& reque
stIdentifier, const String16& workerId) = 0; | |
44 // TODO(dgozman): can we remove this method? | |
45 virtual void logToConsole(v8::Local<v8::Context>, const String16& message, v
8::Local<v8::Value> arg1, v8::Local<v8::Value> arg2) = 0; | |
46 // TODO(dgozman): can we pass exception object? | |
47 virtual void exceptionThrown(int contextGroupId, const String16& errorMessag
e, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_
ptr<V8StackTrace>, int scriptId) = 0; | |
48 virtual unsigned promiseRejected(v8::Local<v8::Context>, const String16& err
orMessage, v8::Local<v8::Value> exception, const String16& url, unsigned lineNum
ber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) = 0; | |
49 virtual void promiseRejectionRevoked(v8::Local<v8::Context>, unsigned promis
eRejectionId) = 0; | |
50 virtual void consoleMessagesCount(int contextGroupId, unsigned* total, unsig
ned* withArguments) = 0; | |
51 // TODO(dgozman): remove mute methods. | |
52 virtual void muteConsole() = 0; | |
53 virtual void unmuteConsole() = 0; | |
54 | 41 |
55 virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId, prot
ocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state) = 0; | 42 // Async call stacks instrumentation. |
56 virtual bool isPaused() = 0; | |
57 | |
58 virtual std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTr
ace>) = 0; | |
59 virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0; | |
60 | |
61 // API to report async call stacks. | |
62 virtual void asyncTaskScheduled(const String16& taskName, void* task, bool r
ecurring) = 0; | 43 virtual void asyncTaskScheduled(const String16& taskName, void* task, bool r
ecurring) = 0; |
63 virtual void asyncTaskCanceled(void* task) = 0; | 44 virtual void asyncTaskCanceled(void* task) = 0; |
64 virtual void asyncTaskStarted(void* task) = 0; | 45 virtual void asyncTaskStarted(void* task) = 0; |
65 virtual void asyncTaskFinished(void* task) = 0; | 46 virtual void asyncTaskFinished(void* task) = 0; |
66 virtual void allAsyncTasksCanceled() = 0; | 47 virtual void allAsyncTasksCanceled() = 0; |
| 48 |
| 49 // Runtime instrumentation. |
| 50 // TODO(dgozman): can we pass exception object? |
| 51 virtual void exceptionThrown(int contextGroupId, const String16& errorMessag
e, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_
ptr<V8StackTrace>, int scriptId) = 0; |
| 52 virtual unsigned promiseRejected(v8::Local<v8::Context>, const String16& err
orMessage, v8::Local<v8::Value> exception, const String16& url, unsigned lineNum
ber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) = 0; |
| 53 virtual void promiseRejectionRevoked(v8::Local<v8::Context>, unsigned promis
eRejectionId) = 0; |
| 54 |
| 55 // TODO(dgozman): remove requestIdentifier. |
| 56 virtual void addConsoleMessage(int contextGroupId, MessageSource, MessageLev
el, const String16& message, const String16& url, unsigned lineNumber, unsigned
columnNumber, std::unique_ptr<V8StackTrace>, int scriptId, const String16& reque
stIdentifier, const String16& workerId) = 0; |
| 57 // TODO(dgozman): can we remove this method? |
| 58 virtual void logToConsole(v8::Local<v8::Context>, const String16& message, v
8::Local<v8::Value> arg1, v8::Local<v8::Value> arg2) = 0; |
| 59 // TODO(dgozman): try to remove this. |
| 60 virtual void consoleMessagesCount(int contextGroupId, unsigned* total, unsig
ned* withArguments) = 0; |
| 61 |
| 62 // API methods. |
| 63 virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId, prot
ocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state) = 0; |
| 64 virtual std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTr
ace>) = 0; |
| 65 virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0; |
67 }; | 66 }; |
68 | 67 |
69 } // namespace blink | 68 } // namespace blink |
70 | 69 |
71 | 70 |
72 #endif // V8Debugger_h | 71 #endif // V8Debugger_h |
OLD | NEW |