OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_INSPECTOR_V8CONSOLE_H_ |
| 6 #define V8_INSPECTOR_V8CONSOLE_H_ |
| 7 |
| 8 #include "src/inspector/Allocator.h" |
| 9 |
| 10 #include <v8.h> |
| 11 |
| 12 namespace v8_inspector { |
| 13 |
| 14 class InspectedContext; |
| 15 |
| 16 // Console API |
| 17 // https://console.spec.whatwg.org/#console-interface |
| 18 class V8Console { |
| 19 public: |
| 20 static v8::Local<v8::Object> createConsole(InspectedContext*, |
| 21 bool hasMemoryAttribute); |
| 22 static void clearInspectedContextIfNeeded(v8::Local<v8::Context>, |
| 23 v8::Local<v8::Object> console); |
| 24 static v8::Local<v8::Object> createCommandLineAPI(InspectedContext*); |
| 25 |
| 26 class CommandLineAPIScope { |
| 27 V8_INSPECTOR_DISALLOW_COPY(CommandLineAPIScope); |
| 28 |
| 29 public: |
| 30 CommandLineAPIScope(v8::Local<v8::Context>, |
| 31 v8::Local<v8::Object> commandLineAPI, |
| 32 v8::Local<v8::Object> global); |
| 33 ~CommandLineAPIScope(); |
| 34 |
| 35 private: |
| 36 static void accessorGetterCallback( |
| 37 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&); |
| 38 static void accessorSetterCallback(v8::Local<v8::Name>, |
| 39 v8::Local<v8::Value>, |
| 40 const v8::PropertyCallbackInfo<void>&); |
| 41 |
| 42 v8::Local<v8::Context> m_context; |
| 43 v8::Local<v8::Object> m_commandLineAPI; |
| 44 v8::Local<v8::Object> m_global; |
| 45 v8::Local<v8::Set> m_installedMethods; |
| 46 bool m_cleanup; |
| 47 }; |
| 48 |
| 49 private: |
| 50 static void debugCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 51 static void errorCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 52 static void infoCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 53 static void logCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 54 static void warnCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 55 static void dirCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 56 static void dirxmlCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 57 static void tableCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 58 static void traceCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 59 static void groupCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 60 static void groupCollapsedCallback( |
| 61 const v8::FunctionCallbackInfo<v8::Value>&); |
| 62 static void groupEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 63 static void clearCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 64 static void countCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 65 static void assertCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 66 static void markTimelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 67 static void profileCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 68 static void profileEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 69 static void timelineCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 70 static void timelineEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 71 static void timeCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 72 static void timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 73 static void timeStampCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 74 // TODO(foolip): There is no spec for the Memory Info API, see blink-dev: |
| 75 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/g5YRCGpC9vs/b4OJz7
1NmPwJ |
| 76 static void memoryGetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 77 static void memorySetterCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 78 |
| 79 // CommandLineAPI |
| 80 static void keysCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 81 static void valuesCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 82 static void debugFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 83 static void undebugFunctionCallback( |
| 84 const v8::FunctionCallbackInfo<v8::Value>&); |
| 85 static void monitorFunctionCallback( |
| 86 const v8::FunctionCallbackInfo<v8::Value>&); |
| 87 static void unmonitorFunctionCallback( |
| 88 const v8::FunctionCallbackInfo<v8::Value>&); |
| 89 static void lastEvaluationResultCallback( |
| 90 const v8::FunctionCallbackInfo<v8::Value>&); |
| 91 static void inspectCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 92 static void copyCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 93 static void inspectedObject(const v8::FunctionCallbackInfo<v8::Value>&, |
| 94 unsigned num); |
| 95 static void inspectedObject0( |
| 96 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 97 inspectedObject(info, 0); |
| 98 } |
| 99 static void inspectedObject1( |
| 100 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 101 inspectedObject(info, 1); |
| 102 } |
| 103 static void inspectedObject2( |
| 104 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 105 inspectedObject(info, 2); |
| 106 } |
| 107 static void inspectedObject3( |
| 108 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 109 inspectedObject(info, 3); |
| 110 } |
| 111 static void inspectedObject4( |
| 112 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 113 inspectedObject(info, 4); |
| 114 } |
| 115 }; |
| 116 |
| 117 } // namespace v8_inspector |
| 118 |
| 119 #endif // V8_INSPECTOR_V8CONSOLE_H_ |
OLD | NEW |