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 std::string server_id = key_.server_id().ToString(); | |
eroman
2017/04/07 19:16:40
Delete this.
Zhongyi Shi
2017/04/07 20:33:56
Whoops, forgot to delete this.
| |
404 net_log_.BeginEvent( | |
405 NetLogEventType::QUIC_STREAM_FACTORY_JOB, | |
406 base::Bind(&NetLogQuicStreamFactoryJobCallback, key_.server_id())); | |
eroman
2017/04/07 19:16:40
This is still making a copy of the server ID (just
Zhongyi Shi
2017/04/07 20:33:56
Done.
| |
407 // Associate |net_log_| with |net_log|. | |
408 net_log_.AddEvent( | |
409 NetLogEventType::QUIC_STREAM_FACTORY_JOB_BOUND_TO_HTTP_STREAM_JOB, | |
410 net_log.source().ToEventParametersCallback()); | |
411 net_log.AddEvent( | |
412 NetLogEventType::HTTP_STREAM_JOB_BOUND_TO_QUIC_STREAM_FACTORY_JOB, | |
413 net_log_.source().ToEventParametersCallback()); | |
414 } | |
393 | 415 |
394 QuicStreamFactory::Job::~Job() { | 416 QuicStreamFactory::Job::~Job() { |
417 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB); | |
395 DCHECK(callback_.is_null()); | 418 DCHECK(callback_.is_null()); |
396 | 419 |
397 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. | 420 // If disk cache has a pending WaitForDataReadyCallback, cancel that callback. |
398 if (server_info_) | 421 if (server_info_) |
399 server_info_->ResetWaitForDataReadyCallback(); | 422 server_info_->ResetWaitForDataReadyCallback(); |
400 } | 423 } |
401 | 424 |
402 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { | 425 int QuicStreamFactory::Job::Run(const CompletionCallback& callback) { |
403 int rv = DoLoop(OK); | 426 int rv = DoLoop(OK); |
404 if (rv == ERR_IO_PENDING) | 427 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 | 1908 // Since the session was active, there's no longer an |
1886 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1909 // 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 | 1910 // 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 | 1911 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1889 // still race. | 1912 // still race. |
1890 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1913 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1891 alternative_service); | 1914 alternative_service); |
1892 } | 1915 } |
1893 | 1916 |
1894 } // namespace net | 1917 } // namespace net |
OLD | NEW |