| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/quic_connection_logger.h" | 5 #include "net/quic/quic_connection_logger.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
| 13 #include "net/quic/crypto/crypto_handshake.h" | 13 #include "net/quic/crypto/crypto_handshake.h" |
| 14 | 14 |
| 15 using std::string; |
| 16 |
| 15 namespace net { | 17 namespace net { |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 base::Value* NetLogQuicPacketCallback(const IPEndPoint* self_address, | 21 base::Value* NetLogQuicPacketCallback(const IPEndPoint* self_address, |
| 20 const IPEndPoint* peer_address, | 22 const IPEndPoint* peer_address, |
| 21 size_t packet_size, | 23 size_t packet_size, |
| 22 NetLog::LogLevel /* log_level */) { | 24 NetLog::LogLevel /* log_level */) { |
| 23 base::DictionaryValue* dict = new base::DictionaryValue(); | 25 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 24 dict->SetString("self_address", self_address->ToString()); | 26 dict->SetString("self_address", self_address->ToString()); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); | 411 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); |
| 410 } | 412 } |
| 411 | 413 |
| 412 void QuicConnectionLogger::OnConnectionClose(QuicErrorCode error, | 414 void QuicConnectionLogger::OnConnectionClose(QuicErrorCode error, |
| 413 bool from_peer) { | 415 bool from_peer) { |
| 414 net_log_.AddEvent( | 416 net_log_.AddEvent( |
| 415 NetLog::TYPE_QUIC_SESSION_CLOSED, | 417 NetLog::TYPE_QUIC_SESSION_CLOSED, |
| 416 base::Bind(&NetLogQuicConnectionClosedCallback, error, from_peer)); | 418 base::Bind(&NetLogQuicConnectionClosedCallback, error, from_peer)); |
| 417 } | 419 } |
| 418 | 420 |
| 421 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( |
| 422 const QuicVersion& version) { |
| 423 string quic_version = QuicVersionToString(version); |
| 424 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, |
| 425 NetLog::StringCallback("version", &quic_version)); |
| 426 } |
| 427 |
| 419 } // namespace net | 428 } // namespace net |
| OLD | NEW |