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

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

Issue 2907463002: Split HttpNetworkSession::Params into two structs. (Closed)
Patch Set: Response to comments Created 3 years, 6 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 | « net/http/http_network_layer_unittest.cc ('k') | net/http/http_network_session.cc » ('j') | no next file with comments »
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
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 const uint32_t kSpdyMaxHeaderTableSize = 64 * 1024; 71 const uint32_t kSpdyMaxHeaderTableSize = 64 * 1024;
72 72
73 // Specifies the maximum concurrent streams server could send (via push). 73 // Specifies the maximum concurrent streams server could send (via push).
74 const uint32_t kSpdyMaxConcurrentPushedStreams = 1000; 74 const uint32_t kSpdyMaxConcurrentPushedStreams = 1000;
75 75
76 // This class holds session objects used by HttpNetworkTransaction objects. 76 // This class holds session objects used by HttpNetworkTransaction objects.
77 class NET_EXPORT HttpNetworkSession 77 class NET_EXPORT HttpNetworkSession
78 : NON_EXPORTED_BASE(public base::NonThreadSafe), 78 : NON_EXPORTED_BASE(public base::NonThreadSafe),
79 public base::MemoryCoordinatorClient { 79 public base::MemoryCoordinatorClient {
80 public: 80 public:
81 // Self-contained structure with all the simple configuration options
82 // supported by the HttpNetworkSession.
81 struct NET_EXPORT Params { 83 struct NET_EXPORT Params {
82 Params(); 84 Params();
83 Params(const Params& other); 85 Params(const Params& other);
84 ~Params(); 86 ~Params();
85 87
86 ClientSocketFactory* client_socket_factory;
87 HostResolver* host_resolver;
88 CertVerifier* cert_verifier;
89 bool enable_server_push_cancellation; 88 bool enable_server_push_cancellation;
90 ChannelIDService* channel_id_service;
91 TransportSecurityState* transport_security_state;
92 CTVerifier* cert_transparency_verifier;
93 CTPolicyEnforcer* ct_policy_enforcer;
94 ProxyService* proxy_service;
95 SSLConfigService* ssl_config_service;
96 HttpAuthHandlerFactory* http_auth_handler_factory;
97 HttpServerProperties* http_server_properties;
98 NetLog* net_log;
99 HostMappingRules host_mapping_rules; 89 HostMappingRules host_mapping_rules;
100 SocketPerformanceWatcherFactory* socket_performance_watcher_factory;
101 bool ignore_certificate_errors; 90 bool ignore_certificate_errors;
102 uint16_t testing_fixed_http_port; 91 uint16_t testing_fixed_http_port;
103 uint16_t testing_fixed_https_port; 92 uint16_t testing_fixed_https_port;
104 bool enable_tcp_fast_open_for_ssl; 93 bool enable_tcp_fast_open_for_ssl;
105 bool enable_user_alternate_protocol_ports; 94 bool enable_user_alternate_protocol_ports;
106 95
107 // Use SPDY ping frames to test for connection health after idle. 96 // Use SPDY ping frames to test for connection health after idle.
108 bool enable_spdy_ping_based_connection_checking; 97 bool enable_spdy_ping_based_connection_checking;
109 bool enable_http2; 98 bool enable_http2;
110 size_t spdy_session_max_recv_window_size; 99 size_t spdy_session_max_recv_window_size;
111 // HTTP/2 connection settings. 100 // HTTP/2 connection settings.
112 // Unknown settings will still be sent to the server. 101 // Unknown settings will still be sent to the server.
113 SettingsMap http2_settings; 102 SettingsMap http2_settings;
114 // Source of time for SPDY connections. 103 // Source of time for SPDY connections.
115 SpdySessionPool::TimeFunc time_func; 104 SpdySessionPool::TimeFunc time_func;
116 // Whether to enable HTTP/2 Alt-Svc entries. 105 // Whether to enable HTTP/2 Alt-Svc entries.
117 bool enable_http2_alternative_service; 106 bool enable_http2_alternative_service;
118 107
119 // Enables QUIC support. 108 // Enables QUIC support.
120 bool enable_quic; 109 bool enable_quic;
121 110
122 // QUIC runtime configuration options. 111 // QUIC runtime configuration options.
123 112
124 // Versions of QUIC which may be used. 113 // Versions of QUIC which may be used.
125 QuicVersionVector quic_supported_versions; 114 QuicVersionVector quic_supported_versions;
126 // User agent description to send in the QUIC handshake. 115 // User agent description to send in the QUIC handshake.
127 std::string quic_user_agent_id; 116 std::string quic_user_agent_id;
128 // Limit on the size of QUIC packets. 117 // Limit on the size of QUIC packets.
129 size_t quic_max_packet_length; 118 size_t quic_max_packet_length;
130 // Source of time for QUIC connections.
131 QuicClock* quic_clock;
132 // Source of entropy for QUIC connections.
133 QuicRandom* quic_random;
134 // Optional factory to use for creating QuicCryptoClientStreams.
135 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory;
136 // Maximum number of server configs that are to be stored in 119 // Maximum number of server configs that are to be stored in
137 // HttpServerProperties, instead of the disk cache. 120 // HttpServerProperties, instead of the disk cache.
138 size_t quic_max_server_configs_stored_in_properties; 121 size_t quic_max_server_configs_stored_in_properties;
139 // QUIC will be used for all connections in this set. 122 // QUIC will be used for all connections in this set.
140 std::set<HostPortPair> origins_to_force_quic_on; 123 std::set<HostPortPair> origins_to_force_quic_on;
141 // Set of QUIC tags to send in the handshake's connection options. 124 // Set of QUIC tags to send in the handshake's connection options.
142 QuicTagVector quic_connection_options; 125 QuicTagVector quic_connection_options;
143 126
144 // Active QUIC experiments 127 // Active QUIC experiments
145 128
(...skipping 26 matching lines...) Expand all
172 bool quic_disable_bidirectional_streams; 155 bool quic_disable_bidirectional_streams;
173 // If true, enable force HOL blocking. For measurement purposes. 156 // If true, enable force HOL blocking. For measurement purposes.
174 bool quic_force_hol_blocking; 157 bool quic_force_hol_blocking;
175 // If true, race cert verification with host resolution. 158 // If true, race cert verification with host resolution.
176 bool quic_race_cert_verification; 159 bool quic_race_cert_verification;
177 // If true, configure QUIC sockets to not fragment packets. 160 // If true, configure QUIC sockets to not fragment packets.
178 bool quic_do_not_fragment; 161 bool quic_do_not_fragment;
179 // If true, estimate the initial RTT for QUIC connections based on network. 162 // If true, estimate the initial RTT for QUIC connections based on network.
180 bool quic_estimate_initial_rtt; 163 bool quic_estimate_initial_rtt;
181 164
182 ProxyDelegate* proxy_delegate;
183 // Enable support for Token Binding. 165 // Enable support for Token Binding.
184 bool enable_token_binding; 166 bool enable_token_binding;
185 167
186 // Enable HTTP/0.9 for HTTP/HTTPS on ports other than the default one for 168 // Enable HTTP/0.9 for HTTP/HTTPS on ports other than the default one for
187 // each protocol. 169 // each protocol.
188 bool http_09_on_non_default_ports_enabled; 170 bool http_09_on_non_default_ports_enabled;
189 }; 171 };
190 172
173 // Structure with pointers to the dependencies of the HttpNetworkSession.
174 // These objects must all outlive the HttpNetworkSession.
175 struct NET_EXPORT Context {
176 Context();
177 Context(const Context& other);
178 ~Context();
179
180 ClientSocketFactory* client_socket_factory;
181 HostResolver* host_resolver;
182 CertVerifier* cert_verifier;
183 ChannelIDService* channel_id_service;
184 TransportSecurityState* transport_security_state;
185 CTVerifier* cert_transparency_verifier;
186 CTPolicyEnforcer* ct_policy_enforcer;
187 ProxyService* proxy_service;
188 SSLConfigService* ssl_config_service;
189 HttpAuthHandlerFactory* http_auth_handler_factory;
190 HttpServerProperties* http_server_properties;
191 NetLog* net_log;
192 SocketPerformanceWatcherFactory* socket_performance_watcher_factory;
193
194 // Source of time for QUIC connections.
195 QuicClock* quic_clock;
196 // Source of entropy for QUIC connections.
197 QuicRandom* quic_random;
198 // Optional factory to use for creating QuicCryptoClientStreams.
199 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory;
200
201 ProxyDelegate* proxy_delegate;
202 };
203
191 enum SocketPoolType { 204 enum SocketPoolType {
192 NORMAL_SOCKET_POOL, 205 NORMAL_SOCKET_POOL,
193 WEBSOCKET_SOCKET_POOL, 206 WEBSOCKET_SOCKET_POOL,
194 NUM_SOCKET_POOL_TYPES 207 NUM_SOCKET_POOL_TYPES
195 }; 208 };
196 209
197 explicit HttpNetworkSession(const Params& params); 210 HttpNetworkSession(const Params& params, const Context& context);
198 ~HttpNetworkSession() override; 211 ~HttpNetworkSession() override;
199 212
200 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; } 213 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; }
201 SSLClientAuthCache* ssl_client_auth_cache() { 214 SSLClientAuthCache* ssl_client_auth_cache() {
202 return &ssl_client_auth_cache_; 215 return &ssl_client_auth_cache_;
203 } 216 }
204 217
205 void AddResponseDrainer(std::unique_ptr<HttpResponseBodyDrainer> drainer); 218 void AddResponseDrainer(std::unique_ptr<HttpResponseBodyDrainer> drainer);
206 219
207 // Removes the drainer from the session. Does not dispose of it. 220 // Removes the drainer from the session. Does not dispose of it.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 264
252 // Creates a Value summary of the state of the QUIC sessions and 265 // Creates a Value summary of the state of the QUIC sessions and
253 // configuration. 266 // configuration.
254 std::unique_ptr<base::Value> QuicInfoToValue() const; 267 std::unique_ptr<base::Value> QuicInfoToValue() const;
255 268
256 void CloseAllConnections(); 269 void CloseAllConnections();
257 void CloseIdleConnections(); 270 void CloseIdleConnections();
258 271
259 // Returns the original Params used to construct this session. 272 // Returns the original Params used to construct this session.
260 const Params& params() const { return params_; } 273 const Params& params() const { return params_; }
274 // Returns the original Context used to construct this session.
275 const Context& context() const { return context_; }
261 276
262 bool IsProtocolEnabled(NextProto protocol) const; 277 bool IsProtocolEnabled(NextProto protocol) const;
263 278
264 void SetServerPushDelegate(std::unique_ptr<ServerPushDelegate> push_delegate); 279 void SetServerPushDelegate(std::unique_ptr<ServerPushDelegate> push_delegate);
265 280
266 // Populates |*alpn_protos| with protocols to be used with ALPN. 281 // Populates |*alpn_protos| with protocols to be used with ALPN.
267 void GetAlpnProtos(NextProtoVector* alpn_protos) const; 282 void GetAlpnProtos(NextProtoVector* alpn_protos) const;
268 283
269 // Populates |server_config| and |proxy_config| based on this session and 284 // Populates |server_config| and |proxy_config| based on this session and
270 // |request|. 285 // |request|.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 SpdySessionPool spdy_session_pool_; 328 SpdySessionPool spdy_session_pool_;
314 std::unique_ptr<HttpStreamFactory> http_stream_factory_; 329 std::unique_ptr<HttpStreamFactory> http_stream_factory_;
315 std::unique_ptr<HttpStreamFactory> http_stream_factory_for_websocket_; 330 std::unique_ptr<HttpStreamFactory> http_stream_factory_for_websocket_;
316 std::map<HttpResponseBodyDrainer*, std::unique_ptr<HttpResponseBodyDrainer>> 331 std::map<HttpResponseBodyDrainer*, std::unique_ptr<HttpResponseBodyDrainer>>
317 response_drainers_; 332 response_drainers_;
318 std::unique_ptr<NetworkThrottleManager> network_stream_throttler_; 333 std::unique_ptr<NetworkThrottleManager> network_stream_throttler_;
319 334
320 NextProtoVector next_protos_; 335 NextProtoVector next_protos_;
321 336
322 Params params_; 337 Params params_;
338 Context context_;
323 339
324 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 340 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
325 }; 341 };
326 342
327 } // namespace net 343 } // namespace net
328 344
329 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ 345 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_
OLDNEW
« no previous file with comments | « net/http/http_network_layer_unittest.cc ('k') | net/http/http_network_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698