Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: net/quic/core/quic_spdy_session.cc

Issue 2629723003: Revert of Add quic_logging (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_session.cc ('k') | net/quic/core/quic_spdy_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/core/quic_spdy_session.h" 5 #include "net/quic/core/quic_spdy_session.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "net/quic/core/quic_flags.h" 9 #include "net/quic/core/quic_flags.h"
10 #include "net/quic/core/quic_headers_stream.h" 10 #include "net/quic/core/quic_headers_stream.h"
11 #include "net/quic/platform/api/quic_bug_tracker.h" 11 #include "net/quic/platform/api/quic_bug_tracker.h"
12 #include "net/quic/platform/api/quic_logging.h"
13 #include "net/quic/platform/api/quic_str_cat.h" 12 #include "net/quic/platform/api/quic_str_cat.h"
14 13
15 using base::StringPiece; 14 using base::StringPiece;
16 using std::string; 15 using std::string;
17 16
18 namespace net { 17 namespace net {
19 18
20 namespace { 19 namespace {
21 20
22 class HeaderTableDebugVisitor 21 class HeaderTableDebugVisitor
23 : public HpackHeaderTable::DebugVisitorInterface { 22 : public HpackHeaderTable::DebugVisitorInterface {
24 public: 23 public:
25 HeaderTableDebugVisitor(const QuicClock* clock, 24 HeaderTableDebugVisitor(const QuicClock* clock,
26 std::unique_ptr<QuicHpackDebugVisitor> visitor) 25 std::unique_ptr<QuicHpackDebugVisitor> visitor)
27 : clock_(clock), headers_stream_hpack_visitor_(std::move(visitor)) {} 26 : clock_(clock), headers_stream_hpack_visitor_(std::move(visitor)) {}
28 27
29 int64_t OnNewEntry(const HpackEntry& entry) override { 28 int64_t OnNewEntry(const HpackEntry& entry) override {
30 QUIC_DVLOG(1) << entry.GetDebugString(); 29 DVLOG(1) << entry.GetDebugString();
31 return (clock_->ApproximateNow() - QuicTime::Zero()).ToMicroseconds(); 30 return (clock_->ApproximateNow() - QuicTime::Zero()).ToMicroseconds();
32 } 31 }
33 32
34 void OnUseEntry(const HpackEntry& entry) override { 33 void OnUseEntry(const HpackEntry& entry) override {
35 const QuicTime::Delta elapsed( 34 const QuicTime::Delta elapsed(
36 clock_->ApproximateNow() - 35 clock_->ApproximateNow() -
37 QuicTime::Delta::FromMicroseconds(entry.time_added()) - 36 QuicTime::Delta::FromMicroseconds(entry.time_added()) -
38 QuicTime::Zero()); 37 QuicTime::Zero());
39 QUIC_DVLOG(1) << entry.GetDebugString() << " " << elapsed.ToMilliseconds() 38 DVLOG(1) << entry.GetDebugString() << " " << elapsed.ToMilliseconds()
40 << " ms"; 39 << " ms";
41 headers_stream_hpack_visitor_->OnUseEntry(elapsed); 40 headers_stream_hpack_visitor_->OnUseEntry(elapsed);
42 } 41 }
43 42
44 private: 43 private:
45 const QuicClock* clock_; 44 const QuicClock* clock_;
46 std::unique_ptr<QuicHpackDebugVisitor> headers_stream_hpack_visitor_; 45 std::unique_ptr<QuicHpackDebugVisitor> headers_stream_hpack_visitor_;
47 46
48 DISALLOW_COPY_AND_ASSIGN(HeaderTableDebugVisitor); 47 DISALLOW_COPY_AND_ASSIGN(HeaderTableDebugVisitor);
49 }; 48 };
50 49
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // SpdyFramerDebugVisitorInterface implementation 263 // SpdyFramerDebugVisitorInterface implementation
265 void OnSendCompressedFrame(SpdyStreamId stream_id, 264 void OnSendCompressedFrame(SpdyStreamId stream_id,
266 SpdyFrameType type, 265 SpdyFrameType type,
267 size_t payload_len, 266 size_t payload_len,
268 size_t frame_len) override { 267 size_t frame_len) override {
269 if (payload_len == 0) { 268 if (payload_len == 0) {
270 QUIC_BUG << "Zero payload length."; 269 QUIC_BUG << "Zero payload length.";
271 return; 270 return;
272 } 271 }
273 int compression_pct = 100 - (100 * frame_len) / payload_len; 272 int compression_pct = 100 - (100 * frame_len) / payload_len;
274 QUIC_DVLOG(1) << "Net.QuicHpackCompressionPercentage: " << compression_pct; 273 DVLOG(1) << "Net.QuicHpackCompressionPercentage: " << compression_pct;
275 } 274 }
276 275
277 void OnReceiveCompressedFrame(SpdyStreamId stream_id, 276 void OnReceiveCompressedFrame(SpdyStreamId stream_id,
278 SpdyFrameType type, 277 SpdyFrameType type,
279 size_t frame_len) override { 278 size_t frame_len) override {
280 if (session_->IsConnected()) { 279 if (session_->IsConnected()) {
281 session_->OnCompressedFrameSize(frame_len); 280 session_->OnCompressedFrameSize(frame_len);
282 } 281 }
283 } 282 }
284 283
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 const char* data, 588 const char* data,
590 size_t len, 589 size_t len,
591 bool fin) { 590 bool fin) {
592 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); 591 QuicSpdyStream* stream = GetSpdyDataStream(stream_id);
593 if (stream == nullptr) { 592 if (stream == nullptr) {
594 return; 593 return;
595 } 594 }
596 const QuicStreamOffset offset = 595 const QuicStreamOffset offset =
597 stream->flow_controller()->highest_received_byte_offset(); 596 stream->flow_controller()->highest_received_byte_offset();
598 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); 597 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len));
599 QUIC_DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id 598 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id
600 << " offset " << offset << " len " << len << " fin " << fin; 599 << " offset " << offset << " len " << len << " fin " << fin;
601 OnStreamFrame(frame); 600 OnStreamFrame(frame);
602 } 601 }
603 602
604 bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() { 603 bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() {
605 return false; 604 return false;
606 } 605 }
607 606
608 void QuicSpdySession::OnHeaders(SpdyStreamId stream_id, 607 void QuicSpdySession::OnHeaders(SpdyStreamId stream_id,
609 bool has_priority, 608 bool has_priority,
610 SpdyPriority priority, 609 SpdyPriority priority,
(...skipping 21 matching lines...) Expand all
632 void QuicSpdySession::OnPushPromise(SpdyStreamId stream_id, 631 void QuicSpdySession::OnPushPromise(SpdyStreamId stream_id,
633 SpdyStreamId promised_stream_id, 632 SpdyStreamId promised_stream_id,
634 bool end) { 633 bool end) {
635 DCHECK_EQ(kInvalidStreamId, stream_id_); 634 DCHECK_EQ(kInvalidStreamId, stream_id_);
636 DCHECK_EQ(kInvalidStreamId, promised_stream_id_); 635 DCHECK_EQ(kInvalidStreamId, promised_stream_id_);
637 stream_id_ = stream_id; 636 stream_id_ = stream_id;
638 promised_stream_id_ = promised_stream_id; 637 promised_stream_id_ = promised_stream_id;
639 } 638 }
640 639
641 void QuicSpdySession::OnHeaderList(const QuicHeaderList& header_list) { 640 void QuicSpdySession::OnHeaderList(const QuicHeaderList& header_list) {
642 QUIC_DVLOG(1) << "Received header list for stream " << stream_id_ << ": " 641 DVLOG(1) << "Received header list for stream " << stream_id_ << ": "
643 << header_list.DebugString(); 642 << header_list.DebugString();
644 if (prev_max_timestamp_ > cur_max_timestamp_) { 643 if (prev_max_timestamp_ > cur_max_timestamp_) {
645 // prev_max_timestamp_ > cur_max_timestamp_ implies that 644 // prev_max_timestamp_ > cur_max_timestamp_ implies that
646 // headers from lower numbered streams actually came off the 645 // headers from lower numbered streams actually came off the
647 // wire after headers for the current stream, hence there was 646 // wire after headers for the current stream, hence there was
648 // HOL blocking. 647 // HOL blocking.
649 QuicTime::Delta delta = prev_max_timestamp_ - cur_max_timestamp_; 648 QuicTime::Delta delta = prev_max_timestamp_ - cur_max_timestamp_;
650 QUIC_DLOG(INFO) << "stream " << stream_id_ 649 DVLOG(1) << "stream " << stream_id_
651 << ": Net.QuicSession.HeadersHOLBlockedTime " 650 << ": Net.QuicSession.HeadersHOLBlockedTime "
652 << delta.ToMilliseconds(); 651 << delta.ToMilliseconds();
653 OnHeadersHeadOfLineBlocking(delta); 652 OnHeadersHeadOfLineBlocking(delta);
654 } 653 }
655 prev_max_timestamp_ = std::max(prev_max_timestamp_, cur_max_timestamp_); 654 prev_max_timestamp_ = std::max(prev_max_timestamp_, cur_max_timestamp_);
656 cur_max_timestamp_ = QuicTime::Zero(); 655 cur_max_timestamp_ = QuicTime::Zero();
657 if (promised_stream_id_ == kInvalidStreamId) { 656 if (promised_stream_id_ == kInvalidStreamId) {
658 OnStreamHeaderList(stream_id_, fin_, frame_len_, header_list); 657 OnStreamHeaderList(stream_id_, fin_, frame_len_, header_list);
659 } else { 658 } else {
660 OnPromiseHeaderList(stream_id_, promised_stream_id_, frame_len_, 659 OnPromiseHeaderList(stream_id_, promised_stream_id_, frame_len_,
661 header_list); 660 header_list);
662 } 661 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 699
701 bool QuicSpdySession::OnDataFrameHeader(QuicStreamId stream_id, 700 bool QuicSpdySession::OnDataFrameHeader(QuicStreamId stream_id,
702 size_t length, 701 size_t length,
703 bool fin) { 702 bool fin) {
704 if (!force_hol_blocking()) { 703 if (!force_hol_blocking()) {
705 return false; 704 return false;
706 } 705 }
707 if (!IsConnected()) { 706 if (!IsConnected()) {
708 return true; 707 return true;
709 } 708 }
710 QUIC_DVLOG(1) << "DATA frame header for stream " << stream_id << " length " 709 DVLOG(1) << "DATA frame header for stream " << stream_id << " length "
711 << length << " fin " << fin; 710 << length << " fin " << fin;
712 fin_ = fin; 711 fin_ = fin;
713 frame_len_ = length; 712 frame_len_ = length;
714 if (fin && length == 0) { 713 if (fin && length == 0) {
715 OnStreamFrameData(stream_id, "", 0); 714 OnStreamFrameData(stream_id, "", 0);
716 } 715 }
717 return true; 716 return true;
718 } 717 }
719 718
720 bool QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, 719 bool QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id,
721 const char* data, 720 const char* data,
(...skipping 16 matching lines...) Expand all
738 set_max_uncompressed_header_bytes); 737 set_max_uncompressed_header_bytes);
739 } 738 }
740 739
741 void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error, 740 void QuicSpdySession::CloseConnectionWithDetails(QuicErrorCode error,
742 const string& details) { 741 const string& details) {
743 connection()->CloseConnection( 742 connection()->CloseConnection(
744 error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 743 error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
745 } 744 }
746 745
747 } // namespace net 746 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_session.cc ('k') | net/quic/core/quic_spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698