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/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 | 156 |
157 base::Value* NetLogQuicConnectionCloseFrameCallback( | 157 base::Value* NetLogQuicConnectionCloseFrameCallback( |
158 const QuicConnectionCloseFrame* frame, | 158 const QuicConnectionCloseFrame* frame, |
159 NetLog::LogLevel /* log_level */) { | 159 NetLog::LogLevel /* log_level */) { |
160 base::DictionaryValue* dict = new base::DictionaryValue(); | 160 base::DictionaryValue* dict = new base::DictionaryValue(); |
161 dict->SetInteger("quic_error", frame->error_code); | 161 dict->SetInteger("quic_error", frame->error_code); |
162 dict->SetString("details", frame->error_details); | 162 dict->SetString("details", frame->error_details); |
163 return dict; | 163 return dict; |
164 } | 164 } |
165 | 165 |
166 base::Value* NetLogQuicStopWaitingFrameCallback( | |
167 const QuicStopWaitingFrame* frame, | |
168 NetLog::LogLevel /* log_level */) { | |
169 base::DictionaryValue* dict = new base::DictionaryValue(); | |
170 base::DictionaryValue* sent_info = new base::DictionaryValue(); | |
171 dict->Set("sent_info", sent_info); | |
172 sent_info->SetString("least_unacked", | |
173 base::Uint64ToString(frame->least_unacked)); | |
174 return dict; | |
175 } | |
176 | |
166 base::Value* NetLogQuicVersionNegotiationPacketCallback( | 177 base::Value* NetLogQuicVersionNegotiationPacketCallback( |
167 const QuicVersionNegotiationPacket* packet, | 178 const QuicVersionNegotiationPacket* packet, |
168 NetLog::LogLevel /* log_level */) { | 179 NetLog::LogLevel /* log_level */) { |
169 base::DictionaryValue* dict = new base::DictionaryValue(); | 180 base::DictionaryValue* dict = new base::DictionaryValue(); |
170 base::ListValue* versions = new base::ListValue(); | 181 base::ListValue* versions = new base::ListValue(); |
171 dict->Set("versions", versions); | 182 dict->Set("versions", versions); |
172 for (QuicVersionVector::const_iterator it = packet->versions.begin(); | 183 for (QuicVersionVector::const_iterator it = packet->versions.begin(); |
173 it != packet->versions.end(); ++it) { | 184 it != packet->versions.end(); ++it) { |
174 versions->AppendString(QuicVersionToString(*it)); | 185 versions->AppendString(QuicVersionToString(*it)); |
175 } | 186 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 frame.rst_stream_frame)); | 275 frame.rst_stream_frame)); |
265 break; | 276 break; |
266 case CONNECTION_CLOSE_FRAME: | 277 case CONNECTION_CLOSE_FRAME: |
267 net_log_.AddEvent( | 278 net_log_.AddEvent( |
268 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, | 279 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, |
269 base::Bind(&NetLogQuicConnectionCloseFrameCallback, | 280 base::Bind(&NetLogQuicConnectionCloseFrameCallback, |
270 frame.connection_close_frame)); | 281 frame.connection_close_frame)); |
271 break; | 282 break; |
272 case GOAWAY_FRAME: | 283 case GOAWAY_FRAME: |
273 break; | 284 break; |
285 case WINDOW_UPDATE_FRAME: | |
286 // TODO(rtenneti): Implement logging of WINDOW_UPDATE_FRAME. | |
287 break; | |
Ryan Hamilton
2014/02/26 00:25:20
Up to you, but I'd consider implementing these now
ramant (doing other things)
2014/02/26 00:50:49
Done.
| |
288 case BLOCKED_FRAME: | |
289 // TODO(rtenneti): Implement logging of BLOCKED_FRAME. | |
290 break; | |
291 case STOP_WAITING_FRAME: | |
292 net_log_.AddEvent( | |
293 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, | |
294 base::Bind(&NetLogQuicStopWaitingFrameCallback, | |
295 frame.stop_waiting_frame)); | |
296 break; | |
274 default: | 297 default: |
275 DCHECK(false) << "Illegal frame type: " << frame.type; | 298 DCHECK(false) << "Illegal frame type: " << frame.type; |
276 } | 299 } |
277 } | 300 } |
278 | 301 |
279 void QuicConnectionLogger::OnPacketSent( | 302 void QuicConnectionLogger::OnPacketSent( |
280 QuicPacketSequenceNumber sequence_number, | 303 QuicPacketSequenceNumber sequence_number, |
281 EncryptionLevel level, | 304 EncryptionLevel level, |
282 const QuicEncryptedPacket& packet, | 305 const QuicEncryptedPacket& packet, |
283 WriteResult result) { | 306 WriteResult result) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 *missing_packets.rbegin(); | 408 *missing_packets.rbegin(); |
386 } | 409 } |
387 | 410 |
388 void QuicConnectionLogger::OnCongestionFeedbackFrame( | 411 void QuicConnectionLogger::OnCongestionFeedbackFrame( |
389 const QuicCongestionFeedbackFrame& frame) { | 412 const QuicCongestionFeedbackFrame& frame) { |
390 net_log_.AddEvent( | 413 net_log_.AddEvent( |
391 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_RECEIVED, | 414 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_RECEIVED, |
392 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, &frame)); | 415 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, &frame)); |
393 } | 416 } |
394 | 417 |
418 void QuicConnectionLogger::OnStopWaitingFrame( | |
419 const QuicStopWaitingFrame& frame) { | |
420 net_log_.AddEvent( | |
421 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, | |
422 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); | |
423 } | |
424 | |
395 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 425 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
396 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", | 426 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", |
397 frame.error_code); | 427 frame.error_code); |
398 net_log_.AddEvent( | 428 net_log_.AddEvent( |
399 NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, | 429 NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, |
400 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); | 430 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); |
401 } | 431 } |
402 | 432 |
403 void QuicConnectionLogger::OnConnectionCloseFrame( | 433 void QuicConnectionLogger::OnConnectionCloseFrame( |
404 const QuicConnectionCloseFrame& frame) { | 434 const QuicConnectionCloseFrame& frame) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 } | 490 } |
461 | 491 |
462 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( | 492 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( |
463 const QuicVersion& version) { | 493 const QuicVersion& version) { |
464 string quic_version = QuicVersionToString(version); | 494 string quic_version = QuicVersionToString(version); |
465 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, | 495 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, |
466 NetLog::StringCallback("version", &quic_version)); | 496 NetLog::StringCallback("version", &quic_version)); |
467 } | 497 } |
468 | 498 |
469 } // namespace net | 499 } // namespace net |
OLD | NEW |