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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 INITIAL_RTT_SOURCE_MAX, | 85 INITIAL_RTT_SOURCE_MAX, |
86 }; | 86 }; |
87 | 87 |
88 // The maximum receive window sizes for QUIC sessions and streams. | 88 // The maximum receive window sizes for QUIC sessions and streams. |
89 const int32_t kQuicSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB | 89 const int32_t kQuicSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB |
90 const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB | 90 const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB |
91 | 91 |
92 // Set the maximum number of undecryptable packets the connection will store. | 92 // Set the maximum number of undecryptable packets the connection will store. |
93 const int32_t kMaxUndecryptablePackets = 100; | 93 const int32_t kMaxUndecryptablePackets = 100; |
94 | 94 |
| 95 std::unique_ptr<base::Value> NetLogQuicStreamFactoryJobCallback( |
| 96 const QuicServerId* server_id, |
| 97 NetLogCaptureMode capture_mode) { |
| 98 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 99 dict->SetString("server_id", server_id->ToString()); |
| 100 return std::move(dict); |
| 101 } |
| 102 |
95 std::unique_ptr<base::Value> NetLogQuicConnectionMigrationTriggerCallback( | 103 std::unique_ptr<base::Value> NetLogQuicConnectionMigrationTriggerCallback( |
96 std::string trigger, | 104 std::string trigger, |
97 NetLogCaptureMode capture_mode) { | 105 NetLogCaptureMode capture_mode) { |
98 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 106 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
99 dict->SetString("trigger", trigger); | 107 dict->SetString("trigger", trigger); |
100 return std::move(dict); | 108 return std::move(dict); |
101 } | 109 } |
102 | 110 |
103 std::unique_ptr<base::Value> NetLogQuicConnectionMigrationFailureCallback( | 111 std::unique_ptr<base::Value> NetLogQuicConnectionMigrationFailureCallback( |
104 QuicConnectionId connection_id, | 112 QuicConnectionId connection_id, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 const NetLogWithSource& net_log) | 387 const NetLogWithSource& net_log) |
380 : io_state_(STATE_RESOLVE_HOST), | 388 : io_state_(STATE_RESOLVE_HOST), |
381 factory_(factory), | 389 factory_(factory), |
382 host_resolver_(host_resolver), | 390 host_resolver_(host_resolver), |
383 key_(key), | 391 key_(key), |
384 cert_verify_flags_(cert_verify_flags), | 392 cert_verify_flags_(cert_verify_flags), |
385 was_alternative_service_recently_broken_( | 393 was_alternative_service_recently_broken_( |
386 was_alternative_service_recently_broken), | 394 was_alternative_service_recently_broken), |
387 server_info_(std::move(server_info)), | 395 server_info_(std::move(server_info)), |
388 started_another_job_(false), | 396 started_another_job_(false), |
389 net_log_(net_log), | 397 net_log_( |
| 398 NetLogWithSource::Make(net_log.net_log(), |
| 399 NetLogSourceType::QUIC_STREAM_FACTORY_JOB)), |
390 num_sent_client_hellos_(0), | 400 num_sent_client_hellos_(0), |
391 session_(nullptr), | 401 session_(nullptr), |
392 weak_factory_(this) {} | 402 weak_factory_(this) { |
| 403 net_log_.BeginEvent( |
| 404 NetLogEventType::QUIC_STREAM_FACTORY_JOB, |
| 405 base::Bind(&NetLogQuicStreamFactoryJobCallback, &key_.server_id())); |
| 406 // Associate |net_log_| with |net_log|. |
| 407 net_log_.AddEvent( |
| 408 NetLogEventType::QUIC_STREAM_FACTORY_JOB_BOUND_TO_HTTP_STREAM_JOB, |
| 409 net_log.source().ToEventParametersCallback()); |
| 410 net_log.AddEvent( |
| 411 NetLogEventType::HTTP_STREAM_JOB_BOUND_TO_QUIC_STREAM_FACTORY_JOB, |
| 412 net_log_.source().ToEventParametersCallback()); |
| 413 } |
393 | 414 |
394 QuicStreamFactory::Job::~Job() { | 415 QuicStreamFactory::Job::~Job() { |
| 416 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB); |
395 DCHECK(callback_.is_null()); | 417 DCHECK(callback_.is_null()); |
396 | 418 |
397 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. | 419 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. |
398 if (server_info_) | 420 if (server_info_) |
399 server_info_->ResetWaitForDataReadyCallback(); | 421 server_info_->ResetWaitForDataReadyCallback(); |
400 } | 422 } |
401 | 423 |
402 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { | 424 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { |
403 int rv = DoLoop(OK); | 425 int rv = DoLoop(OK); |
404 if (rv == ERR_IO_PENDING) | 426 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 | 1907 // Since the session was active, there's no longer an |
1886 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1908 // 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 | 1909 // 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 | 1910 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1889 // still race. | 1911 // still race. |
1890 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1912 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1891 alternative_service); | 1913 alternative_service); |
1892 } | 1914 } |
1893 | 1915 |
1894 } // namespace net | 1916 } // namespace net |
OLD | NEW |