Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: chrome/test/chromedriver/net/websocket.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/test/chromedriver/net/websocket.h" 5 #include "chrome/test/chromedriver/net/websocket.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "net/base/address_list.h" 24 #include "net/base/address_list.h"
25 #include "net/base/io_buffer.h" 25 #include "net/base/io_buffer.h"
26 #include "net/base/ip_address.h" 26 #include "net/base/ip_address.h"
27 #include "net/base/ip_endpoint.h" 27 #include "net/base/ip_endpoint.h"
28 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
29 #include "net/base/sys_addrinfo.h" 29 #include "net/base/sys_addrinfo.h"
30 #include "net/http/http_response_headers.h" 30 #include "net/http/http_response_headers.h"
31 #include "net/http/http_util.h" 31 #include "net/http/http_util.h"
32 #include "net/log/net_log_source.h"
32 #include "net/websockets/websocket_frame.h" 33 #include "net/websockets/websocket_frame.h"
33 34
34 #if defined(OS_WIN) 35 #if defined(OS_WIN)
35 #include <Winsock2.h> 36 #include <Winsock2.h>
36 #endif 37 #endif
37 38
38 namespace { 39 namespace {
39 40
40 bool ResolveHost(const std::string& host, 41 bool ResolveHost(const std::string& host,
41 uint16_t port, 42 uint16_t port,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return; 84 return;
84 } 85 }
85 base::ListValue endpoints; 86 base::ListValue endpoints;
86 for (auto endpoint : addresses) 87 for (auto endpoint : addresses)
87 endpoints.AppendString(endpoint.ToStringWithoutPort()); 88 endpoints.AppendString(endpoint.ToStringWithoutPort());
88 std::string json; 89 std::string json;
89 CHECK(base::JSONWriter::Write(endpoints, &json)); 90 CHECK(base::JSONWriter::Write(endpoints, &json));
90 VLOG(0) << "resolved " << url_.HostNoBrackets() << " to " << json; 91 VLOG(0) << "resolved " << url_.HostNoBrackets() << " to " << json;
91 } 92 }
92 93
93 net::NetLog::Source source; 94 net::NetLogSource source;
94 socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source)); 95 socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source));
95 96
96 state_ = CONNECTING; 97 state_ = CONNECTING;
97 connect_callback_ = callback; 98 connect_callback_ = callback;
98 int code = socket_->Connect(base::Bind( 99 int code = socket_->Connect(base::Bind(
99 &WebSocket::OnSocketConnect, base::Unretained(this))); 100 &WebSocket::OnSocketConnect, base::Unretained(this)));
100 if (code != net::ERR_IO_PENDING) 101 if (code != net::ERR_IO_PENDING)
101 OnSocketConnect(code); 102 OnSocketConnect(code);
102 } 103 }
103 104
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 267
267 void WebSocket::Close(int code) { 268 void WebSocket::Close(int code) {
268 socket_->Disconnect(); 269 socket_->Disconnect();
269 if (!connect_callback_.is_null()) 270 if (!connect_callback_.is_null())
270 InvokeConnectCallback(code); 271 InvokeConnectCallback(code);
271 if (state_ == OPEN) 272 if (state_ == OPEN)
272 listener_->OnClose(); 273 listener_->OnClose();
273 274
274 state_ = CLOSED; 275 state_ = CLOSED;
275 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698