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

Unified Diff: net/socket/tcp_client_socket_win.cc

Issue 7251004: Deciding best connection to schedule requests on based on cwnd and idle time (Reopened after revert) (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fixing uninitialized memory because of class variables not initialized Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/tcp_client_socket_win.h ('k') | net/socket/transport_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_win.cc
===================================================================
--- net/socket/tcp_client_socket_win.cc (revision 90401)
+++ net/socket/tcp_client_socket_win.cc (working copy)
@@ -323,7 +323,10 @@
next_connect_state_(CONNECT_STATE_NONE),
connect_os_error_(0),
net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
- previously_disconnected_(false) {
+ previously_disconnected_(false),
+ connect_start_time_(),
Sergey Ulanov 2011/06/24 20:10:17 nit: You don't need this, compiler invokes default
gagansingh 2011/06/24 20:14:43 There was a valgrind error, because one of the cla
+ connect_time_micros_(),
+ num_bytes_read_(0) {
scoped_refptr<NetLog::EventParameters> params;
if (source.is_valid())
params = new NetLogSourceParameter("source_dependency", source);
@@ -484,6 +487,7 @@
core_->write_overlapped_.hEvent = WSACreateEvent();
+ connect_start_time_ = base::TimeTicks::Now();
if (!connect(socket_, ai->ai_addr, static_cast<int>(ai->ai_addrlen))) {
// Connected without waiting!
//
@@ -522,6 +526,7 @@
net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT_ATTEMPT, params);
if (result == OK) {
+ connect_time_micros_ = base::TimeTicks::Now() - connect_start_time_;
use_history_.set_was_ever_connected();
return OK; // Done!
}
@@ -658,6 +663,14 @@
return false;
}
+int64 TCPClientSocketWin::NumBytesRead() const {
+ return num_bytes_read_;
+}
+
+base::TimeDelta TCPClientSocketWin::GetConnectTimeMicros() const {
+ return connect_time_micros_;
+}
+
int TCPClientSocketWin::Read(IOBuffer* buf,
int buf_len,
CompletionCallback* callback) {
@@ -688,6 +701,7 @@
base::MemoryDebug::MarkAsInitialized(core_->read_buffer_.buf, num);
base::StatsCounter read_bytes("tcp.read_bytes");
read_bytes.Add(num);
+ num_bytes_read_ += num;
if (num > 0)
use_history_.set_was_used_to_convey_data();
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, num,
@@ -858,6 +872,7 @@
if (ok) {
base::StatsCounter read_bytes("tcp.read_bytes");
read_bytes.Add(num_bytes);
+ num_bytes_read_ += num_bytes;
if (num_bytes > 0)
use_history_.set_was_used_to_convey_data();
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
« no previous file with comments | « net/socket/tcp_client_socket_win.h ('k') | net/socket/transport_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698