Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 46 virtual bool IsConnected() const; | 47 virtual bool IsConnected() const; |
| 47 virtual bool IsConnectedAndIdle() const; | 48 virtual bool IsConnectedAndIdle() const; |
| 48 virtual int GetPeerAddress(AddressList* address) const; | 49 virtual int GetPeerAddress(AddressList* address) const; |
| 49 virtual int GetLocalAddress(IPEndPoint* address) const; | 50 virtual int GetLocalAddress(IPEndPoint* address) const; |
| 50 virtual const BoundNetLog& NetLog() const; | 51 virtual const BoundNetLog& NetLog() const; |
| 51 virtual void SetSubresourceSpeculation(); | 52 virtual void SetSubresourceSpeculation(); |
| 52 virtual void SetOmniboxSpeculation(); | 53 virtual void SetOmniboxSpeculation(); |
| 53 virtual bool WasEverUsed() const; | 54 virtual bool WasEverUsed() const; |
| 54 virtual bool UsingTCPFastOpen() const; | 55 virtual bool UsingTCPFastOpen() const; |
| 55 | 56 |
| 57 virtual int NumBytesRead() const { return num_bytes_read_; } | |
| 58 virtual double GetRTTInMs() const { return rtt_ms_; } | |
| 59 | |
| 56 // Socket methods: | 60 // Socket methods: |
| 57 // Multiple outstanding requests are not supported. | 61 // Multiple outstanding requests are not supported. |
| 58 // 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 |
| 59 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 63 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 60 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 64 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 61 virtual bool SetReceiveBufferSize(int32 size); | 65 virtual bool SetReceiveBufferSize(int32 size); |
| 62 virtual bool SetSendBufferSize(int32 size); | 66 virtual bool SetSendBufferSize(int32 size); |
| 63 | 67 |
| 64 private: | 68 private: |
| 65 // State machine for connecting the socket. | 69 // State machine for connecting the socket. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 // Record of connectivity and transmissions, for use in speculative connection | 190 // Record of connectivity and transmissions, for use in speculative connection |
| 187 // histograms. | 191 // histograms. |
| 188 UseHistory use_history_; | 192 UseHistory use_history_; |
| 189 | 193 |
| 190 // Enables experimental TCP FastOpen option. | 194 // Enables experimental TCP FastOpen option. |
| 191 bool use_tcp_fastopen_; | 195 bool use_tcp_fastopen_; |
| 192 | 196 |
| 193 // True when TCP FastOpen is in use and we have done the connect. | 197 // True when TCP FastOpen is in use and we have done the connect. |
| 194 bool tcp_fastopen_connected_; | 198 bool tcp_fastopen_connected_; |
| 195 | 199 |
| 200 base::Time connect_start_time_; | |
| 201 int num_bytes_read_; | |
|
wtc
2011/06/06 17:24:05
This byte count should be int64 to allow a long-li
Gagan
2011/06/08 16:26:37
Done.
| |
| 202 double rtt_ms_; | |
| 203 | |
| 196 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); | 204 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); |
| 197 }; | 205 }; |
| 198 | 206 |
| 199 } // namespace net | 207 } // namespace net |
| 200 | 208 |
| 201 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ | 209 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ |
| OLD | NEW |