OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <winsock2.h> | 9 #include <winsock2.h> |
10 | 10 |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/time.h" |
12 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
13 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
14 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
15 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
16 #include "net/socket/stream_socket.h" | 17 #include "net/socket/stream_socket.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 class BoundNetLog; | 21 class BoundNetLog; |
21 | 22 |
(...skipping 25 matching lines...) Expand all Loading... |
47 virtual bool IsConnected() const; | 48 virtual bool IsConnected() const; |
48 virtual bool IsConnectedAndIdle() const; | 49 virtual bool IsConnectedAndIdle() const; |
49 virtual int GetPeerAddress(AddressList* address) const; | 50 virtual int GetPeerAddress(AddressList* address) const; |
50 virtual int GetLocalAddress(IPEndPoint* address) const; | 51 virtual int GetLocalAddress(IPEndPoint* address) const; |
51 virtual const BoundNetLog& NetLog() const { return net_log_; } | 52 virtual const BoundNetLog& NetLog() const { return net_log_; } |
52 virtual void SetSubresourceSpeculation(); | 53 virtual void SetSubresourceSpeculation(); |
53 virtual void SetOmniboxSpeculation(); | 54 virtual void SetOmniboxSpeculation(); |
54 virtual bool WasEverUsed() const; | 55 virtual bool WasEverUsed() const; |
55 virtual bool UsingTCPFastOpen() const; | 56 virtual bool UsingTCPFastOpen() const; |
56 | 57 |
| 58 virtual int64 NumBytesRead() const { return num_bytes_read_; } |
| 59 virtual int GetConnectTimeMicros() const { return connect_time_micros_; } |
| 60 |
57 // Socket methods: | 61 // Socket methods: |
58 // Multiple outstanding requests are not supported. | 62 // Multiple outstanding requests are not supported. |
59 // Full duplex mode (reading and writing at the same time) is supported | 63 // Full duplex mode (reading and writing at the same time) is supported |
60 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 64 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
61 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 65 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
62 | 66 |
63 virtual bool SetReceiveBufferSize(int32 size); | 67 virtual bool SetReceiveBufferSize(int32 size); |
64 virtual bool SetSendBufferSize(int32 size); | 68 virtual bool SetSendBufferSize(int32 size); |
65 | 69 |
66 private: | 70 private: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 138 |
135 BoundNetLog net_log_; | 139 BoundNetLog net_log_; |
136 | 140 |
137 // This socket was previously disconnected and has not been re-connected. | 141 // This socket was previously disconnected and has not been re-connected. |
138 bool previously_disconnected_; | 142 bool previously_disconnected_; |
139 | 143 |
140 // Record of connectivity and transmissions, for use in speculative connection | 144 // Record of connectivity and transmissions, for use in speculative connection |
141 // histograms. | 145 // histograms. |
142 UseHistory use_history_; | 146 UseHistory use_history_; |
143 | 147 |
| 148 base::TimeTicks connect_start_time_; |
| 149 int64 num_bytes_read_; |
| 150 int connect_time_micros_; |
| 151 |
144 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); | 152 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); |
145 }; | 153 }; |
146 | 154 |
147 } // namespace net | 155 } // namespace net |
148 | 156 |
149 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ | 157 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ |
OLD | NEW |