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_LIBEVENT_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ |
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "base/time.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 |
22 // A client socket that uses TCP as the transport layer. | 23 // A client socket that uses TCP as the transport layer. |
(...skipping 23 matching lines...) Expand all Loading... |
46 virtual void Disconnect(); | 47 virtual void Disconnect(); |
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; | 52 virtual const BoundNetLog& NetLog() const; |
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; |
| 57 virtual int64 NumBytesRead() const; |
| 58 virtual int GetConnectTimeMicros() const; |
56 | 59 |
57 // Socket methods: | 60 // Socket methods: |
58 // Multiple outstanding requests are not supported. | 61 // Multiple outstanding requests are not supported. |
59 // Full duplex mode (reading and writing at the same time) is supported | 62 // Full duplex mode (reading and writing at the same time) is supported |
60 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 63 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
61 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 64 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
62 virtual bool SetReceiveBufferSize(int32 size); | 65 virtual bool SetReceiveBufferSize(int32 size); |
63 virtual bool SetSendBufferSize(int32 size); | 66 virtual bool SetSendBufferSize(int32 size); |
64 | 67 |
65 private: | 68 private: |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Record of connectivity and transmissions, for use in speculative connection | 191 // Record of connectivity and transmissions, for use in speculative connection |
189 // histograms. | 192 // histograms. |
190 UseHistory use_history_; | 193 UseHistory use_history_; |
191 | 194 |
192 // Enables experimental TCP FastOpen option. | 195 // Enables experimental TCP FastOpen option. |
193 bool use_tcp_fastopen_; | 196 bool use_tcp_fastopen_; |
194 | 197 |
195 // True when TCP FastOpen is in use and we have done the connect. | 198 // True when TCP FastOpen is in use and we have done the connect. |
196 bool tcp_fastopen_connected_; | 199 bool tcp_fastopen_connected_; |
197 | 200 |
| 201 base::TimeTicks connect_start_time_; |
| 202 int64 num_bytes_read_; |
| 203 int connect_time_micros_; |
| 204 |
198 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); | 205 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); |
199 }; | 206 }; |
200 | 207 |
201 } // namespace net | 208 } // namespace net |
202 | 209 |
203 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ | 210 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ |
OLD | NEW |