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

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

Issue 1979743002: Rename the QUIC stream frame fields frame_buffer and frame_length to data_buffer and data_length be… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121700577
Patch Set: Created 4 years, 7 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/quic_connection_test.cc ('k') | net/quic/quic_framer_test.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_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 if (!reader->ReadStringPiece16(&data)) { 1369 if (!reader->ReadStringPiece16(&data)) {
1370 set_detailed_error("Unable to read frame data."); 1370 set_detailed_error("Unable to read frame data.");
1371 return false; 1371 return false;
1372 } 1372 }
1373 } else { 1373 } else {
1374 if (!reader->ReadStringPiece(&data, reader->BytesRemaining())) { 1374 if (!reader->ReadStringPiece(&data, reader->BytesRemaining())) {
1375 set_detailed_error("Unable to read frame data."); 1375 set_detailed_error("Unable to read frame data.");
1376 return false; 1376 return false;
1377 } 1377 }
1378 } 1378 }
1379 frame->frame_buffer = data.data(); 1379 frame->data_buffer = data.data();
1380 frame->frame_length = static_cast<uint16_t>(data.length()); 1380 frame->data_length = static_cast<uint16_t>(data.length());
1381 1381
1382 return true; 1382 return true;
1383 } 1383 }
1384 1384
1385 bool QuicFramer::ProcessAckFrame(QuicDataReader* reader, 1385 bool QuicFramer::ProcessAckFrame(QuicDataReader* reader,
1386 uint8_t frame_type, 1386 uint8_t frame_type,
1387 QuicAckFrame* ack_frame) { 1387 QuicAckFrame* ack_frame) {
1388 // Determine the three lengths from the frame type: largest observed length, 1388 // Determine the three lengths from the frame type: largest observed length,
1389 // missing packet number length, and missing range length. 1389 // missing packet number length, and missing range length.
1390 const QuicPacketNumberLength missing_packet_number_length = 1390 const QuicPacketNumberLength missing_packet_number_length =
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 1995
1996 size_t QuicFramer::ComputeFrameLength( 1996 size_t QuicFramer::ComputeFrameLength(
1997 const QuicFrame& frame, 1997 const QuicFrame& frame,
1998 bool last_frame_in_packet, 1998 bool last_frame_in_packet,
1999 QuicPacketNumberLength packet_number_length) { 1999 QuicPacketNumberLength packet_number_length) {
2000 switch (frame.type) { 2000 switch (frame.type) {
2001 case STREAM_FRAME: 2001 case STREAM_FRAME:
2002 return GetMinStreamFrameSize(frame.stream_frame->stream_id, 2002 return GetMinStreamFrameSize(frame.stream_frame->stream_id,
2003 frame.stream_frame->offset, 2003 frame.stream_frame->offset,
2004 last_frame_in_packet) + 2004 last_frame_in_packet) +
2005 frame.stream_frame->frame_length; 2005 frame.stream_frame->data_length;
2006 case ACK_FRAME: { 2006 case ACK_FRAME: {
2007 return GetAckFrameSize(*frame.ack_frame, packet_number_length); 2007 return GetAckFrameSize(*frame.ack_frame, packet_number_length);
2008 } 2008 }
2009 case STOP_WAITING_FRAME: 2009 case STOP_WAITING_FRAME:
2010 return GetStopWaitingFrameSize(quic_version_, packet_number_length); 2010 return GetStopWaitingFrameSize(quic_version_, packet_number_length);
2011 case MTU_DISCOVERY_FRAME: 2011 case MTU_DISCOVERY_FRAME:
2012 // MTU discovery frames are serialized as ping frames. 2012 // MTU discovery frames are serialized as ping frames.
2013 case PING_FRAME: 2013 case PING_FRAME:
2014 // Ping has no payload. 2014 // Ping has no payload.
2015 return kQuicFrameTypeSize; 2015 return kQuicFrameTypeSize;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 QuicDataWriter* writer) { 2115 QuicDataWriter* writer) {
2116 if (!writer->WriteBytes(&frame.stream_id, GetStreamIdSize(frame.stream_id))) { 2116 if (!writer->WriteBytes(&frame.stream_id, GetStreamIdSize(frame.stream_id))) {
2117 QUIC_BUG << "Writing stream id size failed."; 2117 QUIC_BUG << "Writing stream id size failed.";
2118 return false; 2118 return false;
2119 } 2119 }
2120 if (!writer->WriteBytes(&frame.offset, GetStreamOffsetSize(frame.offset))) { 2120 if (!writer->WriteBytes(&frame.offset, GetStreamOffsetSize(frame.offset))) {
2121 QUIC_BUG << "Writing offset size failed."; 2121 QUIC_BUG << "Writing offset size failed.";
2122 return false; 2122 return false;
2123 } 2123 }
2124 if (!no_stream_frame_length) { 2124 if (!no_stream_frame_length) {
2125 if ((frame.frame_length > numeric_limits<uint16_t>::max()) || 2125 if ((frame.data_length > numeric_limits<uint16_t>::max()) ||
2126 !writer->WriteUInt16(static_cast<uint16_t>(frame.frame_length))) { 2126 !writer->WriteUInt16(static_cast<uint16_t>(frame.data_length))) {
2127 QUIC_BUG << "Writing stream frame length failed"; 2127 QUIC_BUG << "Writing stream frame length failed";
2128 return false; 2128 return false;
2129 } 2129 }
2130 } 2130 }
2131 2131
2132 if (!writer->WriteBytes(frame.frame_buffer, frame.frame_length)) { 2132 if (!writer->WriteBytes(frame.data_buffer, frame.data_length)) {
2133 QUIC_BUG << "Writing frame data failed."; 2133 QUIC_BUG << "Writing frame data failed.";
2134 return false; 2134 return false;
2135 } 2135 }
2136 return true; 2136 return true;
2137 } 2137 }
2138 2138
2139 void QuicFramer::set_version(const QuicVersion version) { 2139 void QuicFramer::set_version(const QuicVersion version) {
2140 DCHECK(IsSupportedVersion(version)) << QuicVersionToString(version); 2140 DCHECK(IsSupportedVersion(version)) << QuicVersionToString(version);
2141 quic_version_ = version; 2141 quic_version_ = version;
2142 } 2142 }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 2563
2564 bool QuicFramer::RaiseError(QuicErrorCode error) { 2564 bool QuicFramer::RaiseError(QuicErrorCode error) {
2565 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) 2565 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error)
2566 << " detail: " << detailed_error_; 2566 << " detail: " << detailed_error_;
2567 set_error(error); 2567 set_error(error);
2568 visitor_->OnError(this); 2568 visitor_->OnError(this);
2569 return false; 2569 return false;
2570 } 2570 }
2571 2571
2572 } // namespace net 2572 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698