Chromium Code Reviews| 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 | |
| 29 namespace net { | 35 namespace net { |
| 30 | 36 |
| 31 // A container for a StreamSocket. | 37 // A container for a StreamSocket. |
| 32 // | 38 // |
| 33 // The handle's |group_name| uniquely identifies the origin and type of the | 39 // The handle's |group_name| uniquely identifies the origin and type of the |
| 34 // connection. It is used by the ClientSocketPool to group similar connected | 40 // connection. It is used by the ClientSocketPool to group similar connected |
| 35 // client socket objects. | 41 // client socket objects. |
| 36 // | 42 // |
| 37 class NET_EXPORT ClientSocketHandle { | 43 class NET_EXPORT ClientSocketHandle { |
| 38 public: | 44 public: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 bool is_initialized() const { return is_initialized_; } | 121 bool is_initialized() const { return is_initialized_; } |
| 116 | 122 |
| 117 // Sets the portion of LoadTimingInfo related to connection establishment, and | 123 // Sets the portion of LoadTimingInfo related to connection establishment, and |
| 118 // the socket id. |is_reused| is needed because the handle may not have full | 124 // the socket id. |is_reused| is needed because the handle may not have full |
| 119 // reuse information. |load_timing_info| must have all default values when | 125 // reuse information. |load_timing_info| must have all default values when |
| 120 // called. Returns false and makes no changes to |load_timing_info| when | 126 // called. Returns false and makes no changes to |load_timing_info| when |
| 121 // |socket_| is NULL. | 127 // |socket_| is NULL. |
| 122 bool GetLoadTimingInfo(bool is_reused, | 128 bool GetLoadTimingInfo(bool is_reused, |
| 123 LoadTimingInfo* load_timing_info) const; | 129 LoadTimingInfo* load_timing_info) const; |
| 124 | 130 |
| 131 // Dumps memory allocation stats. |parent_dump_absolute_name| is the name | |
|
Bence
2016/12/08 19:52:32
s/parent_dump_absolute_name/parent_absolute_name/
xunjieli
2016/12/08 19:55:17
Done.
| |
| 132 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. | |
| 133 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, | |
| 134 const std::string& parent_absolute_name) const; | |
| 135 | |
| 125 // Used by ClientSocketPool to initialize the ClientSocketHandle. | 136 // Used by ClientSocketPool to initialize the ClientSocketHandle. |
| 126 // | 137 // |
| 127 // SetSocket() may also be used if this handle is used as simply for | 138 // SetSocket() may also be used if this handle is used as simply for |
| 128 // socket storage (e.g., http://crbug.com/37810). | 139 // socket storage (e.g., http://crbug.com/37810). |
| 129 void SetSocket(std::unique_ptr<StreamSocket> s); | 140 void SetSocket(std::unique_ptr<StreamSocket> s); |
| 130 void set_reuse_type(SocketReuseType reuse_type) { reuse_type_ = reuse_type; } | 141 void set_reuse_type(SocketReuseType reuse_type) { reuse_type_ = reuse_type; } |
| 131 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } | 142 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } |
| 132 void set_pool_id(int id) { pool_id_ = id; } | 143 void set_pool_id(int id) { pool_id_ = id; } |
| 133 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } | 144 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } |
| 134 void set_ssl_error_response_info(const HttpResponseInfo& ssl_error_state) { | 145 void set_ssl_error_response_info(const HttpResponseInfo& ssl_error_state) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 user_callback_ = callback; | 254 user_callback_ = callback; |
| 244 } else { | 255 } else { |
| 245 HandleInitCompletion(rv); | 256 HandleInitCompletion(rv); |
| 246 } | 257 } |
| 247 return rv; | 258 return rv; |
| 248 } | 259 } |
| 249 | 260 |
| 250 } // namespace net | 261 } // namespace net |
| 251 | 262 |
| 252 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 263 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
| OLD | NEW |