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

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

Issue 2324183002: Implement QuicHttpStream::GetLoadTimingInfo (Closed)
Patch Set: fix flaky TestTwoRequests 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 | « net/quic/chromium/quic_stream_factory.h ('k') | net/url_request/url_request_quic_unittest.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 #include "net/quic/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <openssl/aead.h> 7 #include <openssl/aead.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <tuple> 10 #include <tuple>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 QuicSessionKey key_; 336 QuicSessionKey key_;
337 int cert_verify_flags_; 337 int cert_verify_flags_;
338 bool was_alternative_service_recently_broken_; 338 bool was_alternative_service_recently_broken_;
339 std::unique_ptr<QuicServerInfo> server_info_; 339 std::unique_ptr<QuicServerInfo> server_info_;
340 bool started_another_job_; 340 bool started_another_job_;
341 const BoundNetLog net_log_; 341 const BoundNetLog net_log_;
342 int num_sent_client_hellos_; 342 int num_sent_client_hellos_;
343 QuicChromiumClientSession* session_; 343 QuicChromiumClientSession* session_;
344 CompletionCallback callback_; 344 CompletionCallback callback_;
345 AddressList address_list_; 345 AddressList address_list_;
346 base::TimeTicks dns_resolution_start_time_;
346 base::TimeTicks dns_resolution_end_time_; 347 base::TimeTicks dns_resolution_end_time_;
347 base::WeakPtrFactory<Job> weak_factory_; 348 base::WeakPtrFactory<Job> weak_factory_;
348 DISALLOW_COPY_AND_ASSIGN(Job); 349 DISALLOW_COPY_AND_ASSIGN(Job);
349 }; 350 };
350 351
351 QuicStreamFactory::Job::Job(QuicStreamFactory* factory, 352 QuicStreamFactory::Job::Job(QuicStreamFactory* factory,
352 HostResolver* host_resolver, 353 HostResolver* host_resolver,
353 const QuicSessionKey& key, 354 const QuicSessionKey& key,
354 bool was_alternative_service_recently_broken, 355 bool was_alternative_service_recently_broken,
355 int cert_verify_flags, 356 int cert_verify_flags,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 463
463 void QuicStreamFactory::Job::CancelWaitForDataReadyCallback() { 464 void QuicStreamFactory::Job::CancelWaitForDataReadyCallback() {
464 // If we are waiting for WaitForDataReadyCallback, then cancel the callback. 465 // If we are waiting for WaitForDataReadyCallback, then cancel the callback.
465 if (io_state_ != STATE_LOAD_SERVER_INFO_COMPLETE) 466 if (io_state_ != STATE_LOAD_SERVER_INFO_COMPLETE)
466 return; 467 return;
467 server_info_->CancelWaitForDataReadyCallback(); 468 server_info_->CancelWaitForDataReadyCallback();
468 OnIOComplete(OK); 469 OnIOComplete(OK);
469 } 470 }
470 471
471 int QuicStreamFactory::Job::DoResolveHost() { 472 int QuicStreamFactory::Job::DoResolveHost() {
473 dns_resolution_start_time_ = base::TimeTicks::Now();
472 // Start loading the data now, and wait for it after we resolve the host. 474 // Start loading the data now, and wait for it after we resolve the host.
473 if (server_info_) 475 if (server_info_)
474 server_info_->Start(); 476 server_info_->Start();
475 477
476 io_state_ = STATE_RESOLVE_HOST_COMPLETE; 478 io_state_ = STATE_RESOLVE_HOST_COMPLETE;
477 return host_resolver_->Resolve( 479 return host_resolver_->Resolve(
478 HostResolver::RequestInfo(key_.destination()), DEFAULT_PRIORITY, 480 HostResolver::RequestInfo(key_.destination()), DEFAULT_PRIORITY,
479 &address_list_, 481 &address_list_,
480 base::Bind(&QuicStreamFactory::Job::OnIOComplete, GetWeakPtr()), 482 base::Bind(&QuicStreamFactory::Job::OnIOComplete, GetWeakPtr()),
481 &request_, net_log_); 483 &request_, net_log_);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return ERR_CONNECTION_CLOSED; 556 return ERR_CONNECTION_CLOSED;
555 } 557 }
556 558
557 io_state_ = STATE_CONNECT; 559 io_state_ = STATE_CONNECT;
558 return OK; 560 return OK;
559 } 561 }
560 562
561 int QuicStreamFactory::Job::DoConnect() { 563 int QuicStreamFactory::Job::DoConnect() {
562 io_state_ = STATE_CONNECT_COMPLETE; 564 io_state_ = STATE_CONNECT_COMPLETE;
563 565
564 int rv = factory_->CreateSession( 566 int rv =
565 key_, cert_verify_flags_, std::move(server_info_), address_list_, 567 factory_->CreateSession(key_, cert_verify_flags_, std::move(server_info_),
566 dns_resolution_end_time_, net_log_, &session_); 568 address_list_, dns_resolution_start_time_,
569 dns_resolution_end_time_, net_log_, &session_);
567 if (rv != OK) { 570 if (rv != OK) {
568 DCHECK(rv != ERR_IO_PENDING); 571 DCHECK(rv != ERR_IO_PENDING);
569 DCHECK(!session_); 572 DCHECK(!session_);
570 return rv; 573 return rv;
571 } 574 }
572 575
573 if (!session_->connection()->connected()) 576 if (!session_->connection()->connected())
574 return ERR_CONNECTION_CLOSED; 577 return ERR_CONNECTION_CLOSED;
575 578
576 session_->StartReading(); 579 session_->StartReading();
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 } 1588 }
1586 1589
1587 return OK; 1590 return OK;
1588 } 1591 }
1589 1592
1590 int QuicStreamFactory::CreateSession( 1593 int QuicStreamFactory::CreateSession(
1591 const QuicSessionKey& key, 1594 const QuicSessionKey& key,
1592 int cert_verify_flags, 1595 int cert_verify_flags,
1593 std::unique_ptr<QuicServerInfo> server_info, 1596 std::unique_ptr<QuicServerInfo> server_info,
1594 const AddressList& address_list, 1597 const AddressList& address_list,
1598 base::TimeTicks dns_resolution_start_time,
1595 base::TimeTicks dns_resolution_end_time, 1599 base::TimeTicks dns_resolution_end_time,
1596 const BoundNetLog& net_log, 1600 const BoundNetLog& net_log,
1597 QuicChromiumClientSession** session) { 1601 QuicChromiumClientSession** session) {
1598 if (need_to_evaluate_consecutive_disabled_count_) { 1602 if (need_to_evaluate_consecutive_disabled_count_) {
1599 task_runner_->PostDelayedTask( 1603 task_runner_->PostDelayedTask(
1600 FROM_HERE, 1604 FROM_HERE,
1601 base::Bind(&QuicStreamFactory::MaybeClearConsecutiveDisabledCount, 1605 base::Bind(&QuicStreamFactory::MaybeClearConsecutiveDisabledCount,
1602 weak_factory_.GetWeakPtr()), 1606 weak_factory_.GetWeakPtr()),
1603 base::TimeDelta::FromSeconds(kDisableQuicTimeoutSecs)); 1607 base::TimeDelta::FromSeconds(kDisableQuicTimeoutSecs));
1604 1608
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 socket_performance_watcher = 1690 socket_performance_watcher =
1687 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher( 1691 socket_performance_watcher_factory_->CreateSocketPerformanceWatcher(
1688 SocketPerformanceWatcherFactory::PROTOCOL_QUIC); 1692 SocketPerformanceWatcherFactory::PROTOCOL_QUIC);
1689 } 1693 }
1690 1694
1691 *session = new QuicChromiumClientSession( 1695 *session = new QuicChromiumClientSession(
1692 connection, std::move(socket), this, quic_crypto_client_stream_factory_, 1696 connection, std::move(socket), this, quic_crypto_client_stream_factory_,
1693 clock_.get(), transport_security_state_, std::move(server_info), 1697 clock_.get(), transport_security_state_, std::move(server_info),
1694 server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags, 1698 server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags,
1695 config, &crypto_config_, network_connection_.GetDescription(), 1699 config, &crypto_config_, network_connection_.GetDescription(),
1696 dns_resolution_end_time, &push_promise_index_, task_runner_, 1700 dns_resolution_start_time, dns_resolution_end_time, &push_promise_index_,
1697 std::move(socket_performance_watcher), net_log.net_log()); 1701 task_runner_, std::move(socket_performance_watcher), net_log.net_log());
1698 1702
1699 all_sessions_[*session] = key; // owning pointer 1703 all_sessions_[*session] = key; // owning pointer
1700 writer->set_delegate(*session); 1704 writer->set_delegate(*session);
1701 1705
1702 (*session)->Initialize(); 1706 (*session)->Initialize();
1703 bool closed_during_initialize = !base::ContainsKey(all_sessions_, *session) || 1707 bool closed_during_initialize = !base::ContainsKey(all_sessions_, *session) ||
1704 !(*session)->connection()->connected(); 1708 !(*session)->connection()->connected();
1705 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", 1709 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession",
1706 closed_during_initialize); 1710 closed_during_initialize);
1707 if (closed_during_initialize) { 1711 if (closed_during_initialize) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 void QuicStreamFactory::OpenFactory() { 1903 void QuicStreamFactory::OpenFactory() {
1900 status_ = OPEN; 1904 status_ = OPEN;
1901 } 1905 }
1902 1906
1903 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() { 1907 void QuicStreamFactory::MaybeClearConsecutiveDisabledCount() {
1904 if (status_ == OPEN) 1908 if (status_ == OPEN)
1905 consecutive_disabled_count_ = 0; 1909 consecutive_disabled_count_ = 0;
1906 } 1910 }
1907 1911
1908 } // namespace net 1912 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_stream_factory.h ('k') | net/url_request/url_request_quic_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698