diff options
author | Eugene Ostroukhov <eostroukhov@chromium.org> | 2017-04-18 03:02:19 +0300 |
---|---|---|
committer | Eugene Ostroukhov <eostroukhov@chromium.org> | 2017-04-24 23:54:17 +0300 |
commit | 439b35aade3768a75840f538fa3dc42395fee04b (patch) | |
tree | 9a8d9dd25e9e067dbdebd9591a8c89634ed0c9d1 /src/inspector_agent.h | |
parent | 95ab006e8d5fc4f1c9408a99d2366b229a4e39cd (diff) |
inspector: remove AgentImpl
AgentImpl was introduce so inspector-agent.h does not leak libuv and
inspector implementation details. Inspector had been reworked since and
new classes provide this isolation and AgentImpl became unnecessary
level of indirection. This change removes that class to streamline the
code.
PR-URL: https://github.com/nodejs/node/pull/12576
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/inspector_agent.h')
-rw-r--r-- | src/inspector_agent.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/inspector_agent.h b/src/inspector_agent.h index 141998a064a..483ac52b550 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -1,6 +1,8 @@ #ifndef SRC_INSPECTOR_AGENT_H_ #define SRC_INSPECTOR_AGENT_H_ +#include <memory> + #include <stddef.h> #if !HAVE_INSPECTOR @@ -15,11 +17,13 @@ class Environment; } // namespace node namespace v8 { -class Platform; +template <typename V> +class FunctionCallbackInfo; template<typename T> class Local; -class Value; class Message; +class Platform; +class Value; } // namespace v8 namespace v8_inspector { @@ -29,14 +33,15 @@ class StringView; namespace node { namespace inspector { -class AgentImpl; - class InspectorSessionDelegate { public: virtual bool WaitForFrontendMessage() = 0; virtual void OnMessage(const v8_inspector::StringView& message) = 0; }; +class InspectorIo; +class NodeInspectorClient; + class Agent { public: explicit Agent(node::Environment* env); @@ -44,6 +49,7 @@ class Agent { bool Start(v8::Platform* platform, const char* path, const DebugOptions& options); + bool StartIoThread(); void Stop(); bool IsStarted(); @@ -51,15 +57,25 @@ class Agent { void WaitForDisconnect(); void FatalException(v8::Local<v8::Value> error, v8::Local<v8::Message> message); - void SchedulePauseOnNextStatement(const std::string& reason); void Connect(InspectorSessionDelegate* delegate); void Disconnect(); void Dispatch(const v8_inspector::StringView& message); - InspectorSessionDelegate* delegate(); void RunMessageLoop(); + private: - AgentImpl* impl; - friend class AgentImpl; + static void CallAndPauseOnStart(const v8::FunctionCallbackInfo<v8::Value>&); + static void InspectorConsoleCall( + const v8::FunctionCallbackInfo<v8::Value>& info); + static void InspectorWrapConsoleCall( + const v8::FunctionCallbackInfo<v8::Value>& info); + + node::Environment* parent_env_; + std::unique_ptr<NodeInspectorClient> inspector_; + std::unique_ptr<InspectorIo> io_; + v8::Platform* platform_; + bool inspector_console_; + std::string path_; + DebugOptions debug_options_; }; } // namespace inspector |