| 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 struct event; // From libevent | 19 struct event; // From libevent |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 class BoundNetLog; | 23 class BoundNetLog; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 virtual void Disconnect(); | 49 virtual void Disconnect(); |
| 49 virtual bool IsConnected() const; | 50 virtual bool IsConnected() const; |
| 50 virtual bool IsConnectedAndIdle() const; | 51 virtual bool IsConnectedAndIdle() const; |
| 51 virtual int GetPeerAddress(AddressList* address) const; | 52 virtual int GetPeerAddress(AddressList* address) const; |
| 52 virtual int GetLocalAddress(IPEndPoint* address) const; | 53 virtual int GetLocalAddress(IPEndPoint* address) const; |
| 53 virtual const BoundNetLog& NetLog() const; | 54 virtual const BoundNetLog& NetLog() const; |
| 54 virtual void SetSubresourceSpeculation(); | 55 virtual void SetSubresourceSpeculation(); |
| 55 virtual void SetOmniboxSpeculation(); | 56 virtual void SetOmniboxSpeculation(); |
| 56 virtual bool WasEverUsed() const; | 57 virtual bool WasEverUsed() const; |
| 57 virtual bool UsingTCPFastOpen() const; | 58 virtual bool UsingTCPFastOpen() const; |
| 59 virtual int64 NumBytesRead() const; |
| 60 virtual int GetConnectTimeMicros() const; |
| 58 | 61 |
| 59 // Socket methods: | 62 // Socket methods: |
| 60 // Multiple outstanding requests are not supported. | 63 // Multiple outstanding requests are not supported. |
| 61 // Full duplex mode (reading and writing at the same time) is supported | 64 // Full duplex mode (reading and writing at the same time) is supported |
| 62 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 65 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 63 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 66 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 64 virtual bool SetReceiveBufferSize(int32 size); | 67 virtual bool SetReceiveBufferSize(int32 size); |
| 65 virtual bool SetSendBufferSize(int32 size); | 68 virtual bool SetSendBufferSize(int32 size); |
| 66 | 69 |
| 67 private: | 70 private: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // Record of connectivity and transmissions, for use in speculative connection | 193 // Record of connectivity and transmissions, for use in speculative connection |
| 191 // histograms. | 194 // histograms. |
| 192 UseHistory use_history_; | 195 UseHistory use_history_; |
| 193 | 196 |
| 194 // Enables experimental TCP FastOpen option. | 197 // Enables experimental TCP FastOpen option. |
| 195 bool use_tcp_fastopen_; | 198 bool use_tcp_fastopen_; |
| 196 | 199 |
| 197 // True when TCP FastOpen is in use and we have done the connect. | 200 // True when TCP FastOpen is in use and we have done the connect. |
| 198 bool tcp_fastopen_connected_; | 201 bool tcp_fastopen_connected_; |
| 199 | 202 |
| 203 base::TimeTicks connect_start_time_; |
| 204 int64 num_bytes_read_; |
| 205 int connect_time_micros_; |
| 206 |
| 200 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); | 207 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); |
| 201 }; | 208 }; |
| 202 | 209 |
| 203 } // namespace net | 210 } // namespace net |
| 204 | 211 |
| 205 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ | 212 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ |
| OLD | NEW |