| 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* NetLogQuicWindowUpdateFrameCallback( |
| 167 const QuicWindowUpdateFrame* frame, |
| 168 NetLog::LogLevel /* log_level */) { |
| 169 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 170 dict->SetInteger("stream_id", frame->stream_id); |
| 171 dict->SetString("byte_offset", base::Uint64ToString(frame->byte_offset)); |
| 172 return dict; |
| 173 } |
| 174 |
| 175 base::Value* NetLogQuicBlockedFrameCallback( |
| 176 const QuicBlockedFrame* frame, |
| 177 NetLog::LogLevel /* log_level */) { |
| 178 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 179 dict->SetInteger("stream_id", frame->stream_id); |
| 180 return dict; |
| 181 } |
| 182 |
| 183 base::Value* NetLogQuicStopWaitingFrameCallback( |
| 184 const QuicStopWaitingFrame* frame, |
| 185 NetLog::LogLevel /* log_level */) { |
| 186 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 187 base::DictionaryValue* sent_info = new base::DictionaryValue(); |
| 188 dict->Set("sent_info", sent_info); |
| 189 sent_info->SetString("least_unacked", |
| 190 base::Uint64ToString(frame->least_unacked)); |
| 191 return dict; |
| 192 } |
| 193 |
| 166 base::Value* NetLogQuicVersionNegotiationPacketCallback( | 194 base::Value* NetLogQuicVersionNegotiationPacketCallback( |
| 167 const QuicVersionNegotiationPacket* packet, | 195 const QuicVersionNegotiationPacket* packet, |
| 168 NetLog::LogLevel /* log_level */) { | 196 NetLog::LogLevel /* log_level */) { |
| 169 base::DictionaryValue* dict = new base::DictionaryValue(); | 197 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 170 base::ListValue* versions = new base::ListValue(); | 198 base::ListValue* versions = new base::ListValue(); |
| 171 dict->Set("versions", versions); | 199 dict->Set("versions", versions); |
| 172 for (QuicVersionVector::const_iterator it = packet->versions.begin(); | 200 for (QuicVersionVector::const_iterator it = packet->versions.begin(); |
| 173 it != packet->versions.end(); ++it) { | 201 it != packet->versions.end(); ++it) { |
| 174 versions->AppendString(QuicVersionToString(*it)); | 202 versions->AppendString(QuicVersionToString(*it)); |
| 175 } | 203 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 frame.rst_stream_frame)); | 292 frame.rst_stream_frame)); |
| 265 break; | 293 break; |
| 266 case CONNECTION_CLOSE_FRAME: | 294 case CONNECTION_CLOSE_FRAME: |
| 267 net_log_.AddEvent( | 295 net_log_.AddEvent( |
| 268 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, | 296 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, |
| 269 base::Bind(&NetLogQuicConnectionCloseFrameCallback, | 297 base::Bind(&NetLogQuicConnectionCloseFrameCallback, |
| 270 frame.connection_close_frame)); | 298 frame.connection_close_frame)); |
| 271 break; | 299 break; |
| 272 case GOAWAY_FRAME: | 300 case GOAWAY_FRAME: |
| 273 break; | 301 break; |
| 302 case WINDOW_UPDATE_FRAME: |
| 303 net_log_.AddEvent( |
| 304 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, |
| 305 base::Bind(&NetLogQuicWindowUpdateFrameCallback, |
| 306 frame.window_update_frame)); |
| 307 break; |
| 308 case BLOCKED_FRAME: |
| 309 net_log_.AddEvent( |
| 310 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT, |
| 311 base::Bind(&NetLogQuicBlockedFrameCallback, |
| 312 frame.blocked_frame)); |
| 313 break; |
| 314 case STOP_WAITING_FRAME: |
| 315 net_log_.AddEvent( |
| 316 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, |
| 317 base::Bind(&NetLogQuicStopWaitingFrameCallback, |
| 318 frame.stop_waiting_frame)); |
| 319 break; |
| 274 default: | 320 default: |
| 275 DCHECK(false) << "Illegal frame type: " << frame.type; | 321 DCHECK(false) << "Illegal frame type: " << frame.type; |
| 276 } | 322 } |
| 277 } | 323 } |
| 278 | 324 |
| 279 void QuicConnectionLogger::OnPacketSent( | 325 void QuicConnectionLogger::OnPacketSent( |
| 280 QuicPacketSequenceNumber sequence_number, | 326 QuicPacketSequenceNumber sequence_number, |
| 281 EncryptionLevel level, | 327 EncryptionLevel level, |
| 282 const QuicEncryptedPacket& packet, | 328 const QuicEncryptedPacket& packet, |
| 283 WriteResult result) { | 329 WriteResult result) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 *missing_packets.rbegin(); | 431 *missing_packets.rbegin(); |
| 386 } | 432 } |
| 387 | 433 |
| 388 void QuicConnectionLogger::OnCongestionFeedbackFrame( | 434 void QuicConnectionLogger::OnCongestionFeedbackFrame( |
| 389 const QuicCongestionFeedbackFrame& frame) { | 435 const QuicCongestionFeedbackFrame& frame) { |
| 390 net_log_.AddEvent( | 436 net_log_.AddEvent( |
| 391 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_RECEIVED, | 437 NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_RECEIVED, |
| 392 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, &frame)); | 438 base::Bind(&NetLogQuicCongestionFeedbackFrameCallback, &frame)); |
| 393 } | 439 } |
| 394 | 440 |
| 441 void QuicConnectionLogger::OnStopWaitingFrame( |
| 442 const QuicStopWaitingFrame& frame) { |
| 443 net_log_.AddEvent( |
| 444 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, |
| 445 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); |
| 446 } |
| 447 |
| 395 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 448 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
| 396 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", | 449 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", |
| 397 frame.error_code); | 450 frame.error_code); |
| 398 net_log_.AddEvent( | 451 net_log_.AddEvent( |
| 399 NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, | 452 NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, |
| 400 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); | 453 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); |
| 401 } | 454 } |
| 402 | 455 |
| 403 void QuicConnectionLogger::OnConnectionCloseFrame( | 456 void QuicConnectionLogger::OnConnectionCloseFrame( |
| 404 const QuicConnectionCloseFrame& frame) { | 457 const QuicConnectionCloseFrame& frame) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 513 } |
| 461 | 514 |
| 462 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( | 515 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( |
| 463 const QuicVersion& version) { | 516 const QuicVersion& version) { |
| 464 string quic_version = QuicVersionToString(version); | 517 string quic_version = QuicVersionToString(version); |
| 465 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, | 518 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, |
| 466 NetLog::StringCallback("version", &quic_version)); | 519 NetLog::StringCallback("version", &quic_version)); |
| 467 } | 520 } |
| 468 | 521 |
| 469 } // namespace net | 522 } // namespace net |
| OLD | NEW |