Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: net/socket/tcp_client_socket_libevent.h

Issue 6990036: Deciding best connection to schedule requests on based on cwnd and idle time (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Fixing flag name Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
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;
58 59
60 virtual int64 NumBytesRead() const { return num_bytes_read_; }
61 virtual double GetRTTInMs() const { return rtt_ms_; }
62
59 // Socket methods: 63 // Socket methods:
60 // Multiple outstanding requests are not supported. 64 // Multiple outstanding requests are not supported.
61 // Full duplex mode (reading and writing at the same time) is supported 65 // Full duplex mode (reading and writing at the same time) is supported
62 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); 66 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
63 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); 67 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback);
64 virtual bool SetReceiveBufferSize(int32 size); 68 virtual bool SetReceiveBufferSize(int32 size);
65 virtual bool SetSendBufferSize(int32 size); 69 virtual bool SetSendBufferSize(int32 size);
66 70
67 private: 71 private:
68 // State machine for connecting the socket. 72 // State machine for connecting the socket.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Record of connectivity and transmissions, for use in speculative connection 194 // Record of connectivity and transmissions, for use in speculative connection
191 // histograms. 195 // histograms.
192 UseHistory use_history_; 196 UseHistory use_history_;
193 197
194 // Enables experimental TCP FastOpen option. 198 // Enables experimental TCP FastOpen option.
195 bool use_tcp_fastopen_; 199 bool use_tcp_fastopen_;
196 200
197 // True when TCP FastOpen is in use and we have done the connect. 201 // True when TCP FastOpen is in use and we have done the connect.
198 bool tcp_fastopen_connected_; 202 bool tcp_fastopen_connected_;
199 203
204 base::Time connect_start_time_;
205 int64 num_bytes_read_;
206 double rtt_ms_;
207
200 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); 208 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent);
201 }; 209 };
202 210
203 } // namespace net 211 } // namespace net
204 212
205 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ 213 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698