summaryrefslogtreecommitdiff
path: root/src/inspector_agent.h
diff options
context:
space:
mode:
authorEugene Ostroukhov <eostroukhov@chromium.org>2016-06-07 15:21:36 -0700
committerAli Ijaz Sheikh <ofrobots@google.com>2016-06-10 08:33:03 -0700
commit624734e640717a826ab1a18845c083a638dc5ce6 (patch)
tree8430eceee510c4853f4a7168d73b1288f20a55dc /src/inspector_agent.h
parent5386b23f641b9bddc3a8dd93f85e43f987011d02 (diff)
downloadandroid-node-v8-624734e640717a826ab1a18845c083a638dc5ce6.tar.gz
android-node-v8-624734e640717a826ab1a18845c083a638dc5ce6.tar.bz2
android-node-v8-624734e640717a826ab1a18845c083a638dc5ce6.zip
inspector: reduce implementation in header
This is needed to reduce the coupling between node files that use node::Environment and inspector class. Fixes: https://github.com/nodejs/node/issues/7080 PR-URL: https://github.com/nodejs/node/pull/7228 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/inspector_agent.h')
-rw-r--r--src/inspector_agent.h71
1 files changed, 8 insertions, 63 deletions
diff --git a/src/inspector_agent.h b/src/inspector_agent.h
index 65a4abeff7..863f1c30c3 100644
--- a/src/inspector_agent.h
+++ b/src/inspector_agent.h
@@ -5,27 +5,19 @@
#error("This header can only be used when inspector is enabled")
#endif
-#include "inspector_socket.h"
-#include "uv.h"
-#include "v8.h"
-#include "util.h"
-
-#include <string>
-#include <vector>
-
-namespace blink {
-class V8Inspector;
-}
-
// Forward declaration to break recursive dependency chain with src/env.h.
namespace node {
class Environment;
} // namespace node
+namespace v8 {
+class Platform;
+} // namespace v8
+
namespace node {
namespace inspector {
-class ChannelImpl;
+class AgentImpl;
class Agent {
public:
@@ -38,57 +30,10 @@ class Agent {
void Stop();
bool IsStarted();
- bool connected() { return connected_; }
+ bool IsConnected();
void WaitForDisconnect();
-
- protected:
- static void ThreadCbIO(void* agent);
- static void OnSocketConnectionIO(uv_stream_t* server, int status);
- static bool OnInspectorHandshakeIO(inspector_socket_t* socket,
- enum inspector_handshake_event state,
- const char* path);
- static void OnRemoteDataIO(uv_stream_t* stream, ssize_t read,
- const uv_buf_t* b);
- static void WriteCbIO(uv_async_t* async);
-
- void WorkerRunIO();
- void OnInspectorConnectionIO(inspector_socket_t* socket);
- void PushPendingMessage(std::vector<std::string>* queue,
- const std::string& message);
- void SwapBehindLock(std::vector<std::string> Agent::*queue,
- std::vector<std::string>* output);
- void PostMessages();
- void SetConnected(bool connected);
- void Write(const std::string& message);
-
- uv_sem_t start_sem_;
- uv_cond_t pause_cond_;
- uv_mutex_t queue_lock_;
- uv_mutex_t pause_lock_;
- uv_thread_t thread_;
- uv_loop_t child_loop_;
- uv_tcp_t server_;
-
- int port_;
- bool wait_;
- bool connected_;
- bool shutting_down_;
- node::Environment* parent_env_;
-
- uv_async_t data_written_;
- uv_async_t io_thread_req_;
- inspector_socket_t* client_socket_;
- blink::V8Inspector* inspector_;
- v8::Platform* platform_;
- std::vector<std::string> message_queue_;
- std::vector<std::string> outgoing_message_queue_;
- bool dispatching_messages_;
-
- friend class ChannelImpl;
- friend class DispatchOnInspectorBackendTask;
- friend class SetConnectedTask;
- friend class V8NodeInspector;
- friend void InterruptCallback(v8::Isolate*, void* agent);
+ private:
+ AgentImpl* impl;
};
} // namespace inspector