| 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_CLIENT_SOCKET_HANDLE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
| 17 #include "net/base/load_states.h" | 17 #include "net/base/load_states.h" |
| 18 #include "net/base/load_timing_info.h" | 18 #include "net/base/load_timing_info.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 21 #include "net/base/request_priority.h" | 21 #include "net/base/request_priority.h" |
| 22 #include "net/http/http_response_info.h" | 22 #include "net/http/http_response_info.h" |
| 23 #include "net/log/net_log_source.h" | 23 #include "net/log/net_log_source.h" |
| 24 #include "net/log/net_log_with_source.h" | 24 #include "net/log/net_log_with_source.h" |
| 25 #include "net/socket/client_socket_pool.h" | 25 #include "net/socket/client_socket_pool.h" |
| 26 #include "net/socket/connection_attempts.h" | 26 #include "net/socket/connection_attempts.h" |
| 27 #include "net/socket/stream_socket.h" | 27 #include "net/socket/stream_socket.h" |
| 28 | 28 |
| 29 namespace base { | |
| 30 namespace trace_event { | |
| 31 class ProcessMemoryDump; | |
| 32 } | |
| 33 } | |
| 34 | |
| 35 namespace net { | 29 namespace net { |
| 36 | 30 |
| 37 // A container for a StreamSocket. | 31 // A container for a StreamSocket. |
| 38 // | 32 // |
| 39 // The handle's |group_name| uniquely identifies the origin and type of the | 33 // The handle's |group_name| uniquely identifies the origin and type of the |
| 40 // connection. It is used by the ClientSocketPool to group similar connected | 34 // connection. It is used by the ClientSocketPool to group similar connected |
| 41 // client socket objects. | 35 // client socket objects. |
| 42 // | 36 // |
| 43 class NET_EXPORT ClientSocketHandle { | 37 class NET_EXPORT ClientSocketHandle { |
| 44 public: | 38 public: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 bool is_initialized() const { return is_initialized_; } | 115 bool is_initialized() const { return is_initialized_; } |
| 122 | 116 |
| 123 // Sets the portion of LoadTimingInfo related to connection establishment, and | 117 // Sets the portion of LoadTimingInfo related to connection establishment, and |
| 124 // the socket id. |is_reused| is needed because the handle may not have full | 118 // the socket id. |is_reused| is needed because the handle may not have full |
| 125 // reuse information. |load_timing_info| must have all default values when | 119 // reuse information. |load_timing_info| must have all default values when |
| 126 // called. Returns false and makes no changes to |load_timing_info| when | 120 // called. Returns false and makes no changes to |load_timing_info| when |
| 127 // |socket_| is NULL. | 121 // |socket_| is NULL. |
| 128 bool GetLoadTimingInfo(bool is_reused, | 122 bool GetLoadTimingInfo(bool is_reused, |
| 129 LoadTimingInfo* load_timing_info) const; | 123 LoadTimingInfo* load_timing_info) const; |
| 130 | 124 |
| 131 // Dumps memory allocation stats. |parent_dump_absolute_name| is the name | 125 // Dumps memory allocation stats into |stats|. |
| 132 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. | 126 void DumpMemoryStats(StreamSocket::SocketMemoryStats* stats) const; |
| 133 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, | |
| 134 const std::string& parent_dump_absolute_name) const; | |
| 135 | 127 |
| 136 // Used by ClientSocketPool to initialize the ClientSocketHandle. | 128 // Used by ClientSocketPool to initialize the ClientSocketHandle. |
| 137 // | 129 // |
| 138 // SetSocket() may also be used if this handle is used as simply for | 130 // SetSocket() may also be used if this handle is used as simply for |
| 139 // socket storage (e.g., http://crbug.com/37810). | 131 // socket storage (e.g., http://crbug.com/37810). |
| 140 void SetSocket(std::unique_ptr<StreamSocket> s); | 132 void SetSocket(std::unique_ptr<StreamSocket> s); |
| 141 void set_reuse_type(SocketReuseType reuse_type) { reuse_type_ = reuse_type; } | 133 void set_reuse_type(SocketReuseType reuse_type) { reuse_type_ = reuse_type; } |
| 142 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } | 134 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } |
| 143 void set_pool_id(int id) { pool_id_ = id; } | 135 void set_pool_id(int id) { pool_id_ = id; } |
| 144 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } | 136 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 user_callback_ = callback; | 246 user_callback_ = callback; |
| 255 } else { | 247 } else { |
| 256 HandleInitCompletion(rv); | 248 HandleInitCompletion(rv); |
| 257 } | 249 } |
| 258 return rv; | 250 return rv; |
| 259 } | 251 } |
| 260 | 252 |
| 261 } // namespace net | 253 } // namespace net |
| 262 | 254 |
| 263 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 255 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| OLD | NEW |