OLD | NEW |
1 // Copyright 2016 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 V8Inspector_h | 5 #ifndef V8Inspector_h |
6 #define V8Inspector_h | 6 #define V8Inspector_h |
7 | 7 |
8 #include "platform/inspector_protocol/Platform.h" | 8 #include "platform/inspector_protocol/Platform.h" |
9 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 9 #include "platform/inspector_protocol/String16.h" |
10 #include "platform/v8_inspector/public/V8InspectorSession.h" | |
11 #include "platform/v8_inspector/public/V8InspectorSessionClient.h" | |
12 | 10 |
13 #include <v8.h> | 11 #include <v8.h> |
14 | 12 |
15 namespace blink { | 13 namespace blink { |
16 | 14 |
| 15 class V8ContextInfo; |
| 16 class V8InspectorClient; |
| 17 class V8InspectorSession; |
| 18 class V8InspectorSessionClient; |
| 19 class V8StackTrace; |
| 20 |
17 namespace protocol { | 21 namespace protocol { |
18 class Dispatcher; | |
19 class Frontend; | |
20 class FrontendChannel; | 22 class FrontendChannel; |
21 } | 23 } |
22 | 24 |
23 class V8Debugger; | 25 class PLATFORM_EXPORT V8Inspector { |
24 class V8HeapProfilerAgent; | 26 public: |
25 class V8ProfilerAgent; | 27 static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*)
; |
| 28 virtual ~V8Inspector() { } |
26 | 29 |
27 class V8Inspector : public V8DebuggerClient, V8InspectorSessionClient { | 30 // Contexts instrumentation. |
28 public: | 31 virtual void contextCreated(const V8ContextInfo&) = 0; |
29 V8Inspector(v8::Isolate*, v8::Local<v8::Context>); | 32 virtual void contextDestroyed(v8::Local<v8::Context>) = 0; |
30 ~V8Inspector(); | 33 virtual void resetContextGroup(int contextGroupId) = 0; |
31 | 34 |
32 // Transport interface. | 35 // Various instrumentation. |
33 void connectFrontend(protocol::FrontendChannel*); | 36 virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0; |
34 void disconnectFrontend(); | 37 virtual void didExecuteScript(v8::Local<v8::Context>) = 0; |
35 void dispatchMessageFromFrontend(const String16& message); | 38 virtual void idleStarted() = 0; |
36 void notifyContextDestroyed(); | 39 virtual void idleFinished() = 0; |
37 | 40 |
38 private: | 41 // Async stack traces instrumentation. |
39 String16 valueSubtype(v8::Local<v8::Value>) override; | 42 virtual void asyncTaskScheduled(const String16& taskName, void* task, bool r
ecurring) = 0; |
40 bool formatAccessorsAsProperties(v8::Local<v8::Value>) override; | 43 virtual void asyncTaskCanceled(void* task) = 0; |
41 void muteWarningsAndDeprecations(int) override { } | 44 virtual void asyncTaskStarted(void* task) = 0; |
42 void unmuteWarningsAndDeprecations(int) override { } | 45 virtual void asyncTaskFinished(void* task) = 0; |
43 double currentTimeMS() override { return 0; }; | 46 virtual void allAsyncTasksCanceled() = 0; |
44 | 47 |
45 bool isExecutionAllowed() override; | 48 // Exceptions instrumentation. |
46 v8::Local<v8::Context> ensureDefaultContextInGroup(int contextGroupId) overr
ide; | 49 virtual unsigned exceptionThrown(v8::Local<v8::Context>, const String16& mes
sage, v8::Local<v8::Value> exception, const String16& detailedMessage, const Str
ing16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackT
race>, int scriptId) = 0; |
47 void beginEnsureAllContextsInGroup(int contextGroupId) override { } | 50 virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
const String16& message) = 0; |
48 void endEnsureAllContextsInGroup(int contextGroupId) override { } | |
49 void beginUserGesture() override { } | |
50 void endUserGesture() override { } | |
51 bool isInspectableHeapObject(v8::Local<v8::Object>) override { return true;
} | |
52 void consoleTime(const String16& title) override { } | |
53 void consoleTimeEnd(const String16& title) override { } | |
54 void consoleTimeStamp(const String16& title) override { } | |
55 void consoleAPIMessage(int contextGroupId, MessageLevel, const String16& mes
sage, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTr
ace*) override { } | |
56 v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*, v8::Local<v8::Context>) o
verride | |
57 { | |
58 return v8::MaybeLocal<v8::Value>(); | |
59 } | |
60 void installAdditionalCommandLineAPI(v8::Local<v8::Context>, v8::Local<v8::O
bject>) override { } | |
61 void enableAsyncInstrumentation() override { } | |
62 void disableAsyncInstrumentation() override { } | |
63 void startRepeatingTimer(double, TimerCallback, void* data) override { } | |
64 void cancelTimer(void* data) override { } | |
65 | 51 |
66 // V8InspectorSessionClient | 52 // API methods. |
67 void resumeStartup() override { }; | 53 virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId, prot
ocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state) = 0; |
68 bool canExecuteScripts() override; | 54 virtual std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTr
ace>) = 0; |
69 void profilingStarted() override { }; | 55 virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0; |
70 void profilingStopped() override { }; | |
71 void consoleCleared() override { }; | |
72 | |
73 std::unique_ptr<V8Debugger> m_debugger; | |
74 std::unique_ptr<V8InspectorSession> m_session; | |
75 String16 m_state; | |
76 v8::Local<v8::Context> m_context; | |
77 }; | 56 }; |
78 | 57 |
79 } | 58 } // namespace blink |
| 59 |
80 | 60 |
81 #endif // V8Inspector_h | 61 #endif // V8Inspector_h |
OLD | NEW |