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

Side by Side Diff: net/http/http_network_session.h

Issue 2359723006: Make HttpNetworkSession a client of memory coordinator (Closed)
Patch Set: Created 4 years, 3 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/http/http_network_session.cc » ('j') | net/http/http_network_session.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_HTTP_HTTP_NETWORK_SESSION_H_ 5 #ifndef NET_HTTP_HTTP_NETWORK_SESSION_H_
6 #define NET_HTTP_HTTP_NETWORK_SESSION_H_ 6 #define NET_HTTP_HTTP_NETWORK_SESSION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <unordered_set> 13 #include <unordered_set>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/memory/memory_coordinator_client.h"
17 #include "base/memory/memory_pressure_monitor.h" 18 #include "base/memory/memory_pressure_monitor.h"
18 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
19 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
20 #include "base/threading/non_thread_safe.h" 21 #include "base/threading/non_thread_safe.h"
21 #include "net/base/host_port_pair.h" 22 #include "net/base/host_port_pair.h"
22 #include "net/base/net_export.h" 23 #include "net/base/net_export.h"
23 #include "net/dns/host_resolver.h" 24 #include "net/dns/host_resolver.h"
24 #include "net/http/http_auth_cache.h" 25 #include "net/http/http_auth_cache.h"
25 #include "net/http/http_stream_factory.h" 26 #include "net/http/http_stream_factory.h"
26 #include "net/quic/chromium/quic_stream_factory.h" 27 #include "net/quic/chromium/quic_stream_factory.h"
(...skipping 27 matching lines...) Expand all
54 class QuicServerInfoFactory; 55 class QuicServerInfoFactory;
55 class SocketPerformanceWatcherFactory; 56 class SocketPerformanceWatcherFactory;
56 class SOCKSClientSocketPool; 57 class SOCKSClientSocketPool;
57 class SSLClientSocketPool; 58 class SSLClientSocketPool;
58 class SSLConfigService; 59 class SSLConfigService;
59 class TransportClientSocketPool; 60 class TransportClientSocketPool;
60 class TransportSecurityState; 61 class TransportSecurityState;
61 62
62 // This class holds session objects used by HttpNetworkTransaction objects. 63 // This class holds session objects used by HttpNetworkTransaction objects.
63 class NET_EXPORT HttpNetworkSession 64 class NET_EXPORT HttpNetworkSession
64 : NON_EXPORTED_BASE(public base::NonThreadSafe) { 65 : NON_EXPORTED_BASE(public base::NonThreadSafe),
66 public base::MemoryCoordinatorClient {
Ryan Sleevi 2016/09/26 15:15:59 Just from a design perspective, base::MemoryPressu
65 public: 67 public:
66 struct NET_EXPORT Params { 68 struct NET_EXPORT Params {
67 Params(); 69 Params();
68 Params(const Params& other); 70 Params(const Params& other);
69 ~Params(); 71 ~Params();
70 72
71 ClientSocketFactory* client_socket_factory; 73 ClientSocketFactory* client_socket_factory;
72 HostResolver* host_resolver; 74 HostResolver* host_resolver;
73 CertVerifier* cert_verifier; 75 CertVerifier* cert_verifier;
74 ChannelIDService* channel_id_service; 76 ChannelIDService* channel_id_service;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 bool http_09_on_non_default_ports_enabled; 194 bool http_09_on_non_default_ports_enabled;
193 }; 195 };
194 196
195 enum SocketPoolType { 197 enum SocketPoolType {
196 NORMAL_SOCKET_POOL, 198 NORMAL_SOCKET_POOL,
197 WEBSOCKET_SOCKET_POOL, 199 WEBSOCKET_SOCKET_POOL,
198 NUM_SOCKET_POOL_TYPES 200 NUM_SOCKET_POOL_TYPES
199 }; 201 };
200 202
201 explicit HttpNetworkSession(const Params& params); 203 explicit HttpNetworkSession(const Params& params);
202 ~HttpNetworkSession(); 204 ~HttpNetworkSession() override;
203 205
204 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; } 206 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; }
205 SSLClientAuthCache* ssl_client_auth_cache() { 207 SSLClientAuthCache* ssl_client_auth_cache() {
206 return &ssl_client_auth_cache_; 208 return &ssl_client_auth_cache_;
207 } 209 }
208 210
209 void AddResponseDrainer(HttpResponseBodyDrainer* drainer); 211 void AddResponseDrainer(HttpResponseBodyDrainer* drainer);
210 212
211 void RemoveResponseDrainer(HttpResponseBodyDrainer* drainer); 213 void RemoveResponseDrainer(HttpResponseBodyDrainer* drainer);
212 214
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 274
273 private: 275 private:
274 friend class HttpNetworkSessionPeer; 276 friend class HttpNetworkSessionPeer;
275 277
276 ClientSocketPoolManager* GetSocketPoolManager(SocketPoolType pool_type); 278 ClientSocketPoolManager* GetSocketPoolManager(SocketPoolType pool_type);
277 279
278 // Flush sockets on low memory notifications callback. 280 // Flush sockets on low memory notifications callback.
279 void OnMemoryPressure( 281 void OnMemoryPressure(
280 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); 282 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
281 283
284 // base::MemoryCoordinatorClient implementation:
285 void OnMemoryStateChange(base::MemoryState state) override;
286
282 NetLog* const net_log_; 287 NetLog* const net_log_;
283 HttpServerProperties* const http_server_properties_; 288 HttpServerProperties* const http_server_properties_;
284 CertVerifier* const cert_verifier_; 289 CertVerifier* const cert_verifier_;
285 HttpAuthHandlerFactory* const http_auth_handler_factory_; 290 HttpAuthHandlerFactory* const http_auth_handler_factory_;
286 291
287 // Not const since it's modified by HttpNetworkSessionPeer for testing. 292 // Not const since it's modified by HttpNetworkSessionPeer for testing.
288 ProxyService* proxy_service_; 293 ProxyService* proxy_service_;
289 const scoped_refptr<SSLConfigService> ssl_config_service_; 294 const scoped_refptr<SSLConfigService> ssl_config_service_;
290 295
291 HttpAuthCache http_auth_cache_; 296 HttpAuthCache http_auth_cache_;
(...skipping 10 matching lines...) Expand all
302 bool enabled_protocols_[NUM_VALID_ALTERNATE_PROTOCOLS]; 307 bool enabled_protocols_[NUM_VALID_ALTERNATE_PROTOCOLS];
303 308
304 Params params_; 309 Params params_;
305 310
306 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 311 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
307 }; 312 };
308 313
309 } // namespace net 314 } // namespace net
310 315
311 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ 316 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/http_network_session.cc » ('j') | net/http/http_network_session.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698