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 #ifndef NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 5 #ifndef NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
6 #define NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 6 #define NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 | 9 |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "net/base/network_change_notifier.h" | 11 #include "net/base/network_change_notifier.h" |
| 12 #include "net/base/socket_performance_watcher.h" |
12 #include "net/log/net_log.h" | 13 #include "net/log/net_log.h" |
13 #include "net/quic/quic_connection.h" | 14 #include "net/quic/quic_connection.h" |
14 #include "net/quic/quic_protocol.h" | 15 #include "net/quic/quic_protocol.h" |
15 #include "net/quic/quic_spdy_session.h" | 16 #include "net/quic/quic_spdy_session.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 namespace test { | 19 namespace test { |
19 class QuicConnectionLoggerPeer; | 20 class QuicConnectionLoggerPeer; |
20 } // namespace test | 21 } // namespace test |
21 | 22 |
22 class CryptoHandshakeMessage; | 23 class CryptoHandshakeMessage; |
23 class CertVerifyResult; | 24 class CertVerifyResult; |
24 | 25 |
25 // This class is a debug visitor of a QuicConnection which logs | 26 // This class is a debug visitor of a QuicConnection which logs |
26 // events to |net_log|. | 27 // events to |net_log|. |
27 class NET_EXPORT_PRIVATE QuicConnectionLogger | 28 class NET_EXPORT_PRIVATE QuicConnectionLogger |
28 : public QuicConnectionDebugVisitor { | 29 : public QuicConnectionDebugVisitor { |
29 public: | 30 public: |
30 QuicConnectionLogger(QuicSpdySession* session, | 31 QuicConnectionLogger( |
31 const char* const connection_description, | 32 QuicSpdySession* session, |
32 const BoundNetLog& net_log); | 33 const char* const connection_description, |
| 34 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
| 35 const BoundNetLog& net_log); |
33 | 36 |
34 ~QuicConnectionLogger() override; | 37 ~QuicConnectionLogger() override; |
35 | 38 |
36 // QuicPacketGenerator::DebugDelegateInterface | 39 // QuicPacketGenerator::DebugDelegateInterface |
37 void OnFrameAddedToPacket(const QuicFrame& frame) override; | 40 void OnFrameAddedToPacket(const QuicFrame& frame) override; |
38 | 41 |
39 // QuicConnectionDebugVisitorInterface | 42 // QuicConnectionDebugVisitorInterface |
40 void OnPacketSent(const SerializedPacket& serialized_packet, | 43 void OnPacketSent(const SerializedPacket& serialized_packet, |
41 QuicPacketNumber original_packet_number, | 44 QuicPacketNumber original_packet_number, |
42 EncryptionLevel level, | 45 EncryptionLevel level, |
(...skipping 18 matching lines...) Expand all Loading... |
61 void OnBlockedFrame(const QuicBlockedFrame& frame) override; | 64 void OnBlockedFrame(const QuicBlockedFrame& frame) override; |
62 void OnGoAwayFrame(const QuicGoAwayFrame& frame) override; | 65 void OnGoAwayFrame(const QuicGoAwayFrame& frame) override; |
63 void OnPingFrame(const QuicPingFrame& frame) override; | 66 void OnPingFrame(const QuicPingFrame& frame) override; |
64 void OnPublicResetPacket(const QuicPublicResetPacket& packet) override; | 67 void OnPublicResetPacket(const QuicPublicResetPacket& packet) override; |
65 void OnVersionNegotiationPacket( | 68 void OnVersionNegotiationPacket( |
66 const QuicVersionNegotiationPacket& packet) override; | 69 const QuicVersionNegotiationPacket& packet) override; |
67 void OnRevivedPacket(const QuicPacketHeader& revived_header, | 70 void OnRevivedPacket(const QuicPacketHeader& revived_header, |
68 base::StringPiece payload) override; | 71 base::StringPiece payload) override; |
69 void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; | 72 void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; |
70 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override; | 73 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override; |
| 74 void OnRttChanged(QuicTime::Delta rtt) const override; |
71 | 75 |
72 void OnCryptoHandshakeMessageReceived( | 76 void OnCryptoHandshakeMessageReceived( |
73 const CryptoHandshakeMessage& message); | 77 const CryptoHandshakeMessage& message); |
74 void OnCryptoHandshakeMessageSent( | 78 void OnCryptoHandshakeMessageSent( |
75 const CryptoHandshakeMessage& message); | 79 const CryptoHandshakeMessage& message); |
76 void UpdateReceivedFrameCounts(QuicStreamId stream_id, | 80 void UpdateReceivedFrameCounts(QuicStreamId stream_id, |
77 int num_frames_received, | 81 int num_frames_received, |
78 int num_duplicate_frames_received); | 82 int num_duplicate_frames_received); |
79 void OnCertificateVerified(const CertVerifyResult& result); | 83 void OnCertificateVerified(const CertVerifyResult& result); |
80 | 84 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // false means never received. Zero is not a valid packet number, so | 176 // false means never received. Zero is not a valid packet number, so |
173 // that offset is never used, and we'll track 150 packets. | 177 // that offset is never used, and we'll track 150 packets. |
174 std::bitset<151> received_packets_; | 178 std::bitset<151> received_packets_; |
175 // Vector to indicate which of the initial 150 received packets turned out to | 179 // Vector to indicate which of the initial 150 received packets turned out to |
176 // contain solo ACK frames. An element is true iff an ACK frame was in the | 180 // contain solo ACK frames. An element is true iff an ACK frame was in the |
177 // corresponding packet, and there was very little else. | 181 // corresponding packet, and there was very little else. |
178 std::bitset<151> received_acks_; | 182 std::bitset<151> received_acks_; |
179 // The available type of connection (WiFi, 3G, etc.) when connection was first | 183 // The available type of connection (WiFi, 3G, etc.) when connection was first |
180 // used. | 184 // used. |
181 const char* const connection_description_; | 185 const char* const connection_description_; |
| 186 // Receives notifications regarding the performance of the underlying socket |
| 187 // for the QUIC connection. May be null. |
| 188 const scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher_; |
182 | 189 |
183 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); | 190 DISALLOW_COPY_AND_ASSIGN(QuicConnectionLogger); |
184 }; | 191 }; |
185 | 192 |
186 } // namespace net | 193 } // namespace net |
187 | 194 |
188 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ | 195 #endif // NET_QUIC_QUIC_CONNECTION_LOGGER_H_ |
OLD | NEW |