OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/devtools_service/devtools_http_server.h" | 5 #include "components/devtools_service/devtools_http_server.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 if (ShouldSelfDestruct()) | 245 if (ShouldSelfDestruct()) |
246 delete this; | 246 delete this; |
247 } | 247 } |
248 | 248 |
249 void OnFinishedWritingSendStream(uint32_t num_bytes, const char* buffer) { | 249 void OnFinishedWritingSendStream(uint32_t num_bytes, const char* buffer) { |
250 DCHECK_GT(pending_send_count_, 0u); | 250 DCHECK_GT(pending_send_count_, 0u); |
251 pending_send_count_--; | 251 pending_send_count_--; |
252 | 252 |
253 if (web_socket_ && buffer) | 253 if (web_socket_ && buffer) |
254 web_socket_->Send(true, mojo::WebSocket::MESSAGE_TYPE_TEXT, num_bytes); | 254 web_socket_->Send(true, mojo::WebSocket::MessageType::TEXT, num_bytes); |
255 | 255 |
256 if (ShouldSelfDestruct()) | 256 if (ShouldSelfDestruct()) |
257 delete this; | 257 delete this; |
258 } | 258 } |
259 | 259 |
260 void OnFinishedReadingReceiveStream(uint32_t num_bytes, const char* data) { | 260 void OnFinishedReadingReceiveStream(uint32_t num_bytes, const char* data) { |
261 DCHECK_GT(pending_receive_count_, 0u); | 261 DCHECK_GT(pending_receive_count_, 0u); |
262 pending_receive_count_--; | 262 pending_receive_count_--; |
263 | 263 |
264 if (agent_host_ && data) | 264 if (agent_host_ && data) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 DevToolsHttpServer::DevToolsHttpServer(DevToolsService* service, | 334 DevToolsHttpServer::DevToolsHttpServer(DevToolsService* service, |
335 uint16_t remote_debugging_port) | 335 uint16_t remote_debugging_port) |
336 : service_(service), remote_debugging_port_(remote_debugging_port) { | 336 : service_(service), remote_debugging_port_(remote_debugging_port) { |
337 VLOG(1) << "Remote debugging HTTP server is started on port " | 337 VLOG(1) << "Remote debugging HTTP server is started on port " |
338 << remote_debugging_port << "."; | 338 << remote_debugging_port << "."; |
339 mojo::NetworkServicePtr network_service; | 339 mojo::NetworkServicePtr network_service; |
340 service_->application()->ConnectToService("mojo:network_service", | 340 service_->application()->ConnectToService("mojo:network_service", |
341 &network_service); | 341 &network_service); |
342 | 342 |
343 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); | 343 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); |
344 local_address->family = mojo::NET_ADDRESS_FAMILY_IPV4; | 344 local_address->family = mojo::NetAddressFamily::IPV4; |
345 local_address->ipv4 = mojo::NetAddressIPv4::New(); | 345 local_address->ipv4 = mojo::NetAddressIPv4::New(); |
346 local_address->ipv4->port = remote_debugging_port; | 346 local_address->ipv4->port = remote_debugging_port; |
347 local_address->ipv4->addr.resize(4); | 347 local_address->ipv4->addr.resize(4); |
348 local_address->ipv4->addr[0] = 127; | 348 local_address->ipv4->addr[0] = 127; |
349 local_address->ipv4->addr[1] = 0; | 349 local_address->ipv4->addr[1] = 0; |
350 local_address->ipv4->addr[2] = 0; | 350 local_address->ipv4->addr[2] = 0; |
351 local_address->ipv4->addr[3] = 1; | 351 local_address->ipv4->addr[3] = 1; |
352 | 352 |
353 mojo::HttpServerDelegatePtr http_server_delegate; | 353 mojo::HttpServerDelegatePtr http_server_delegate; |
354 http_server_delegate_binding_.reset( | 354 http_server_delegate_binding_.reset( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 iter.value()->id().c_str())); | 494 iter.value()->id().c_str())); |
495 list_value.Append(std::move(dict_value)); | 495 list_value.Append(std::move(dict_value)); |
496 } | 496 } |
497 return MakeJsonResponse(200, &list_value, std::string()); | 497 return MakeJsonResponse(200, &list_value, std::string()); |
498 } | 498 } |
499 | 499 |
500 return MakeJsonResponse(404, nullptr, "Unknown command: " + command); | 500 return MakeJsonResponse(404, nullptr, "Unknown command: " + command); |
501 } | 501 } |
502 | 502 |
503 } // namespace devtools_service | 503 } // namespace devtools_service |
OLD | NEW |