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

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

Issue 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. 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_network_transaction_unittest.cc ('k') | net/sdch/sdch_owner.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 13 matching lines...) Expand all
24 #include "base/threading/thread_task_runner_handle.h" 24 #include "base/threading/thread_task_runner_handle.h"
25 #include "base/trace_event/trace_event.h" 25 #include "base/trace_event/trace_event.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "crypto/openssl_util.h" 27 #include "crypto/openssl_util.h"
28 #include "net/base/ip_address.h" 28 #include "net/base/ip_address.h"
29 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
30 #include "net/cert/cert_verifier.h" 30 #include "net/cert/cert_verifier.h"
31 #include "net/cert/ct_verifier.h" 31 #include "net/cert/ct_verifier.h"
32 #include "net/dns/host_resolver.h" 32 #include "net/dns/host_resolver.h"
33 #include "net/http/bidirectional_stream_impl.h" 33 #include "net/http/bidirectional_stream_impl.h"
34 #include "net/log/net_log_event_type.h"
35 #include "net/log/net_log_source_type.h"
34 #include "net/quic/chromium/bidirectional_stream_quic_impl.h" 36 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
35 #include "net/quic/chromium/crypto/channel_id_chromium.h" 37 #include "net/quic/chromium/crypto/channel_id_chromium.h"
36 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" 38 #include "net/quic/chromium/crypto/proof_verifier_chromium.h"
37 #include "net/quic/chromium/port_suggester.h" 39 #include "net/quic/chromium/port_suggester.h"
38 #include "net/quic/chromium/quic_chromium_alarm_factory.h" 40 #include "net/quic/chromium/quic_chromium_alarm_factory.h"
39 #include "net/quic/chromium/quic_chromium_connection_helper.h" 41 #include "net/quic/chromium/quic_chromium_connection_helper.h"
40 #include "net/quic/chromium/quic_chromium_packet_reader.h" 42 #include "net/quic/chromium/quic_chromium_packet_reader.h"
41 #include "net/quic/chromium/quic_chromium_packet_writer.h" 43 #include "net/quic/chromium/quic_chromium_packet_writer.h"
42 #include "net/quic/core/crypto/proof_verifier.h" 44 #include "net/quic/core/crypto/proof_verifier.h"
43 #include "net/quic/core/crypto/properties_based_quic_server_info.h" 45 #include "net/quic/core/crypto/properties_based_quic_server_info.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 NetLogCaptureMode capture_mode) { 115 NetLogCaptureMode capture_mode) {
114 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 116 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
115 dict->SetString("connection_id", base::Uint64ToString(connection_id)); 117 dict->SetString("connection_id", base::Uint64ToString(connection_id));
116 return std::move(dict); 118 return std::move(dict);
117 } 119 }
118 120
119 // Helper class that is used to log a connection migration event. 121 // Helper class that is used to log a connection migration event.
120 class ScopedConnectionMigrationEventLog { 122 class ScopedConnectionMigrationEventLog {
121 public: 123 public:
122 ScopedConnectionMigrationEventLog(NetLog* net_log, std::string trigger) 124 ScopedConnectionMigrationEventLog(NetLog* net_log, std::string trigger)
123 : net_log_(BoundNetLog::Make(net_log, 125 : net_log_(
124 NetLog::SOURCE_QUIC_CONNECTION_MIGRATION)) { 126 BoundNetLog::Make(net_log,
127 NetLogSourceType::QUIC_CONNECTION_MIGRATION)) {
125 net_log_.BeginEvent( 128 net_log_.BeginEvent(
126 NetLog::TYPE_QUIC_CONNECTION_MIGRATION_TRIGGERED, 129 NetLogEventType::QUIC_CONNECTION_MIGRATION_TRIGGERED,
127 base::Bind(&NetLogQuicConnectionMigrationTriggerCallback, trigger)); 130 base::Bind(&NetLogQuicConnectionMigrationTriggerCallback, trigger));
128 } 131 }
129 132
130 ~ScopedConnectionMigrationEventLog() { 133 ~ScopedConnectionMigrationEventLog() {
131 net_log_.EndEvent(NetLog::TYPE_QUIC_CONNECTION_MIGRATION_TRIGGERED); 134 net_log_.EndEvent(NetLogEventType::QUIC_CONNECTION_MIGRATION_TRIGGERED);
132 } 135 }
133 136
134 const BoundNetLog& net_log() { return net_log_; } 137 const BoundNetLog& net_log() { return net_log_; }
135 138
136 private: 139 private:
137 const BoundNetLog net_log_; 140 const BoundNetLog net_log_;
138 }; 141 };
139 142
140 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { 143 void HistogramCreateSessionFailure(enum CreateSessionFailure error) {
141 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, 144 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error,
142 CREATION_ERROR_MAX); 145 CREATION_ERROR_MAX);
143 } 146 }
144 147
145 void HistogramAndLogMigrationFailure(const BoundNetLog& net_log, 148 void HistogramAndLogMigrationFailure(const BoundNetLog& net_log,
146 enum QuicConnectionMigrationStatus status, 149 enum QuicConnectionMigrationStatus status,
147 QuicConnectionId connection_id, 150 QuicConnectionId connection_id,
148 std::string reason) { 151 std::string reason) {
149 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status, 152 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status,
150 MIGRATION_STATUS_MAX); 153 MIGRATION_STATUS_MAX);
151 net_log.AddEvent(NetLog::TYPE_QUIC_CONNECTION_MIGRATION_FAILURE, 154 net_log.AddEvent(NetLogEventType::QUIC_CONNECTION_MIGRATION_FAILURE,
152 base::Bind(&NetLogQuicConnectionMigrationFailureCallback, 155 base::Bind(&NetLogQuicConnectionMigrationFailureCallback,
153 connection_id, reason)); 156 connection_id, reason));
154 } 157 }
155 158
156 void HistogramMigrationStatus(enum QuicConnectionMigrationStatus status) { 159 void HistogramMigrationStatus(enum QuicConnectionMigrationStatus status) {
157 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status, 160 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status,
158 MIGRATION_STATUS_MAX); 161 MIGRATION_STATUS_MAX);
159 } 162 }
160 163
161 QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options, 164 QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options,
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 bound_net_log, MIGRATION_STATUS_TOO_MANY_CHANGES, 1653 bound_net_log, MIGRATION_STATUS_TOO_MANY_CHANGES,
1651 session->connection_id(), "Too many migrations"); 1654 session->connection_id(), "Too many migrations");
1652 if (close_session_on_error) { 1655 if (close_session_on_error) {
1653 session->CloseSessionOnError(ERR_NETWORK_CHANGED, 1656 session->CloseSessionOnError(ERR_NETWORK_CHANGED,
1654 QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES); 1657 QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES);
1655 } 1658 }
1656 return; 1659 return;
1657 } 1660 }
1658 HistogramMigrationStatus(MIGRATION_STATUS_SUCCESS); 1661 HistogramMigrationStatus(MIGRATION_STATUS_SUCCESS);
1659 bound_net_log.AddEvent( 1662 bound_net_log.AddEvent(
1660 NetLog::TYPE_QUIC_CONNECTION_MIGRATION_SUCCESS, 1663 NetLogEventType::QUIC_CONNECTION_MIGRATION_SUCCESS,
1661 base::Bind(&NetLogQuicConnectionMigrationSuccessCallback, 1664 base::Bind(&NetLogQuicConnectionMigrationSuccessCallback,
1662 session->connection_id())); 1665 session->connection_id()));
1663 } 1666 }
1664 1667
1665 void QuicStreamFactory::OnSSLConfigChanged() { 1668 void QuicStreamFactory::OnSSLConfigChanged() {
1666 CloseAllSessions(ERR_CERT_DATABASE_CHANGED, QUIC_CONNECTION_CANCELLED); 1669 CloseAllSessions(ERR_CERT_DATABASE_CHANGED, QUIC_CONNECTION_CANCELLED);
1667 } 1670 }
1668 1671
1669 void QuicStreamFactory::OnCertAdded(const X509Certificate* cert) { 1672 void QuicStreamFactory::OnCertAdded(const X509Certificate* cert) {
1670 CloseAllSessions(ERR_CERT_DATABASE_CHANGED, QUIC_CONNECTION_CANCELLED); 1673 CloseAllSessions(ERR_CERT_DATABASE_CHANGED, QUIC_CONNECTION_CANCELLED);
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 // Since the session was active, there's no longer an 2056 // Since the session was active, there's no longer an
2054 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 2057 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
2055 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 2058 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
2056 // it as recently broken, which means that 0-RTT will be disabled but we'll 2059 // it as recently broken, which means that 0-RTT will be disabled but we'll
2057 // still race. 2060 // still race.
2058 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 2061 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
2059 alternative_service); 2062 alternative_service);
2060 } 2063 }
2061 2064
2062 } // namespace net 2065 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_network_transaction_unittest.cc ('k') | net/sdch/sdch_owner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698