Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1089)

Side by Side Diff: net/socket/client_socket_handle.h

Issue 2623803002: Avoid creating MemoryAllocatorDump for individual sockets (Closed)
Patch Set: Add NET_EXPORT_PRIVATE to fix WIN compile Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/socket/client_socket_handle.cc » ('j') | net/socket/ssl_client_socket_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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|. |stats| can be assumed as being
132 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. 126 // default initialized upon entry. Implementation overrides fields in
133 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, 127 // |stats| and does not increment them.
eroman 2017/01/11 22:15:14 same comment here ("does not increment" is probabl
xunjieli 2017/01/11 23:19:24 Done.
134 const std::string& parent_dump_absolute_name) const; 128 void DumpMemoryStats(StreamSocket::SocketMemoryStats* stats) const;
135 129
136 // Used by ClientSocketPool to initialize the ClientSocketHandle. 130 // Used by ClientSocketPool to initialize the ClientSocketHandle.
137 // 131 //
138 // SetSocket() may also be used if this handle is used as simply for 132 // SetSocket() may also be used if this handle is used as simply for
139 // socket storage (e.g., http://crbug.com/37810). 133 // socket storage (e.g., http://crbug.com/37810).
140 void SetSocket(std::unique_ptr<StreamSocket> s); 134 void SetSocket(std::unique_ptr<StreamSocket> s);
141 void set_reuse_type(SocketReuseType reuse_type) { reuse_type_ = reuse_type; } 135 void set_reuse_type(SocketReuseType reuse_type) { reuse_type_ = reuse_type; }
142 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } 136 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; }
143 void set_pool_id(int id) { pool_id_ = id; } 137 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; } 138 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
254 user_callback_ = callback; 248 user_callback_ = callback;
255 } else { 249 } else {
256 HandleInitCompletion(rv); 250 HandleInitCompletion(rv);
257 } 251 }
258 return rv; 252 return rv;
259 } 253 }
260 254
261 } // namespace net 255 } // namespace net
262 256
263 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ 257 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_
OLDNEW
« no previous file with comments | « no previous file | net/socket/client_socket_handle.cc » ('j') | net/socket/ssl_client_socket_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698