OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 V8_INSPECTOR_V8CONSOLE_H_ | 5 #ifndef V8_INSPECTOR_V8CONSOLE_H_ |
6 #define V8_INSPECTOR_V8CONSOLE_H_ | 6 #define V8_INSPECTOR_V8CONSOLE_H_ |
7 | 7 |
8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
9 | 9 |
10 #include "include/v8.h" | 10 #include "include/v8.h" |
11 | 11 |
12 namespace v8_inspector { | 12 namespace v8_inspector { |
13 | 13 |
| 14 enum class ConsoleAPIType; |
| 15 class InjectedScript; |
14 class InspectedContext; | 16 class InspectedContext; |
| 17 class String16; |
| 18 class V8ConsoleMessageStorage; |
| 19 class V8DebuggerAgentImpl; |
15 class V8InspectorImpl; | 20 class V8InspectorImpl; |
| 21 class V8InspectorSessionImpl; |
| 22 class V8ProfilerAgentImpl; |
| 23 class V8RuntimeAgentImpl; |
16 | 24 |
17 // Console API | 25 // Console API |
18 // https://console.spec.whatwg.org/#console-interface | 26 // https://console.spec.whatwg.org/#console-interface |
19 class V8Console { | 27 class V8Console { |
20 public: | 28 public: |
21 v8::Local<v8::Object> createConsole(v8::Local<v8::Context> context); | 29 v8::Local<v8::Object> createConsole(v8::Local<v8::Context> context); |
22 v8::Local<v8::Object> createCommandLineAPI(v8::Local<v8::Context> context); | 30 v8::Local<v8::Object> createCommandLineAPI(v8::Local<v8::Context> context); |
23 void installMemoryGetter(v8::Local<v8::Context> context, | 31 void installMemoryGetter(v8::Local<v8::Context> context, |
24 v8::Local<v8::Object> console); | 32 v8::Local<v8::Object> console); |
25 | 33 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void clearCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 72 void clearCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
65 void countCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 73 void countCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
66 void assertCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 74 void assertCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
67 void markTimelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 75 void markTimelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
68 void profileCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 76 void profileCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
69 void profileEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 77 void profileEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
70 void timelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 78 void timelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
71 void timelineEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 79 void timelineEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
72 void timeCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 80 void timeCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
73 void timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 81 void timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 82 void time(const v8::FunctionCallbackInfo<v8::Value>&, bool timelinePrefix); |
| 83 void timeEnd(const v8::FunctionCallbackInfo<v8::Value>&, bool timelinePrefix); |
74 void timeStampCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 84 void timeStampCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
75 | 85 |
76 template <void (V8Console::*func)(const v8::FunctionCallbackInfo<v8::Value>&)> | 86 template <void (V8Console::*func)(const v8::FunctionCallbackInfo<v8::Value>&)> |
77 static void call(const v8::FunctionCallbackInfo<v8::Value>& info) { | 87 static void call(const v8::FunctionCallbackInfo<v8::Value>& info) { |
78 V8Console* console = | 88 V8Console* console = |
79 static_cast<V8Console*>(info.Data().As<v8::External>()->Value()); | 89 static_cast<V8Console*>(info.Data().As<v8::External>()->Value()); |
80 (console->*func)(info); | 90 (console->*func)(info); |
81 } | 91 } |
82 | 92 |
83 // TODO(foolip): There is no spec for the Memory Info API, see blink-dev: | 93 // TODO(foolip): There is no spec for the Memory Info API, see blink-dev: |
(...skipping 22 matching lines...) Expand all Loading... |
106 void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info) { | 116 void inspectedObject2(const v8::FunctionCallbackInfo<v8::Value>& info) { |
107 inspectedObject(info, 2); | 117 inspectedObject(info, 2); |
108 } | 118 } |
109 void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info) { | 119 void inspectedObject3(const v8::FunctionCallbackInfo<v8::Value>& info) { |
110 inspectedObject(info, 3); | 120 inspectedObject(info, 3); |
111 } | 121 } |
112 void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info) { | 122 void inspectedObject4(const v8::FunctionCallbackInfo<v8::Value>& info) { |
113 inspectedObject(info, 4); | 123 inspectedObject(info, 4); |
114 } | 124 } |
115 | 125 |
| 126 int currentContextId(); |
| 127 V8InspectorSessionImpl* currentSession(); |
| 128 V8ProfilerAgentImpl* profilerAgent(); |
| 129 V8DebuggerAgentImpl* debuggerAgent(); |
| 130 V8RuntimeAgentImpl* runtimeAgent(); |
| 131 InjectedScript* injectedScript(); |
| 132 V8ConsoleMessageStorage* messageStorage(); |
| 133 |
| 134 void reportCall(ConsoleAPIType type, |
| 135 const v8::FunctionCallbackInfo<v8::Value>& info); |
| 136 void reportCallWithDefaultArgument( |
| 137 ConsoleAPIType type, const v8::FunctionCallbackInfo<v8::Value>& info, |
| 138 const String16& message); |
| 139 void reportCallWithArgument(ConsoleAPIType type, const String16& message); |
| 140 void reportDeprecatedCall(const char* id, const String16& message); |
| 141 |
| 142 void reportCall(ConsoleAPIType type, |
| 143 const std::vector<v8::Local<v8::Value>>& arguments); |
| 144 |
| 145 String16 firstArgToString(const v8::FunctionCallbackInfo<v8::Value>& info, |
| 146 const String16& defaultValue); |
| 147 bool firstArgToBoolean(const v8::FunctionCallbackInfo<v8::Value>& info, |
| 148 bool defaultValue); |
| 149 |
116 V8InspectorImpl* m_inspector; | 150 V8InspectorImpl* m_inspector; |
117 }; | 151 }; |
118 | 152 |
119 } // namespace v8_inspector | 153 } // namespace v8_inspector |
120 | 154 |
121 #endif // V8_INSPECTOR_V8CONSOLE_H_ | 155 #endif // V8_INSPECTOR_V8CONSOLE_H_ |
OLD | NEW |