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(); | |
396 net_log_.BeginEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB, | |
397 NetLog::StringCallback("server_id", &server_id)); | |
398 net_log.AddEvent( | |
399 NetLogEventType::HTTP_STREAM_JOB_BOUND_TO_QUIC_STREAM_FACTORY_JOB, | |
400 net_log_.source().ToEventParametersCallback()); | |
401 net_log_.AddEvent( | |
402 NetLogEventType::QUIC_STREAM_FACTORY_JOB_BOUND_TO_HTTP_STREAM_JOB, | |
403 net_log.source().ToEventParametersCallback()); | |
Ryan Hamilton
2017/04/06 23:55:11
Can you add comments to these. Also can you put th
Zhongyi Shi
2017/04/07 00:17:42
Done. That's a good idea, sorry about the inconven
Ryan Hamilton
2017/04/07 00:20:32
Thanks for doing this work!
| |
404 } | |
393 | 405 |
394 QuicStreamFactory::Job::~Job() { | 406 QuicStreamFactory::Job::~Job() { |
407 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB); | |
395 DCHECK(callback_.is_null()); | 408 DCHECK(callback_.is_null()); |
396 | 409 |
397 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. | 410 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. |
398 if (server_info_) | 411 if (server_info_) |
399 server_info_->ResetWaitForDataReadyCallback(); | 412 server_info_->ResetWaitForDataReadyCallback(); |
400 } | 413 } |
401 | 414 |
402 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { | 415 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { |
403 int rv = DoLoop(OK); | 416 int rv = DoLoop(OK); |
404 if (rv == ERR_IO_PENDING) | 417 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 | 1898 // Since the session was active, there's no longer an |
1886 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1899 // 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 | 1900 // 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 | 1901 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1889 // still race. | 1902 // still race. |
1890 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1903 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1891 alternative_service); | 1904 alternative_service); |
1892 } | 1905 } |
1893 | 1906 |
1894 } // namespace net | 1907 } // namespace net |
OLD | NEW |