// Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_INSPECTOR_V8CONSOLE_H_ #define V8_INSPECTOR_V8CONSOLE_H_ #include "src/base/macros.h" #include "include/v8.h" namespace v8_inspector { class InspectedContext; // Console API // https://console.spec.whatwg.org/#console-interface class V8Console { public: static v8::Local createConsole(InspectedContext*, bool hasMemoryAttribute); static void clearInspectedContextIfNeeded(v8::Local, v8::Local console); static v8::Local createCommandLineAPI(InspectedContext*); class CommandLineAPIScope { public: CommandLineAPIScope(v8::Local, v8::Local commandLineAPI, v8::Local global); ~CommandLineAPIScope(); private: static void accessorGetterCallback( v8::Local, const v8::PropertyCallbackInfo&); static void accessorSetterCallback(v8::Local, v8::Local, const v8::PropertyCallbackInfo&); v8::Local m_context; v8::Local m_commandLineAPI; v8::Local m_global; v8::Local m_installedMethods; bool m_cleanup; DISALLOW_COPY_AND_ASSIGN(CommandLineAPIScope); }; private: static void debugCallback(const v8::FunctionCallbackInfo&); static void errorCallback(const v8::FunctionCallbackInfo&); static void infoCallback(const v8::FunctionCallbackInfo&); static void logCallback(const v8::FunctionCallbackInfo&); static void warnCallback(const v8::FunctionCallbackInfo&); static void dirCallback(const v8::FunctionCallbackInfo&); static void dirxmlCallback(const v8::FunctionCallbackInfo&); static void tableCallback(const v8::FunctionCallbackInfo&); static void traceCallback(const v8::FunctionCallbackInfo&); static void groupCallback(const v8::FunctionCallbackInfo&); static void groupCollapsedCallback( const v8::FunctionCallbackInfo&); static void groupEndCallback(const v8::FunctionCallbackInfo&); static void clearCallback(const v8::FunctionCallbackInfo&); static void countCallback(const v8::FunctionCallbackInfo&); static void assertCallback(const v8::FunctionCallbackInfo&); static void markTimelineCallback(const v8::FunctionCallbackInfo&); static void profileCallback(const v8::FunctionCallbackInfo&); static void profileEndCallback(const v8::FunctionCallbackInfo&); static void timelineCallback(const v8::FunctionCallbackInfo&); static void timelineEndCallback(const v8::FunctionCallbackInfo&); static void timeCallback(const v8::FunctionCallbackInfo&); static void timeEndCallback(const v8::FunctionCallbackInfo&); static void timeStampCallback(const v8::FunctionCallbackInfo&); // TODO(foolip): There is no spec for the Memory Info API, see blink-dev: // https://groups.google.com/a/chromium.org/d/msg/blink-dev/g5YRCGpC9vs/b4OJz71NmPwJ static void memoryGetterCallback(const v8::FunctionCallbackInfo&); static void memorySetterCallback(const v8::FunctionCallbackInfo&); // CommandLineAPI static void keysCallback(const v8::FunctionCallbackInfo&); static void valuesCallback(const v8::FunctionCallbackInfo&); static void debugFunctionCallback(const v8::FunctionCallbackInfo&); static void undebugFunctionCallback( const v8::FunctionCallbackInfo&); static void monitorFunctionCallback( const v8::FunctionCallbackInfo&); static void unmonitorFunctionCallback( const v8::FunctionCallbackInfo&); static void lastEvaluationResultCallback( const v8::FunctionCallbackInfo&); static void inspectCallback(const v8::FunctionCallbackInfo&); static void copyCallback(const v8::FunctionCallbackInfo&); static void inspectedObject(const v8::FunctionCallbackInfo&, unsigned num); static void inspectedObject0( const v8::FunctionCallbackInfo& info) { inspectedObject(info, 0); } static void inspectedObject1( const v8::FunctionCallbackInfo& info) { inspectedObject(info, 1); } static void inspectedObject2( const v8::FunctionCallbackInfo& info) { inspectedObject(info, 2); } static void inspectedObject3( const v8::FunctionCallbackInfo& info) { inspectedObject(info, 3); } static void inspectedObject4( const v8::FunctionCallbackInfo& info) { inspectedObject(info, 4); } }; } // namespace v8_inspector #endif // V8_INSPECTOR_V8CONSOLE_H_