| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 base::Value* NetLogQuicBlockedFrameCallback( | 190 base::Value* NetLogQuicBlockedFrameCallback( |
| 191 const QuicBlockedFrame* frame, | 191 const QuicBlockedFrame* frame, |
| 192 NetLog::LogLevel /* log_level */) { | 192 NetLog::LogLevel /* log_level */) { |
| 193 base::DictionaryValue* dict = new base::DictionaryValue(); | 193 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 194 dict->SetInteger("stream_id", frame->stream_id); | 194 dict->SetInteger("stream_id", frame->stream_id); |
| 195 return dict; | 195 return dict; |
| 196 } | 196 } |
| 197 | 197 |
| 198 base::Value* NetLogQuicGoAwayFrameCallback( |
| 199 const QuicGoAwayFrame* frame, |
| 200 NetLog::LogLevel /* log_level */) { |
| 201 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 202 dict->SetInteger("quic_error", frame->error_code); |
| 203 dict->SetInteger("last_good_stream_id", frame->last_good_stream_id); |
| 204 dict->SetString("reason_phrase", frame->reason_phrase); |
| 205 return dict; |
| 206 } |
| 207 |
| 198 base::Value* NetLogQuicStopWaitingFrameCallback( | 208 base::Value* NetLogQuicStopWaitingFrameCallback( |
| 199 const QuicStopWaitingFrame* frame, | 209 const QuicStopWaitingFrame* frame, |
| 200 NetLog::LogLevel /* log_level */) { | 210 NetLog::LogLevel /* log_level */) { |
| 201 base::DictionaryValue* dict = new base::DictionaryValue(); | 211 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 202 base::DictionaryValue* sent_info = new base::DictionaryValue(); | 212 base::DictionaryValue* sent_info = new base::DictionaryValue(); |
| 203 dict->Set("sent_info", sent_info); | 213 dict->Set("sent_info", sent_info); |
| 204 sent_info->SetString("least_unacked", | 214 sent_info->SetString("least_unacked", |
| 205 base::Uint64ToString(frame->least_unacked)); | 215 base::Uint64ToString(frame->least_unacked)); |
| 206 return dict; | 216 return dict; |
| 207 } | 217 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 base::Bind(&NetLogQuicRstStreamFrameCallback, | 389 base::Bind(&NetLogQuicRstStreamFrameCallback, |
| 380 frame.rst_stream_frame)); | 390 frame.rst_stream_frame)); |
| 381 break; | 391 break; |
| 382 case CONNECTION_CLOSE_FRAME: | 392 case CONNECTION_CLOSE_FRAME: |
| 383 net_log_.AddEvent( | 393 net_log_.AddEvent( |
| 384 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, | 394 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, |
| 385 base::Bind(&NetLogQuicConnectionCloseFrameCallback, | 395 base::Bind(&NetLogQuicConnectionCloseFrameCallback, |
| 386 frame.connection_close_frame)); | 396 frame.connection_close_frame)); |
| 387 break; | 397 break; |
| 388 case GOAWAY_FRAME: | 398 case GOAWAY_FRAME: |
| 399 net_log_.AddEvent( |
| 400 NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_SENT, |
| 401 base::Bind(&NetLogQuicGoAwayFrameCallback, |
| 402 frame.goaway_frame)); |
| 389 break; | 403 break; |
| 390 case WINDOW_UPDATE_FRAME: | 404 case WINDOW_UPDATE_FRAME: |
| 391 net_log_.AddEvent( | 405 net_log_.AddEvent( |
| 392 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, | 406 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, |
| 393 base::Bind(&NetLogQuicWindowUpdateFrameCallback, | 407 base::Bind(&NetLogQuicWindowUpdateFrameCallback, |
| 394 frame.window_update_frame)); | 408 frame.window_update_frame)); |
| 395 break; | 409 break; |
| 396 case BLOCKED_FRAME: | 410 case BLOCKED_FRAME: |
| 397 net_log_.AddEvent( | 411 net_log_.AddEvent( |
| 398 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT, | 412 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT, |
| 399 base::Bind(&NetLogQuicBlockedFrameCallback, | 413 base::Bind(&NetLogQuicBlockedFrameCallback, |
| 400 frame.blocked_frame)); | 414 frame.blocked_frame)); |
| 401 break; | 415 break; |
| 402 case STOP_WAITING_FRAME: | 416 case STOP_WAITING_FRAME: |
| 403 net_log_.AddEvent( | 417 net_log_.AddEvent( |
| 404 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, | 418 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, |
| 405 base::Bind(&NetLogQuicStopWaitingFrameCallback, | 419 base::Bind(&NetLogQuicStopWaitingFrameCallback, |
| 406 frame.stop_waiting_frame)); | 420 frame.stop_waiting_frame)); |
| 407 break; | 421 break; |
| 422 case PING_FRAME: |
| 423 // PingFrame has no contents to log, so just record that it was sent. |
| 424 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_SENT); |
| 425 break; |
| 408 default: | 426 default: |
| 409 DCHECK(false) << "Illegal frame type: " << frame.type; | 427 DCHECK(false) << "Illegal frame type: " << frame.type; |
| 410 } | 428 } |
| 411 } | 429 } |
| 412 | 430 |
| 413 void QuicConnectionLogger::OnPacketSent( | 431 void QuicConnectionLogger::OnPacketSent( |
| 414 QuicPacketSequenceNumber sequence_number, | 432 QuicPacketSequenceNumber sequence_number, |
| 415 EncryptionLevel level, | 433 EncryptionLevel level, |
| 416 TransmissionType transmission_type, | 434 TransmissionType transmission_type, |
| 417 const QuicEncryptedPacket& packet, | 435 const QuicEncryptedPacket& packet, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, | 589 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, |
| 572 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); | 590 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); |
| 573 } | 591 } |
| 574 | 592 |
| 575 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { | 593 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { |
| 576 net_log_.AddEvent( | 594 net_log_.AddEvent( |
| 577 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED, | 595 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED, |
| 578 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); | 596 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); |
| 579 } | 597 } |
| 580 | 598 |
| 599 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { |
| 600 net_log_.AddEvent( |
| 601 NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED, |
| 602 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); |
| 603 } |
| 604 |
| 605 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { |
| 606 // PingFrame has no contents to log, so just record that it was received. |
| 607 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_RECEIVED); |
| 608 } |
| 609 |
| 581 void QuicConnectionLogger::OnPublicResetPacket( | 610 void QuicConnectionLogger::OnPublicResetPacket( |
| 582 const QuicPublicResetPacket& packet) { | 611 const QuicPublicResetPacket& packet) { |
| 583 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); | 612 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); |
| 584 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, | 613 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, |
| 585 packet.client_address); | 614 packet.client_address); |
| 586 } | 615 } |
| 587 | 616 |
| 588 void QuicConnectionLogger::OnVersionNegotiationPacket( | 617 void QuicConnectionLogger::OnVersionNegotiationPacket( |
| 589 const QuicVersionNegotiationPacket& packet) { | 618 const QuicVersionNegotiationPacket& packet) { |
| 590 net_log_.AddEvent( | 619 net_log_.AddEvent( |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 continue; | 832 continue; |
| 804 } | 833 } |
| 805 // Record some overlapping patterns, to get a better picture, since this is | 834 // Record some overlapping patterns, to get a better picture, since this is |
| 806 // not very expensive. | 835 // not very expensive. |
| 807 if (i % 3 == 0) | 836 if (i % 3 == 0) |
| 808 six_packet_histogram->Add(recent_6_mask); | 837 six_packet_histogram->Add(recent_6_mask); |
| 809 } | 838 } |
| 810 } | 839 } |
| 811 | 840 |
| 812 } // namespace net | 841 } // namespace net |
| OLD | NEW |