Chromium Code Reviews| Index: net/socket/tcp_client_socket_win.cc |
| =================================================================== |
| --- net/socket/tcp_client_socket_win.cc (revision 88789) |
| +++ net/socket/tcp_client_socket_win.cc (working copy) |
| @@ -326,7 +326,9 @@ |
| 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), |
| + num_bytes_read_(0), |
| + connect_time_micros_(-1) { |
| scoped_refptr<NetLog::EventParameters> params; |
| if (source.is_valid()) |
| params = new NetLogSourceParameter("source_dependency", source); |
| @@ -487,6 +489,7 @@ |
| core_->write_overlapped_.hEvent = WSACreateEvent(); |
| + connect_start_time_ = base::Time::Now(); |
|
willchan no longer on Chromium
2011/06/13 15:06:07
Use TimeTicks, not Time. Otherwise if the time zon
Gagan
2011/06/13 16:45:58
Done.
|
| if (!connect(socket_, ai->ai_addr, static_cast<int>(ai->ai_addrlen))) { |
| // Connected without waiting! |
| // |
| @@ -525,6 +528,8 @@ |
| net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT_ATTEMPT, params); |
| if (result == OK) { |
| + connect_time_micros_ = (base::Time::Now() - |
| + connect_start_time_).InMicroseconds(); |
| use_history_.set_was_ever_connected(); |
| return OK; // Done! |
| } |
| @@ -691,6 +696,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, |
| @@ -861,6 +867,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, |