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

Side by Side Diff: extensions/browser/api/socket/tcp_socket.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/socket/tcp_socket.h" 5 #include "extensions/browser/api/socket/tcp_socket.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "extensions/browser/api/api_resource.h" 10 #include "extensions/browser/api/api_resource.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return; 92 return;
93 } 93 }
94 94
95 DCHECK(!server_socket_.get()); 95 DCHECK(!server_socket_.get());
96 socket_mode_ = CLIENT; 96 socket_mode_ = CLIENT;
97 connect_callback_ = callback; 97 connect_callback_ = callback;
98 98
99 int result = net::ERR_CONNECTION_FAILED; 99 int result = net::ERR_CONNECTION_FAILED;
100 if (!is_connected_) { 100 if (!is_connected_) {
101 socket_.reset( 101 socket_.reset(
102 new net::TCPClientSocket(address, NULL, net::NetLog::Source())); 102 new net::TCPClientSocket(address, NULL, NULL, net::NetLog::Source()));
103 result = socket_->Connect( 103 result = socket_->Connect(
104 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); 104 base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this)));
105 } 105 }
106 106
107 if (result != net::ERR_IO_PENDING) 107 if (result != net::ERR_IO_PENDING)
108 OnConnectComplete(result); 108 OnConnectComplete(result);
109 } 109 }
110 110
111 void TCPSocket::Disconnect() { 111 void TCPSocket::Disconnect() {
112 is_connected_ = false; 112 is_connected_ = false;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 bool ResumableTCPSocket::IsPersistent() const { return persistent(); } 355 bool ResumableTCPSocket::IsPersistent() const { return persistent(); }
356 356
357 ResumableTCPServerSocket::ResumableTCPServerSocket( 357 ResumableTCPServerSocket::ResumableTCPServerSocket(
358 const std::string& owner_extension_id) 358 const std::string& owner_extension_id)
359 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {} 359 : TCPSocket(owner_extension_id), persistent_(false), paused_(false) {}
360 360
361 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); } 361 bool ResumableTCPServerSocket::IsPersistent() const { return persistent(); }
362 362
363 } // namespace extensions 363 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698