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 #include "net/http/http_network_session.h" | 5 #include "net/http/http_network_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 proxy_service(NULL), | 80 proxy_service(NULL), |
| 81 ssl_config_service(NULL), | 81 ssl_config_service(NULL), |
| 82 http_auth_handler_factory(NULL), | 82 http_auth_handler_factory(NULL), |
| 83 net_log(NULL), | 83 net_log(NULL), |
| 84 host_mapping_rules(NULL), | 84 host_mapping_rules(NULL), |
| 85 socket_performance_watcher_factory(NULL), | 85 socket_performance_watcher_factory(NULL), |
| 86 ignore_certificate_errors(false), | 86 ignore_certificate_errors(false), |
| 87 testing_fixed_http_port(0), | 87 testing_fixed_http_port(0), |
| 88 testing_fixed_https_port(0), | 88 testing_fixed_https_port(0), |
| 89 enable_tcp_fast_open_for_ssl(false), | 89 enable_tcp_fast_open_for_ssl(false), |
| 90 dynamic_shared_params(NULL), | |
|
mmenke
2016/12/13 18:48:54
nullptr is now preferred (Feel free to change the
pmarko
2016/12/19 21:25:11
Done.
| |
| 90 enable_spdy_ping_based_connection_checking(true), | 91 enable_spdy_ping_based_connection_checking(true), |
| 91 enable_http2(true), | 92 enable_http2(true), |
| 92 spdy_session_max_recv_window_size(kSpdySessionMaxRecvWindowSize), | 93 spdy_session_max_recv_window_size(kSpdySessionMaxRecvWindowSize), |
| 93 spdy_stream_max_recv_window_size(kSpdyStreamMaxRecvWindowSize), | 94 spdy_stream_max_recv_window_size(kSpdyStreamMaxRecvWindowSize), |
| 94 time_func(&base::TimeTicks::Now), | 95 time_func(&base::TimeTicks::Now), |
| 95 enable_http2_alternative_service_with_different_host(false), | 96 enable_http2_alternative_service_with_different_host(false), |
| 96 enable_quic_alternative_service_with_different_host(true), | 97 enable_quic_alternative_service_with_different_host(true), |
| 97 enable_quic(false), | 98 enable_quic(false), |
| 98 disable_quic_on_timeout_with_open_streams(false), | 99 disable_quic_on_timeout_with_open_streams(false), |
| 99 enable_quic_port_selection(true), | 100 enable_quic_port_selection(true), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 129 proxy_delegate(NULL), | 130 proxy_delegate(NULL), |
| 130 enable_token_binding(false), | 131 enable_token_binding(false), |
| 131 http_09_on_non_default_ports_enabled(false) { | 132 http_09_on_non_default_ports_enabled(false) { |
| 132 quic_supported_versions.push_back(QUIC_VERSION_35); | 133 quic_supported_versions.push_back(QUIC_VERSION_35); |
| 133 } | 134 } |
| 134 | 135 |
| 135 HttpNetworkSession::Params::Params(const Params& other) = default; | 136 HttpNetworkSession::Params::Params(const Params& other) = default; |
| 136 | 137 |
| 137 HttpNetworkSession::Params::~Params() {} | 138 HttpNetworkSession::Params::~Params() {} |
| 138 | 139 |
| 140 bool HttpNetworkSession::Params::enable_quic_for_new_streams() const { | |
| 141 return enable_quic && (!dynamic_shared_params || | |
| 142 dynamic_shared_params->enable_quic_for_new_streams); | |
|
mmenke
2016/12/13 18:48:54
I assume we do need both this and enable_quic, and
Bence
2016/12/13 19:24:45
Correct. For example, |enable_quic| can be cleare
pmarko
2016/12/19 21:25:11
Reduced to only enable_quic, the logic is now outs
| |
| 143 } | |
| 144 | |
| 145 HttpNetworkSession::DynamicSharedParams::DynamicSharedParams() | |
| 146 : enable_quic_for_new_streams(true) {} | |
| 147 | |
| 148 HttpNetworkSession::DynamicSharedParams::DynamicSharedParams( | |
| 149 const DynamicSharedParams& other) = default; | |
| 150 | |
| 151 HttpNetworkSession::DynamicSharedParams::~DynamicSharedParams() {} | |
| 152 | |
| 139 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. | 153 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. |
| 140 HttpNetworkSession::HttpNetworkSession(const Params& params) | 154 HttpNetworkSession::HttpNetworkSession(const Params& params) |
| 141 : net_log_(params.net_log), | 155 : net_log_(params.net_log), |
| 142 http_server_properties_(params.http_server_properties), | 156 http_server_properties_(params.http_server_properties), |
| 143 cert_verifier_(params.cert_verifier), | 157 cert_verifier_(params.cert_verifier), |
| 144 http_auth_handler_factory_(params.http_auth_handler_factory), | 158 http_auth_handler_factory_(params.http_auth_handler_factory), |
| 145 proxy_service_(params.proxy_service), | 159 proxy_service_(params.proxy_service), |
| 146 ssl_config_service_(params.ssl_config_service), | 160 ssl_config_service_(params.ssl_config_service), |
| 147 quic_stream_factory_( | 161 quic_stream_factory_( |
| 148 params.net_log, | 162 params.net_log, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 | 298 |
| 285 std::unique_ptr<base::Value> HttpNetworkSession::SpdySessionPoolInfoToValue() | 299 std::unique_ptr<base::Value> HttpNetworkSession::SpdySessionPoolInfoToValue() |
| 286 const { | 300 const { |
| 287 return spdy_session_pool_.SpdySessionPoolInfoToValue(); | 301 return spdy_session_pool_.SpdySessionPoolInfoToValue(); |
| 288 } | 302 } |
| 289 | 303 |
| 290 std::unique_ptr<base::Value> HttpNetworkSession::QuicInfoToValue() const { | 304 std::unique_ptr<base::Value> HttpNetworkSession::QuicInfoToValue() const { |
| 291 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 305 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 292 dict->Set("sessions", quic_stream_factory_.QuicStreamFactoryInfoToValue()); | 306 dict->Set("sessions", quic_stream_factory_.QuicStreamFactoryInfoToValue()); |
| 293 dict->SetBoolean("quic_enabled", params_.enable_quic); | 307 dict->SetBoolean("quic_enabled", params_.enable_quic); |
| 308 dict->SetBoolean("quic_enabled_for_new_streams", | |
| 309 params_.enable_quic_for_new_streams()); | |
| 294 dict->SetBoolean("enable_quic_port_selection", | 310 dict->SetBoolean("enable_quic_port_selection", |
| 295 params_.enable_quic_port_selection); | 311 params_.enable_quic_port_selection); |
| 296 std::unique_ptr<base::ListValue> connection_options(new base::ListValue); | 312 std::unique_ptr<base::ListValue> connection_options(new base::ListValue); |
| 297 for (QuicTagVector::const_iterator it = | 313 for (QuicTagVector::const_iterator it = |
| 298 params_.quic_connection_options.begin(); | 314 params_.quic_connection_options.begin(); |
| 299 it != params_.quic_connection_options.end(); ++it) { | 315 it != params_.quic_connection_options.end(); ++it) { |
| 300 connection_options->AppendString("'" + QuicTagToString(*it) + "'"); | 316 connection_options->AppendString("'" + QuicTagToString(*it) + "'"); |
| 301 } | 317 } |
| 302 dict->Set("connection_options", std::move(connection_options)); | 318 dict->Set("connection_options", std::move(connection_options)); |
| 303 | 319 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 bool HttpNetworkSession::IsProtocolEnabled(NextProto protocol) const { | 367 bool HttpNetworkSession::IsProtocolEnabled(NextProto protocol) const { |
| 352 switch (protocol) { | 368 switch (protocol) { |
| 353 case kProtoUnknown: | 369 case kProtoUnknown: |
| 354 NOTREACHED(); | 370 NOTREACHED(); |
| 355 return false; | 371 return false; |
| 356 case kProtoHTTP11: | 372 case kProtoHTTP11: |
| 357 return true; | 373 return true; |
| 358 case kProtoHTTP2: | 374 case kProtoHTTP2: |
| 359 return params_.enable_http2; | 375 return params_.enable_http2; |
| 360 case kProtoQUIC: | 376 case kProtoQUIC: |
| 361 return params_.enable_quic; | 377 return params_.enable_quic_for_new_streams(); |
|
mmenke
2016/12/13 18:48:54
HttpNetworkSession::IsProtocolEnabled() -> enable_
pmarko
2016/12/19 21:25:11
Reduced to only enable_quic, the logic is now outs
| |
| 362 } | 378 } |
| 363 NOTREACHED(); | 379 NOTREACHED(); |
| 364 return false; | 380 return false; |
| 365 } | 381 } |
| 366 | 382 |
| 367 void HttpNetworkSession::GetAlpnProtos(NextProtoVector* alpn_protos) const { | 383 void HttpNetworkSession::GetAlpnProtos(NextProtoVector* alpn_protos) const { |
| 368 *alpn_protos = next_protos_; | 384 *alpn_protos = next_protos_; |
| 369 } | 385 } |
| 370 | 386 |
| 371 void HttpNetworkSession::GetSSLConfig(const HttpRequestInfo& request, | 387 void HttpNetworkSession::GetSSLConfig(const HttpRequestInfo& request, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 break; | 435 break; |
| 420 case base::MemoryState::SUSPENDED: | 436 case base::MemoryState::SUSPENDED: |
| 421 // Note: Not supported at present. Fall through. | 437 // Note: Not supported at present. Fall through. |
| 422 case base::MemoryState::UNKNOWN: | 438 case base::MemoryState::UNKNOWN: |
| 423 NOTREACHED(); | 439 NOTREACHED(); |
| 424 break; | 440 break; |
| 425 } | 441 } |
| 426 } | 442 } |
| 427 | 443 |
| 428 } // namespace net | 444 } // namespace net |
| OLD | NEW |