OLD | NEW |
---|---|
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 "net/log/net_log.h" | 8 #include "net/log/net_log.h" |
9 #include "net/socket/connection_attempts.h" | |
9 #include "net/socket/next_proto.h" | 10 #include "net/socket/next_proto.h" |
10 #include "net/socket/socket.h" | 11 #include "net/socket/socket.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 class AddressList; | 15 class AddressList; |
15 class IPEndPoint; | 16 class IPEndPoint; |
16 class SSLInfo; | 17 class SSLInfo; |
17 | 18 |
18 class NET_EXPORT_PRIVATE StreamSocket : public Socket { | 19 class NET_EXPORT_PRIVATE StreamSocket : public Socket { |
19 public: | 20 public: |
20 ~StreamSocket() override {} | 21 ~StreamSocket() override; |
21 | 22 |
22 // Called to establish a connection. Returns OK if the connection could be | 23 // Called to establish a connection. Returns OK if the connection could be |
23 // established synchronously. Otherwise, ERR_IO_PENDING is returned and the | 24 // established synchronously. Otherwise, ERR_IO_PENDING is returned and the |
24 // given callback will run asynchronously when the connection is established | 25 // given callback will run asynchronously when the connection is established |
25 // or when an error occurs. The result is some other error code if the | 26 // or when an error occurs. The result is some other error code if the |
26 // connection could not be established. | 27 // connection could not be established. |
27 // | 28 // |
28 // The socket's Read and Write methods may not be called until Connect | 29 // The socket's Read and Write methods may not be called until Connect |
29 // succeeds. | 30 // succeeds. |
30 // | 31 // |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 virtual bool WasNpnNegotiated() const = 0; | 89 virtual bool WasNpnNegotiated() const = 0; |
89 | 90 |
90 // Returns the protocol negotiated via NPN for this socket, or | 91 // Returns the protocol negotiated via NPN for this socket, or |
91 // kProtoUnknown will be returned if NPN is not applicable. | 92 // kProtoUnknown will be returned if NPN is not applicable. |
92 virtual NextProto GetNegotiatedProtocol() const = 0; | 93 virtual NextProto GetNegotiatedProtocol() const = 0; |
93 | 94 |
94 // Gets the SSL connection information of the socket. Returns false if | 95 // Gets the SSL connection information of the socket. Returns false if |
95 // SSL was not used by this socket. | 96 // SSL was not used by this socket. |
96 virtual bool GetSSLInfo(SSLInfo* ssl_info) = 0; | 97 virtual bool GetSSLInfo(SSLInfo* ssl_info) = 0; |
97 | 98 |
99 // Overwrites |out| with the connection attempts made in the process of | |
100 // connecting this socket. | |
101 virtual void GetConnectionAttempts(ConnectionAttempts* out) const = 0; | |
102 | |
103 // Clears the connection attempts. (Called when the socket is being reused | |
104 // so the second and later owners don't see the attempts made to obtain it | |
105 // for the first owner.) | |
Randy Smith (Not in Mondays)
2015/05/14 19:42:05
I'd remove the parenthesis; it's about the consume
Deprecated (see juliatuttle)
2015/05/14 20:02:35
Done.
| |
106 virtual void ClearConnectionAttempts() = 0; | |
107 | |
108 // Adds |attempts| to the connection attempts. (Called when the socket is | |
109 // being returned from the connect job to include connection attempts made on | |
110 // the fallback [or main, if this was the fallback] socket.) | |
Randy Smith (Not in Mondays)
2015/05/14 19:42:05
Same comment about parenthetical, and similar but
Deprecated (see juliatuttle)
2015/05/14 20:02:35
Done.
| |
111 virtual void AddConnectionAttempts(const ConnectionAttempts& attempts) = 0; | |
112 | |
98 protected: | 113 protected: |
99 // The following class is only used to gather statistics about the history of | 114 // The following class is only used to gather statistics about the history of |
100 // a socket. It is only instantiated and used in basic sockets, such as | 115 // a socket. It is only instantiated and used in basic sockets, such as |
101 // TCPClientSocket* instances. Other classes that are derived from | 116 // TCPClientSocket* instances. Other classes that are derived from |
102 // StreamSocket should forward any potential settings to their underlying | 117 // StreamSocket should forward any potential settings to their underlying |
103 // transport sockets. | 118 // transport sockets. |
104 class UseHistory { | 119 class UseHistory { |
105 public: | 120 public: |
106 UseHistory(); | 121 UseHistory(); |
107 ~UseHistory(); | 122 ~UseHistory(); |
(...skipping 26 matching lines...) Expand all Loading... | |
134 // identify the motivation. | 149 // identify the motivation. |
135 bool omnibox_speculation_; | 150 bool omnibox_speculation_; |
136 bool subresource_speculation_; | 151 bool subresource_speculation_; |
137 DISALLOW_COPY_AND_ASSIGN(UseHistory); | 152 DISALLOW_COPY_AND_ASSIGN(UseHistory); |
138 }; | 153 }; |
139 }; | 154 }; |
140 | 155 |
141 } // namespace net | 156 } // namespace net |
142 | 157 |
143 #endif // NET_SOCKET_STREAM_SOCKET_H_ | 158 #endif // NET_SOCKET_STREAM_SOCKET_H_ |
OLD | NEW |