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/quic/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 const NetLogWithSource& net_log) | 379 const NetLogWithSource& net_log) |
| 380 : io_state_(STATE_RESOLVE_HOST), | 380 : io_state_(STATE_RESOLVE_HOST), |
| 381 factory_(factory), | 381 factory_(factory), |
| 382 host_resolver_(host_resolver), | 382 host_resolver_(host_resolver), |
| 383 key_(key), | 383 key_(key), |
| 384 cert_verify_flags_(cert_verify_flags), | 384 cert_verify_flags_(cert_verify_flags), |
| 385 was_alternative_service_recently_broken_( | 385 was_alternative_service_recently_broken_( |
| 386 was_alternative_service_recently_broken), | 386 was_alternative_service_recently_broken), |
| 387 server_info_(std::move(server_info)), | 387 server_info_(std::move(server_info)), |
| 388 started_another_job_(false), | 388 started_another_job_(false), |
| 389 net_log_(net_log), | 389 net_log_( |
| 390 NetLogWithSource::Make(net_log.net_log(), | |
| 391 NetLogSourceType::QUIC_STREAM_FACTORY_JOB)), | |
| 390 num_sent_client_hellos_(0), | 392 num_sent_client_hellos_(0), |
| 391 session_(nullptr), | 393 session_(nullptr), |
| 392 weak_factory_(this) {} | 394 weak_factory_(this) { |
| 395 std::string server_id = key_.server_id().ToString(); | |
|
eroman
2017/04/07 01:55:29
optional: If you want to avoid constructing this s
Zhongyi Shi
2017/04/07 03:08:53
Thanks for the suggestion, change to use a separat
| |
| 396 net_log_.BeginEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB, | |
| 397 NetLog::StringCallback("server_id", &server_id)); | |
| 398 // Associate |net_log_| with |net_log|. | |
| 399 net_log_.AddEvent( | |
| 400 NetLogEventType::QUIC_STREAM_FACTORY_JOB_BOUND_TO_HTTP_STREAM_JOB, | |
| 401 net_log.source().ToEventParametersCallback()); | |
| 402 net_log.AddEvent( | |
| 403 NetLogEventType::HTTP_STREAM_JOB_BOUND_TO_QUIC_STREAM_FACTORY_JOB, | |
| 404 net_log_.source().ToEventParametersCallback()); | |
| 405 } | |
| 393 | 406 |
| 394 QuicStreamFactory::Job::~Job() { | 407 QuicStreamFactory::Job::~Job() { |
| 408 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB); | |
| 395 DCHECK(callback_.is_null()); | 409 DCHECK(callback_.is_null()); |
| 396 | 410 |
| 397 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. | 411 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. |
| 398 if (server_info_) | 412 if (server_info_) |
| 399 server_info_->ResetWaitForDataReadyCallback(); | 413 server_info_->ResetWaitForDataReadyCallback(); |
| 400 } | 414 } |
| 401 | 415 |
| 402 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { | 416 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { |
| 403 int rv = DoLoop(OK); | 417 int rv = DoLoop(OK); |
| 404 if (rv == ERR_IO_PENDING) | 418 if (rv == ERR_IO_PENDING) |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1885 // Since the session was active, there's no longer an | 1899 // Since the session was active, there's no longer an |
| 1886 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1900 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1887 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1901 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1888 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1902 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1889 // still race. | 1903 // still race. |
| 1890 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1904 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1891 alternative_service); | 1905 alternative_service); |
| 1892 } | 1906 } |
| 1893 | 1907 |
| 1894 } // namespace net | 1908 } // namespace net |
| OLD | NEW |