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

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

Issue 2414883005: TEMP DO NOT LAND (Closed)
Patch Set: temp Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_STREAM_SOCKET_H_ 5 #ifndef NET_SOCKET_STREAM_SOCKET_H_
6 #define NET_SOCKET_STREAM_SOCKET_H_ 6 #define NET_SOCKET_STREAM_SOCKET_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/socket/connection_attempts.h" 12 #include "net/socket/connection_attempts.h"
13 #include "net/socket/next_proto.h" 13 #include "net/socket/next_proto.h"
14 #include "net/socket/socket.h" 14 #include "net/socket/socket.h"
15 15
16 namespace base {
17 namespace trace_event {
18 class MemoryAllocatorDump;
19 }
20 }
21
16 namespace net { 22 namespace net {
17 23
18 class AddressList; 24 class AddressList;
19 class IPEndPoint; 25 class IPEndPoint;
20 class NetLogWithSource; 26 class NetLogWithSource;
21 class SSLInfo; 27 class SSLInfo;
22 28
23 class NET_EXPORT_PRIVATE StreamSocket : public Socket { 29 class NET_EXPORT_PRIVATE StreamSocket : public Socket {
24 public: 30 public:
25 ~StreamSocket() override {} 31 ~StreamSocket() override {}
(...skipping 25 matching lines...) Expand all
51 57
52 // Called to test if the connection is still alive. Returns false if a 58 // Called to test if the connection is still alive. Returns false if a
53 // connection wasn't established or the connection is dead. 59 // connection wasn't established or the connection is dead.
54 virtual bool IsConnected() const = 0; 60 virtual bool IsConnected() const = 0;
55 61
56 // Called to test if the connection is still alive and idle. Returns false 62 // Called to test if the connection is still alive and idle. Returns false
57 // if a connection wasn't established, the connection is dead, or some data 63 // if a connection wasn't established, the connection is dead, or some data
58 // have been received. 64 // have been received.
59 virtual bool IsConnectedAndIdle() const = 0; 65 virtual bool IsConnectedAndIdle() const = 0;
60 66
67 virtual void OnAddedToPool() {}
68 virtual void OnRemovedFromPool() {}
69
61 // Copies the peer address to |address| and returns a network error code. 70 // Copies the peer address to |address| and returns a network error code.
62 // ERR_SOCKET_NOT_CONNECTED will be returned if the socket is not connected. 71 // ERR_SOCKET_NOT_CONNECTED will be returned if the socket is not connected.
63 virtual int GetPeerAddress(IPEndPoint* address) const = 0; 72 virtual int GetPeerAddress(IPEndPoint* address) const = 0;
64 73
65 // Copies the local address to |address| and returns a network error code. 74 // Copies the local address to |address| and returns a network error code.
66 // ERR_SOCKET_NOT_CONNECTED will be returned if the socket is not bound. 75 // ERR_SOCKET_NOT_CONNECTED will be returned if the socket is not bound.
67 virtual int GetLocalAddress(IPEndPoint* address) const = 0; 76 virtual int GetLocalAddress(IPEndPoint* address) const = 0;
68 77
69 // Gets the NetLog for this socket. 78 // Gets the NetLog for this socket.
70 virtual const NetLogWithSource& NetLog() const = 0; 79 virtual const NetLogWithSource& NetLog() const = 0;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 113
105 // Adds |attempts| to the socket's list of connection attempts. 114 // Adds |attempts| to the socket's list of connection attempts.
106 virtual void AddConnectionAttempts(const ConnectionAttempts& attempts) = 0; 115 virtual void AddConnectionAttempts(const ConnectionAttempts& attempts) = 0;
107 116
108 // Returns the total number of number bytes read by the socket. This only 117 // Returns the total number of number bytes read by the socket. This only
109 // counts the payload bytes. Transport headers are not counted. Returns 118 // counts the payload bytes. Transport headers are not counted. Returns
110 // 0 if the socket does not implement the function. The count is reset when 119 // 0 if the socket does not implement the function. The count is reset when
111 // Disconnect() is called. 120 // Disconnect() is called.
112 virtual int64_t GetTotalReceivedBytes() const = 0; 121 virtual int64_t GetTotalReceivedBytes() const = 0;
113 122
123 virtual void PopulateAllocatorDump(
124 base::trace_event::MemoryAllocatorDump* dump) const;
125
114 protected: 126 protected:
115 // The following class is only used to gather statistics about the history of 127 // The following class is only used to gather statistics about the history of
116 // a socket. It is only instantiated and used in basic sockets, such as 128 // a socket. It is only instantiated and used in basic sockets, such as
117 // TCPClientSocket* instances. Other classes that are derived from 129 // TCPClientSocket* instances. Other classes that are derived from
118 // StreamSocket should forward any potential settings to their underlying 130 // StreamSocket should forward any potential settings to their underlying
119 // transport sockets. 131 // transport sockets.
120 class UseHistory { 132 class UseHistory {
121 public: 133 public:
122 UseHistory(); 134 UseHistory();
123 ~UseHistory(); 135 ~UseHistory();
(...skipping 26 matching lines...) Expand all
150 // identify the motivation. 162 // identify the motivation.
151 bool omnibox_speculation_; 163 bool omnibox_speculation_;
152 bool subresource_speculation_; 164 bool subresource_speculation_;
153 DISALLOW_COPY_AND_ASSIGN(UseHistory); 165 DISALLOW_COPY_AND_ASSIGN(UseHistory);
154 }; 166 };
155 }; 167 };
156 168
157 } // namespace net 169 } // namespace net
158 170
159 #endif // NET_SOCKET_STREAM_SOCKET_H_ 171 #endif // NET_SOCKET_STREAM_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698