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

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 1305293004: Notfiy NQE of QUIC RTT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sleevi comments Created 5 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
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 #include "net/quic/quic_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/metrics/field_trial.h" 11 #include "base/metrics/field_trial.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/metrics/sparse_histogram.h" 13 #include "base/metrics/sparse_histogram.h"
14 #include "base/rand_util.h" 14 #include "base/rand_util.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/thread_task_runner_handle.h" 19 #include "base/thread_task_runner_handle.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
22 #include "net/base/socket_performance_watcher.h"
23 #include "net/base/socket_performance_watcher_factory.h"
22 #include "net/cert/cert_verifier.h" 24 #include "net/cert/cert_verifier.h"
23 #include "net/dns/host_resolver.h" 25 #include "net/dns/host_resolver.h"
24 #include "net/dns/single_request_host_resolver.h" 26 #include "net/dns/single_request_host_resolver.h"
25 #include "net/http/http_server_properties.h" 27 #include "net/http/http_server_properties.h"
26 #include "net/quic/crypto/channel_id_chromium.h" 28 #include "net/quic/crypto/channel_id_chromium.h"
27 #include "net/quic/crypto/proof_verifier_chromium.h" 29 #include "net/quic/crypto/proof_verifier_chromium.h"
28 #include "net/quic/crypto/quic_random.h" 30 #include "net/quic/crypto/quic_random.h"
29 #include "net/quic/crypto/quic_server_info.h" 31 #include "net/quic/crypto/quic_server_info.h"
30 #include "net/quic/port_suggester.h" 32 #include "net/quic/port_suggester.h"
31 #include "net/quic/quic_chromium_client_session.h" 33 #include "net/quic/quic_chromium_client_session.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 560 }
559 561
560 QuicStreamFactory::QuicStreamFactory( 562 QuicStreamFactory::QuicStreamFactory(
561 HostResolver* host_resolver, 563 HostResolver* host_resolver,
562 ClientSocketFactory* client_socket_factory, 564 ClientSocketFactory* client_socket_factory,
563 base::WeakPtr<HttpServerProperties> http_server_properties, 565 base::WeakPtr<HttpServerProperties> http_server_properties,
564 CertVerifier* cert_verifier, 566 CertVerifier* cert_verifier,
565 CertPolicyEnforcer* cert_policy_enforcer, 567 CertPolicyEnforcer* cert_policy_enforcer,
566 ChannelIDService* channel_id_service, 568 ChannelIDService* channel_id_service,
567 TransportSecurityState* transport_security_state, 569 TransportSecurityState* transport_security_state,
570 const SocketPerformanceWatcherFactory* socket_performance_watcher_factory,
568 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, 571 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory,
569 QuicRandom* random_generator, 572 QuicRandom* random_generator,
570 QuicClock* clock, 573 QuicClock* clock,
571 size_t max_packet_length, 574 size_t max_packet_length,
572 const std::string& user_agent_id, 575 const std::string& user_agent_id,
573 const QuicVersionVector& supported_versions, 576 const QuicVersionVector& supported_versions,
574 bool enable_port_selection, 577 bool enable_port_selection,
575 bool always_require_handshake_confirmation, 578 bool always_require_handshake_confirmation,
576 bool disable_connection_pooling, 579 bool disable_connection_pooling,
577 float load_server_info_timeout_srtt_multiplier, 580 float load_server_info_timeout_srtt_multiplier,
(...skipping 11 matching lines...) Expand all
589 : require_confirmation_(true), 592 : require_confirmation_(true),
590 host_resolver_(host_resolver), 593 host_resolver_(host_resolver),
591 client_socket_factory_(client_socket_factory), 594 client_socket_factory_(client_socket_factory),
592 http_server_properties_(http_server_properties), 595 http_server_properties_(http_server_properties),
593 transport_security_state_(transport_security_state), 596 transport_security_state_(transport_security_state),
594 quic_server_info_factory_(nullptr), 597 quic_server_info_factory_(nullptr),
595 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), 598 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory),
596 random_generator_(random_generator), 599 random_generator_(random_generator),
597 clock_(clock), 600 clock_(clock),
598 max_packet_length_(max_packet_length), 601 max_packet_length_(max_packet_length),
602 socket_performance_watcher_factory_(socket_performance_watcher_factory),
599 config_(InitializeQuicConfig(connection_options)), 603 config_(InitializeQuicConfig(connection_options)),
600 supported_versions_(supported_versions), 604 supported_versions_(supported_versions),
601 enable_port_selection_(enable_port_selection), 605 enable_port_selection_(enable_port_selection),
602 always_require_handshake_confirmation_( 606 always_require_handshake_confirmation_(
603 always_require_handshake_confirmation), 607 always_require_handshake_confirmation),
604 disable_connection_pooling_(disable_connection_pooling), 608 disable_connection_pooling_(disable_connection_pooling),
605 load_server_info_timeout_srtt_multiplier_( 609 load_server_info_timeout_srtt_multiplier_(
606 load_server_info_timeout_srtt_multiplier), 610 load_server_info_timeout_srtt_multiplier),
607 enable_connection_racing_(enable_connection_racing), 611 enable_connection_racing_(enable_connection_racing),
608 enable_non_blocking_io_(enable_non_blocking_io), 612 enable_non_blocking_io_(enable_non_blocking_io),
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 config.SetBytesForConnectionIdToSend(0); 1260 config.SetBytesForConnectionIdToSend(0);
1257 1261
1258 if (quic_server_info_factory_ && !server_info) { 1262 if (quic_server_info_factory_ && !server_info) {
1259 // Start the disk cache loading so that we can persist the newer QUIC server 1263 // Start the disk cache loading so that we can persist the newer QUIC server
1260 // information and/or inform the disk cache that we have reused 1264 // information and/or inform the disk cache that we have reused
1261 // |server_info|. 1265 // |server_info|.
1262 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); 1266 server_info.reset(quic_server_info_factory_->GetForServer(server_id));
1263 server_info->Start(); 1267 server_info->Start();
1264 } 1268 }
1265 1269
1270 // Use the factory to create a new socket performance watcher, and pass the
1271 // ownership to QuicChromiumClientSession.
1272 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher;
1273 if (socket_performance_watcher_factory_) {
1274 socket_performance_watcher = socket_performance_watcher_factory_
1275 ->CreateUDPSocketPerformanceWatcher();
1276 }
1277
1266 *session = new QuicChromiumClientSession( 1278 *session = new QuicChromiumClientSession(
1267 connection, socket.Pass(), this, quic_crypto_client_stream_factory_, 1279 connection, socket.Pass(), this, quic_crypto_client_stream_factory_,
1268 transport_security_state_, server_info.Pass(), server_id, 1280 transport_security_state_, server_info.Pass(), server_id,
1269 cert_verify_flags, config, &crypto_config_, 1281 cert_verify_flags, config, &crypto_config_,
1270 network_connection_.GetDescription(), dns_resolution_end_time, 1282 network_connection_.GetDescription(), dns_resolution_end_time,
1271 base::ThreadTaskRunnerHandle::Get().get(), net_log.net_log()); 1283 base::ThreadTaskRunnerHandle::Get().get(),
1284 socket_performance_watcher.Pass(), net_log.net_log());
1272 1285
1273 all_sessions_[*session] = server_id; // owning pointer 1286 all_sessions_[*session] = server_id; // owning pointer
1274 1287
1275 (*session)->Initialize(); 1288 (*session)->Initialize();
1276 bool closed_during_initialize = 1289 bool closed_during_initialize =
1277 !ContainsKey(all_sessions_, *session) || 1290 !ContainsKey(all_sessions_, *session) ||
1278 !(*session)->connection()->connected(); 1291 !(*session)->connection()->connected();
1279 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", 1292 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession",
1280 closed_during_initialize); 1293 closed_during_initialize);
1281 if (closed_during_initialize) { 1294 if (closed_during_initialize) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 // Since the session was active, there's no longer an 1427 // Since the session was active, there's no longer an
1415 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1428 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1416 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1429 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1417 // it as recently broken, which means that 0-RTT will be disabled but we'll 1430 // it as recently broken, which means that 0-RTT will be disabled but we'll
1418 // still race. 1431 // still race.
1419 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1432 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1420 alternative_service); 1433 alternative_service);
1421 } 1434 }
1422 1435
1423 } // namespace net 1436 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698