| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // counts the payload bytes. Transport headers are not counted. Returns | 127 // counts the payload bytes. Transport headers are not counted. Returns |
| 128 // 0 if the socket does not implement the function. The count is reset when | 128 // 0 if the socket does not implement the function. The count is reset when |
| 129 // Disconnect() is called. | 129 // Disconnect() is called. |
| 130 virtual int64_t GetTotalReceivedBytes() const = 0; | 130 virtual int64_t GetTotalReceivedBytes() const = 0; |
| 131 | 131 |
| 132 // Dumps memory allocation stats into |stats|. |stats| can be assumed as being | 132 // Dumps memory allocation stats into |stats|. |stats| can be assumed as being |
| 133 // default initialized upon entry. Implementations should override fields in | 133 // default initialized upon entry. Implementations should override fields in |
| 134 // |stats|. Default implementation does nothing. | 134 // |stats|. Default implementation does nothing. |
| 135 virtual void DumpMemoryStats(SocketMemoryStats* stats) const {} | 135 virtual void DumpMemoryStats(SocketMemoryStats* stats) const {} |
| 136 | 136 |
| 137 // Sets whether the socket should treat entering suspend mode as an error, and |
| 138 // return ERR_NETWORK_SUSPENDED if it happens. Defaults to false. |
| 139 // |
| 140 // This is useful because entering suspend mode tends to kill all sockets |
| 141 // connected to remote systems. See https://crbug.com/4606). |
| 142 // |
| 143 // This is a hint only, subclasses are free to ignore this flag (And currently |
| 144 // do - it's only respected when set directly on a TcpClientSocket). |
| 145 // |
| 146 // TODO(mmenke): Should this be done on all TCP sockets? On all non-localhost |
| 147 // TCP sockets? |
| 148 virtual void SetFailOnSuspend(bool disconnect_on_suspend); |
| 149 |
| 137 protected: | 150 protected: |
| 138 // The following class is only used to gather statistics about the history of | 151 // The following class is only used to gather statistics about the history of |
| 139 // a socket. It is only instantiated and used in basic sockets, such as | 152 // a socket. It is only instantiated and used in basic sockets, such as |
| 140 // TCPClientSocket* instances. Other classes that are derived from | 153 // TCPClientSocket* instances. Other classes that are derived from |
| 141 // StreamSocket should forward any potential settings to their underlying | 154 // StreamSocket should forward any potential settings to their underlying |
| 142 // transport sockets. | 155 // transport sockets. |
| 143 class UseHistory { | 156 class UseHistory { |
| 144 public: | 157 public: |
| 145 UseHistory(); | 158 UseHistory(); |
| 146 ~UseHistory(); | 159 ~UseHistory(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 173 // identify the motivation. | 186 // identify the motivation. |
| 174 bool omnibox_speculation_; | 187 bool omnibox_speculation_; |
| 175 bool subresource_speculation_; | 188 bool subresource_speculation_; |
| 176 DISALLOW_COPY_AND_ASSIGN(UseHistory); | 189 DISALLOW_COPY_AND_ASSIGN(UseHistory); |
| 177 }; | 190 }; |
| 178 }; | 191 }; |
| 179 | 192 |
| 180 } // namespace net | 193 } // namespace net |
| 181 | 194 |
| 182 #endif // NET_SOCKET_STREAM_SOCKET_H_ | 195 #endif // NET_SOCKET_STREAM_SOCKET_H_ |
| OLD | NEW |