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

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

Issue 2192633002: Switch to PacketNumberQueue interval iteration and avoid allocations in new ACK frame generation. G… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@128431128
Patch Set: Rebase Created 4 years, 4 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_flags.cc ('k') | net/quic/quic_framer.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 #ifndef NET_QUIC_QUIC_FRAMER_H_ 5 #ifndef NET_QUIC_QUIC_FRAMER_H_
6 #define NET_QUIC_QUIC_FRAMER_H_ 6 #define NET_QUIC_QUIC_FRAMER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 NewAckFrameInfo(); 404 NewAckFrameInfo();
405 NewAckFrameInfo(const NewAckFrameInfo& other); 405 NewAckFrameInfo(const NewAckFrameInfo& other);
406 ~NewAckFrameInfo(); 406 ~NewAckFrameInfo();
407 407
408 // The maximum ack block length. 408 // The maximum ack block length.
409 QuicPacketNumber max_block_length; 409 QuicPacketNumber max_block_length;
410 // Length of first ack block. 410 // Length of first ack block.
411 QuicPacketNumber first_block_length; 411 QuicPacketNumber first_block_length;
412 // Ack blocks starting with gaps to next block and ack block lengths. 412 // Ack blocks starting with gaps to next block and ack block lengths.
413 std::vector<AckBlock> ack_blocks; 413 std::vector<AckBlock> ack_blocks;
414 // Number of ACK blocks. If |ack_blocks| is generated, must equal
415 // |ack_blocks.size()|.
416 size_t num_ack_blocks;
414 }; 417 };
415 418
416 bool ProcessDataPacket(QuicDataReader* reader, 419 bool ProcessDataPacket(QuicDataReader* reader,
417 const QuicPacketPublicHeader& public_header, 420 const QuicPacketPublicHeader& public_header,
418 const QuicEncryptedPacket& packet, 421 const QuicEncryptedPacket& packet,
419 char* decrypted_buffer, 422 char* decrypted_buffer,
420 size_t buffer_length); 423 size_t buffer_length);
421 424
422 bool ProcessPublicResetPacket(QuicDataReader* reader, 425 bool ProcessPublicResetPacket(QuicDataReader* reader,
423 const QuicPacketPublicHeader& public_header); 426 const QuicPacketPublicHeader& public_header);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // Computes the wire size in bytes of the payload of |frame|. 509 // Computes the wire size in bytes of the payload of |frame|.
507 size_t ComputeFrameLength(const QuicFrame& frame, 510 size_t ComputeFrameLength(const QuicFrame& frame,
508 bool last_frame_in_packet, 511 bool last_frame_in_packet,
509 QuicPacketNumberLength packet_number_length); 512 QuicPacketNumberLength packet_number_length);
510 513
511 static bool AppendPacketSequenceNumber( 514 static bool AppendPacketSequenceNumber(
512 QuicPacketNumberLength packet_number_length, 515 QuicPacketNumberLength packet_number_length,
513 QuicPacketNumber packet_number, 516 QuicPacketNumber packet_number,
514 QuicDataWriter* writer); 517 QuicDataWriter* writer);
515 518
519 // Appends a single ACK block to |writer| and returns true if the block was
520 // successfully appended.
521 static bool AppendAckBlock(uint8_t gap,
522 QuicPacketNumberLength length_length,
523 QuicPacketNumber length,
524 QuicDataWriter* writer);
525
516 static uint8_t GetSequenceNumberFlags( 526 static uint8_t GetSequenceNumberFlags(
517 QuicPacketNumberLength packet_number_length); 527 QuicPacketNumberLength packet_number_length);
518 528
519 static AckFrameInfo GetAckFrameInfo(const QuicAckFrame& frame); 529 static AckFrameInfo GetAckFrameInfo(const QuicAckFrame& frame);
520 530
521 static NewAckFrameInfo GetNewAckFrameInfo(const QuicAckFrame& frame); 531 static NewAckFrameInfo GetNewAckFrameInfo(const QuicAckFrame& frame,
532 bool construct_blocks);
522 533
523 // The Append* methods attempt to write the provided header or frame using the 534 // The Append* methods attempt to write the provided header or frame using the
524 // |writer|, and return true if successful. 535 // |writer|, and return true if successful.
525 536
526 bool AppendAckFrameAndTypeByte(const QuicPacketHeader& header, 537 bool AppendAckFrameAndTypeByte(const QuicPacketHeader& header,
527 const QuicAckFrame& frame, 538 const QuicAckFrame& frame,
528 QuicDataWriter* builder); 539 QuicDataWriter* builder);
529 bool AppendNewAckFrameAndTypeByte(const QuicAckFrame& frame, 540 bool AppendNewAckFrameAndTypeByte(const QuicAckFrame& frame,
530 QuicDataWriter* builder); 541 QuicDataWriter* builder);
531 bool AppendTimestampToAckFrame(const QuicAckFrame& frame, 542 bool AppendTimestampToAckFrame(const QuicAckFrame& frame,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 QuicTime::Delta last_timestamp_; 616 QuicTime::Delta last_timestamp_;
606 // The diversification nonce from the last received packet. 617 // The diversification nonce from the last received packet.
607 DiversificationNonce last_nonce_; 618 DiversificationNonce last_nonce_;
608 619
609 DISALLOW_COPY_AND_ASSIGN(QuicFramer); 620 DISALLOW_COPY_AND_ASSIGN(QuicFramer);
610 }; 621 };
611 622
612 } // namespace net 623 } // namespace net
613 624
614 #endif // NET_QUIC_QUIC_FRAMER_H_ 625 #endif // NET_QUIC_QUIC_FRAMER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698