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

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

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, addressed sleevi comments Created 4 years, 9 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 #include <vector> 10 #include <vector>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 net::IPAddressNumber address; 77 net::IPAddressNumber address;
78 if (!net::ParseIPLiteralToNumber(url_.HostNoBrackets(), &address)) { 78 if (!net::ParseIPLiteralToNumber(url_.HostNoBrackets(), &address)) {
79 if (!ResolveHost(url_.HostNoBrackets(), &address)) { 79 if (!ResolveHost(url_.HostNoBrackets(), &address)) {
80 callback.Run(net::ERR_ADDRESS_UNREACHABLE); 80 callback.Run(net::ERR_ADDRESS_UNREACHABLE);
81 return; 81 return;
82 } 82 }
83 } 83 }
84 net::AddressList addresses( 84 net::AddressList addresses(
85 net::IPEndPoint(address, static_cast<uint16_t>(url_.EffectiveIntPort()))); 85 net::IPEndPoint(address, static_cast<uint16_t>(url_.EffectiveIntPort())));
86 net::NetLog::Source source; 86 net::NetLog::Source source;
87 socket_.reset(new net::TCPClientSocket(addresses, NULL, source)); 87 socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source));
88 88
89 state_ = CONNECTING; 89 state_ = CONNECTING;
90 connect_callback_ = callback; 90 connect_callback_ = callback;
91 int code = socket_->Connect(base::Bind( 91 int code = socket_->Connect(base::Bind(
92 &WebSocket::OnSocketConnect, base::Unretained(this))); 92 &WebSocket::OnSocketConnect, base::Unretained(this)));
93 if (code != net::ERR_IO_PENDING) 93 if (code != net::ERR_IO_PENDING)
94 OnSocketConnect(code); 94 OnSocketConnect(code);
95 } 95 }
96 96
97 bool WebSocket::Send(const std::string& message) { 97 bool WebSocket::Send(const std::string& message) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 void WebSocket::Close(int code) { 258 void WebSocket::Close(int code) {
259 socket_->Disconnect(); 259 socket_->Disconnect();
260 if (!connect_callback_.is_null()) 260 if (!connect_callback_.is_null())
261 InvokeConnectCallback(code); 261 InvokeConnectCallback(code);
262 if (state_ == OPEN) 262 if (state_ == OPEN)
263 listener_->OnClose(); 263 listener_->OnClose();
264 264
265 state_ = CLOSED; 265 state_ = CLOSED;
266 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698