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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 104 |
105 // Adds |attempts| to the socket's list of connection attempts. | 105 // Adds |attempts| to the socket's list of connection attempts. |
106 virtual void AddConnectionAttempts(const ConnectionAttempts& attempts) = 0; | 106 virtual void AddConnectionAttempts(const ConnectionAttempts& attempts) = 0; |
107 | 107 |
108 // Returns the total number of number bytes read by the socket. This only | 108 // Returns the total number of number bytes read by the socket. This only |
109 // counts the payload bytes. Transport headers are not counted. Returns | 109 // 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 | 110 // 0 if the socket does not implement the function. The count is reset when |
111 // Disconnect() is called. | 111 // Disconnect() is called. |
112 virtual int64_t GetTotalReceivedBytes() const = 0; | 112 virtual int64_t GetTotalReceivedBytes() const = 0; |
113 | 113 |
114 // Sets whether the socket should treat entering suspend mode as an error, and | |
115 // return ERR_NETWORK_SUSPENDED if it happens. Defaults to false. | |
116 // | |
117 // This is useful because entering suspend mode tends to kill all sockets | |
118 // connected to remote systems. See https://crbug.com/4606). | |
Bence
2016/10/27 13:04:29
Unmatched ')'.
| |
119 // | |
120 // This is a hint only, subclasses are free to ignore this flag (And currently | |
121 // do - it's only respected when set directly on a TcpClientSocket). | |
122 // | |
123 // TODO(mmenke): Should this be done on all TCP sockets? On all non-localhost | |
124 // TCP sockets? | |
125 virtual void SetFailOnSuspend(bool disconnect_on_suspend); | |
126 | |
114 protected: | 127 protected: |
115 // The following class is only used to gather statistics about the history of | 128 // 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 | 129 // a socket. It is only instantiated and used in basic sockets, such as |
117 // TCPClientSocket* instances. Other classes that are derived from | 130 // TCPClientSocket* instances. Other classes that are derived from |
118 // StreamSocket should forward any potential settings to their underlying | 131 // StreamSocket should forward any potential settings to their underlying |
119 // transport sockets. | 132 // transport sockets. |
120 class UseHistory { | 133 class UseHistory { |
121 public: | 134 public: |
122 UseHistory(); | 135 UseHistory(); |
123 ~UseHistory(); | 136 ~UseHistory(); |
(...skipping 26 matching lines...) Expand all Loading... | |
150 // identify the motivation. | 163 // identify the motivation. |
151 bool omnibox_speculation_; | 164 bool omnibox_speculation_; |
152 bool subresource_speculation_; | 165 bool subresource_speculation_; |
153 DISALLOW_COPY_AND_ASSIGN(UseHistory); | 166 DISALLOW_COPY_AND_ASSIGN(UseHistory); |
154 }; | 167 }; |
155 }; | 168 }; |
156 | 169 |
157 } // namespace net | 170 } // namespace net |
158 | 171 |
159 #endif // NET_SOCKET_STREAM_SOCKET_H_ | 172 #endif // NET_SOCKET_STREAM_SOCKET_H_ |
OLD | NEW |