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

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: Added throttle on TCP socket notifications (with tests) Created 4 years, 8 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 net::AddressList addresses; 73 net::AddressList addresses;
74 uint16_t port = static_cast<uint16_t>(url_.EffectiveIntPort()); 74 uint16_t port = static_cast<uint16_t>(url_.EffectiveIntPort());
75 if (ParseURLHostnameToAddress(url_.host(), &address)) { 75 if (ParseURLHostnameToAddress(url_.host(), &address)) {
76 addresses = net::AddressList::CreateFromIPAddress(address, port); 76 addresses = net::AddressList::CreateFromIPAddress(address, port);
77 } else if (!ResolveHost(url_.HostNoBrackets(), port, &addresses)) { 77 } else if (!ResolveHost(url_.HostNoBrackets(), port, &addresses)) {
78 callback.Run(net::ERR_ADDRESS_UNREACHABLE); 78 callback.Run(net::ERR_ADDRESS_UNREACHABLE);
79 return; 79 return;
80 } 80 }
81 81
82 net::NetLog::Source source; 82 net::NetLog::Source source;
83 socket_.reset(new net::TCPClientSocket(addresses, NULL, source)); 83 socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source));
84 84
85 state_ = CONNECTING; 85 state_ = CONNECTING;
86 connect_callback_ = callback; 86 connect_callback_ = callback;
87 int code = socket_->Connect(base::Bind( 87 int code = socket_->Connect(base::Bind(
88 &WebSocket::OnSocketConnect, base::Unretained(this))); 88 &WebSocket::OnSocketConnect, base::Unretained(this)));
89 if (code != net::ERR_IO_PENDING) 89 if (code != net::ERR_IO_PENDING)
90 OnSocketConnect(code); 90 OnSocketConnect(code);
91 } 91 }
92 92
93 bool WebSocket::Send(const std::string& message) { 93 bool WebSocket::Send(const std::string& message) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 void WebSocket::Close(int code) { 254 void WebSocket::Close(int code) {
255 socket_->Disconnect(); 255 socket_->Disconnect();
256 if (!connect_callback_.is_null()) 256 if (!connect_callback_.is_null())
257 InvokeConnectCallback(code); 257 InvokeConnectCallback(code);
258 if (state_ == OPEN) 258 if (state_ == OPEN)
259 listener_->OnClose(); 259 listener_->OnClose();
260 260
261 state_ = CLOSED; 261 state_ = CLOSED;
262 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698