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

Side by Side Diff: net/quic/quic_protocol.cc

Issue 1421853006: Landing Recent QUIC changes until: Fri Oct 30 22:23:58 2015 +0000 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 5 years, 1 month 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/quic_protocol.h ('k') | net/quic/quic_received_packet_manager.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_protocol.h" 5 #include "net/quic/quic_protocol.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "net/quic/quic_utils.h" 9 #include "net/quic/quic_utils.h"
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 QuicTag QuicVersionToQuicTag(const QuicVersion version) { 135 QuicTag QuicVersionToQuicTag(const QuicVersion version) {
136 switch (version) { 136 switch (version) {
137 case QUIC_VERSION_25: 137 case QUIC_VERSION_25:
138 return MakeQuicTag('Q', '0', '2', '5'); 138 return MakeQuicTag('Q', '0', '2', '5');
139 case QUIC_VERSION_26: 139 case QUIC_VERSION_26:
140 return MakeQuicTag('Q', '0', '2', '6'); 140 return MakeQuicTag('Q', '0', '2', '6');
141 case QUIC_VERSION_27: 141 case QUIC_VERSION_27:
142 return MakeQuicTag('Q', '0', '2', '7'); 142 return MakeQuicTag('Q', '0', '2', '7');
143 case QUIC_VERSION_28: 143 case QUIC_VERSION_28:
144 return MakeQuicTag('Q', '0', '2', '8'); 144 return MakeQuicTag('Q', '0', '2', '8');
145 case QUIC_VERSION_29:
146 return MakeQuicTag('Q', '0', '2', '9');
147 case QUIC_VERSION_30:
148 return MakeQuicTag('Q', '0', '3', '0');
145 default: 149 default:
146 // This shold be an ERROR because we should never attempt to convert an 150 // This shold be an ERROR because we should never attempt to convert an
147 // invalid QuicVersion to be written to the wire. 151 // invalid QuicVersion to be written to the wire.
148 LOG(ERROR) << "Unsupported QuicVersion: " << version; 152 LOG(ERROR) << "Unsupported QuicVersion: " << version;
149 return 0; 153 return 0;
150 } 154 }
151 } 155 }
152 156
153 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { 157 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
154 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 158 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
(...skipping 10 matching lines...) Expand all
165 #define RETURN_STRING_LITERAL(x) \ 169 #define RETURN_STRING_LITERAL(x) \
166 case x: \ 170 case x: \
167 return #x 171 return #x
168 172
169 string QuicVersionToString(const QuicVersion version) { 173 string QuicVersionToString(const QuicVersion version) {
170 switch (version) { 174 switch (version) {
171 RETURN_STRING_LITERAL(QUIC_VERSION_25); 175 RETURN_STRING_LITERAL(QUIC_VERSION_25);
172 RETURN_STRING_LITERAL(QUIC_VERSION_26); 176 RETURN_STRING_LITERAL(QUIC_VERSION_26);
173 RETURN_STRING_LITERAL(QUIC_VERSION_27); 177 RETURN_STRING_LITERAL(QUIC_VERSION_27);
174 RETURN_STRING_LITERAL(QUIC_VERSION_28); 178 RETURN_STRING_LITERAL(QUIC_VERSION_28);
179 RETURN_STRING_LITERAL(QUIC_VERSION_29);
180 RETURN_STRING_LITERAL(QUIC_VERSION_30);
175 default: 181 default:
176 return "QUIC_VERSION_UNSUPPORTED"; 182 return "QUIC_VERSION_UNSUPPORTED";
177 } 183 }
178 } 184 }
179 185
180 string QuicVersionVectorToString(const QuicVersionVector& versions) { 186 string QuicVersionVectorToString(const QuicVersionVector& versions) {
181 string result = ""; 187 string result = "";
182 for (size_t i = 0; i < versions.size(); ++i) { 188 for (size_t i = 0; i < versions.size(); ++i) {
183 if (i != 0) { 189 if (i != 0) {
184 result.append(","); 190 result.append(",");
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 : entropy_hash(0), 234 : entropy_hash(0),
229 least_unacked(0) { 235 least_unacked(0) {
230 } 236 }
231 237
232 QuicStopWaitingFrame::~QuicStopWaitingFrame() {} 238 QuicStopWaitingFrame::~QuicStopWaitingFrame() {}
233 239
234 QuicAckFrame::QuicAckFrame() 240 QuicAckFrame::QuicAckFrame()
235 : entropy_hash(0), 241 : entropy_hash(0),
236 is_truncated(false), 242 is_truncated(false),
237 largest_observed(0), 243 largest_observed(0),
238 delta_time_largest_observed(QuicTime::Delta::Infinite()) {} 244 delta_time_largest_observed(QuicTime::Delta::Infinite()),
245 latest_revived_packet(0) {}
239 246
240 QuicAckFrame::~QuicAckFrame() {} 247 QuicAckFrame::~QuicAckFrame() {}
241 248
242 QuicRstStreamErrorCode AdjustErrorForVersion(QuicRstStreamErrorCode error_code, 249 QuicRstStreamErrorCode AdjustErrorForVersion(QuicRstStreamErrorCode error_code,
243 QuicVersion /*version*/) { 250 QuicVersion /*version*/) {
244 return error_code; 251 return error_code;
245 } 252 }
246 253
247 QuicRstStreamFrame::QuicRstStreamFrame() 254 QuicRstStreamFrame::QuicRstStreamFrame()
248 : stream_id(0), error_code(QUIC_STREAM_NO_ERROR), byte_offset(0) {} 255 : stream_id(0), error_code(QUIC_STREAM_NO_ERROR), byte_offset(0) {}
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 468 }
462 return os; 469 return os;
463 } 470 }
464 471
465 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) { 472 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) {
466 os << "entropy_hash: " << static_cast<int>(ack_frame.entropy_hash) 473 os << "entropy_hash: " << static_cast<int>(ack_frame.entropy_hash)
467 << " largest_observed: " << ack_frame.largest_observed 474 << " largest_observed: " << ack_frame.largest_observed
468 << " delta_time_largest_observed: " 475 << " delta_time_largest_observed: "
469 << ack_frame.delta_time_largest_observed.ToMicroseconds() 476 << ack_frame.delta_time_largest_observed.ToMicroseconds()
470 << " missing_packets: [ " << ack_frame.missing_packets 477 << " missing_packets: [ " << ack_frame.missing_packets
471 << " ] is_truncated: " << ack_frame.is_truncated; 478 << " ] is_truncated: " << ack_frame.is_truncated
472 os << " revived_packets: [ "; 479 << " revived_packet: " << ack_frame.latest_revived_packet
473 for (PacketNumberSet::const_iterator it = ack_frame.revived_packets.begin(); 480 << " received_packets: [ ";
474 it != ack_frame.revived_packets.end(); ++it) {
475 os << *it << " ";
476 }
477 os << " ] received_packets: [ ";
478 for (const std::pair<QuicPacketNumber, QuicTime>& p : 481 for (const std::pair<QuicPacketNumber, QuicTime>& p :
479 ack_frame.received_packet_times) { 482 ack_frame.received_packet_times) {
480 os << p.first << " at " << p.second.ToDebuggingValue() << " "; 483 os << p.first << " at " << p.second.ToDebuggingValue() << " ";
481 } 484 }
482 os << " ]"; 485 os << " ]";
483 return os; 486 return os;
484 } 487 }
485 488
486 ostream& operator<<(ostream& os, const QuicFrame& frame) { 489 ostream& operator<<(ostream& os, const QuicFrame& frame) {
487 switch (frame.type) { 490 switch (frame.type) {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 bool has_stop_waiting) 771 bool has_stop_waiting)
769 : packet(packet), 772 : packet(packet),
770 retransmittable_frames(retransmittable_frames), 773 retransmittable_frames(retransmittable_frames),
771 packet_number(packet_number), 774 packet_number(packet_number),
772 packet_number_length(packet_number_length), 775 packet_number_length(packet_number_length),
773 entropy_hash(entropy_hash), 776 entropy_hash(entropy_hash),
774 is_fec_packet(false), 777 is_fec_packet(false),
775 has_ack(has_ack), 778 has_ack(has_ack),
776 has_stop_waiting(has_stop_waiting) {} 779 has_stop_waiting(has_stop_waiting) {}
777 780
781 SerializedPacket::SerializedPacket(
782 QuicPacketNumber packet_number,
783 QuicPacketNumberLength packet_number_length,
784 char* encrypted_buffer,
785 size_t encrypted_length,
786 bool owns_buffer,
787 QuicPacketEntropyHash entropy_hash,
788 RetransmittableFrames* retransmittable_frames,
789 bool has_ack,
790 bool has_stop_waiting)
791 : SerializedPacket(packet_number,
792 packet_number_length,
793 new QuicEncryptedPacket(encrypted_buffer,
794 encrypted_length,
795 owns_buffer),
796 entropy_hash,
797 retransmittable_frames,
798 has_ack,
799 has_stop_waiting) {}
800
778 SerializedPacket::~SerializedPacket() {} 801 SerializedPacket::~SerializedPacket() {}
779 802
780 QuicEncryptedPacket* QuicEncryptedPacket::Clone() const { 803 QuicEncryptedPacket* QuicEncryptedPacket::Clone() const {
781 char* buffer = new char[this->length()]; 804 char* buffer = new char[this->length()];
782 memcpy(buffer, this->data(), this->length()); 805 memcpy(buffer, this->data(), this->length());
783 return new QuicEncryptedPacket(buffer, this->length(), true); 806 return new QuicEncryptedPacket(buffer, this->length(), true);
784 } 807 }
785 808
786 ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) { 809 ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) {
787 os << s.length() << "-byte data"; 810 os << s.length() << "-byte data";
(...skipping 26 matching lines...) Expand all
814 sent_time(sent_time), 837 sent_time(sent_time),
815 transmission_type(transmission_type), 838 transmission_type(transmission_type),
816 in_flight(false), 839 in_flight(false),
817 is_unackable(false), 840 is_unackable(false),
818 is_fec_packet(is_fec_packet), 841 is_fec_packet(is_fec_packet),
819 all_transmissions(nullptr) {} 842 all_transmissions(nullptr) {}
820 843
821 TransmissionInfo::~TransmissionInfo() {} 844 TransmissionInfo::~TransmissionInfo() {}
822 845
823 } // namespace net 846 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_received_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698