32
32
#endif
33
33
34
34
namespace node {
35
+ namespace inspector {
35
36
namespace {
36
37
37
38
const char TAG_CONNECT[] = " #connect" ;
@@ -51,7 +52,7 @@ void PrintDebuggerReadyMessage(int port) {
51
52
fflush (stderr);
52
53
}
53
54
54
- bool AcceptsConnection (inspector_socket_t * socket, const std::string& path) {
55
+ bool AcceptsConnection (InspectorSocket * socket, const std::string& path) {
55
56
return StringEqualNoCaseN (path.c_str (), DEVTOOLS_PATH,
56
57
sizeof (DEVTOOLS_PATH) - 1 );
57
58
}
@@ -62,11 +63,11 @@ void Escape(std::string* string) {
62
63
}
63
64
}
64
65
65
- void DisposeInspector (inspector_socket_t * socket, int status) {
66
+ void DisposeInspector (InspectorSocket * socket, int status) {
66
67
delete socket;
67
68
}
68
69
69
- void DisconnectAndDisposeIO (inspector_socket_t * socket) {
70
+ void DisconnectAndDisposeIO (InspectorSocket * socket) {
70
71
if (socket) {
71
72
inspector_close (socket, DisposeInspector);
72
73
}
@@ -77,7 +78,7 @@ void OnBufferAlloc(uv_handle_t* handle, size_t len, uv_buf_t* buf) {
77
78
buf->len = len;
78
79
}
79
80
80
- void SendHttpResponse (inspector_socket_t * socket, const char * response,
81
+ void SendHttpResponse (InspectorSocket * socket, const char * response,
81
82
size_t len) {
82
83
const char HEADERS[] = " HTTP/1.0 200 OK\r\n "
83
84
" Content-Type: application/json; charset=UTF-8\r\n "
@@ -90,7 +91,7 @@ void SendHttpResponse(inspector_socket_t* socket, const char* response,
90
91
inspector_write (socket, response, len);
91
92
}
92
93
93
- void SendVersionResponse (inspector_socket_t * socket) {
94
+ void SendVersionResponse (InspectorSocket * socket) {
94
95
const char VERSION_RESPONSE_TEMPLATE[] =
95
96
" [ {"
96
97
" \" Browser\" : \" node.js/%s\" ,"
@@ -117,7 +118,7 @@ std::string GetProcessTitle() {
117
118
}
118
119
}
119
120
120
- void SendTargentsListResponse (inspector_socket_t * socket,
121
+ void SendTargentsListResponse (InspectorSocket * socket,
121
122
const std::string& script_name_,
122
123
const std::string& script_path_,
123
124
int port) {
@@ -169,7 +170,7 @@ const char* match_path_segment(const char* path, const char* expected) {
169
170
return nullptr ;
170
171
}
171
172
172
- bool RespondToGet (inspector_socket_t * socket, const std::string& script_name_,
173
+ bool RespondToGet (InspectorSocket * socket, const std::string& script_name_,
173
174
const std::string& script_path_, const std::string& path,
174
175
int port) {
175
176
const char * command = match_path_segment (path.c_str (), " /json" );
@@ -192,8 +193,6 @@ bool RespondToGet(inspector_socket_t* socket, const std::string& script_name_,
192
193
193
194
} // namespace
194
195
195
- namespace inspector {
196
-
197
196
198
197
class V8NodeInspector ;
199
198
@@ -220,16 +219,16 @@ class AgentImpl {
220
219
221
220
static void ThreadCbIO (void * agent);
222
221
static void OnSocketConnectionIO (uv_stream_t * server, int status);
223
- static bool OnInspectorHandshakeIO (inspector_socket_t * socket,
222
+ static bool OnInspectorHandshakeIO (InspectorSocket * socket,
224
223
enum inspector_handshake_event state,
225
224
const std::string& path);
226
225
static void WriteCbIO (uv_async_t * async);
227
226
228
227
void InstallInspectorOnProcess ();
229
228
230
229
void WorkerRunIO ();
231
- void OnInspectorConnectionIO (inspector_socket_t * socket);
232
- void OnRemoteDataIO (inspector_socket_t * stream, ssize_t read,
230
+ void OnInspectorConnectionIO (InspectorSocket * socket);
231
+ void OnRemoteDataIO (InspectorSocket * stream, ssize_t read,
233
232
const uv_buf_t * b);
234
233
void SetConnected (bool connected);
235
234
void DispatchMessages ();
@@ -255,7 +254,7 @@ class AgentImpl {
255
254
256
255
uv_async_t * data_written_;
257
256
uv_async_t io_thread_req_;
258
- inspector_socket_t * client_socket_;
257
+ InspectorSocket * client_socket_;
259
258
V8NodeInspector* inspector_;
260
259
v8::Platform* platform_;
261
260
MessageQueue incoming_message_queue_;
@@ -281,7 +280,7 @@ void InterruptCallback(v8::Isolate*, void* agent) {
281
280
}
282
281
283
282
void DataCallback (uv_stream_t * stream, ssize_t read, const uv_buf_t * buf) {
284
- inspector_socket_t * socket = inspector_from_stream (stream);
283
+ InspectorSocket * socket = inspector_from_stream (stream);
285
284
static_cast <AgentImpl*>(socket->data )->OnRemoteDataIO (socket, read , buf);
286
285
}
287
286
@@ -594,7 +593,7 @@ void AgentImpl::ThreadCbIO(void* agent) {
594
593
// static
595
594
void AgentImpl::OnSocketConnectionIO (uv_stream_t * server, int status) {
596
595
if (status == 0 ) {
597
- inspector_socket_t * socket = new inspector_socket_t ();
596
+ InspectorSocket * socket = new InspectorSocket ();
598
597
socket->data = server->data ;
599
598
if (inspector_accept (server, socket,
600
599
AgentImpl::OnInspectorHandshakeIO) != 0 ) {
@@ -604,7 +603,7 @@ void AgentImpl::OnSocketConnectionIO(uv_stream_t* server, int status) {
604
603
}
605
604
606
605
// static
607
- bool AgentImpl::OnInspectorHandshakeIO (inspector_socket_t * socket,
606
+ bool AgentImpl::OnInspectorHandshakeIO (InspectorSocket * socket,
608
607
enum inspector_handshake_event state,
609
608
const std::string& path) {
610
609
AgentImpl* agent = static_cast <AgentImpl*>(socket->data );
@@ -626,7 +625,7 @@ bool AgentImpl::OnInspectorHandshakeIO(inspector_socket_t* socket,
626
625
}
627
626
}
628
627
629
- void AgentImpl::OnRemoteDataIO (inspector_socket_t * socket,
628
+ void AgentImpl::OnRemoteDataIO (InspectorSocket * socket,
630
629
ssize_t read,
631
630
const uv_buf_t * buf) {
632
631
Mutex::ScopedLock scoped_lock (pause_lock_);
@@ -660,7 +659,7 @@ void AgentImpl::OnRemoteDataIO(inspector_socket_t* socket,
660
659
// static
661
660
void AgentImpl::WriteCbIO (uv_async_t * async) {
662
661
AgentImpl* agent = static_cast <AgentImpl*>(async->data );
663
- inspector_socket_t * socket = agent->client_socket_ ;
662
+ InspectorSocket * socket = agent->client_socket_ ;
664
663
if (socket) {
665
664
MessageQueue outgoing_messages;
666
665
agent->SwapBehindLock (&agent->outgoing_message_queue_ , &outgoing_messages);
@@ -741,7 +740,7 @@ void AgentImpl::PostIncomingMessage(const String16& message) {
741
740
}
742
741
}
743
742
744
- void AgentImpl::OnInspectorConnectionIO (inspector_socket_t * socket) {
743
+ void AgentImpl::OnInspectorConnectionIO (InspectorSocket * socket) {
745
744
if (client_socket_) {
746
745
DisconnectAndDisposeIO (socket);
747
746
return ;
0 commit comments