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

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

Issue 1402943004: relnote: Cache-align the encryption buffer in QuicPacketCreator::SerializePacket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Disables_strike_register_103965712
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | 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_packet_creator.h" 5 #include "net/quic/quic_packet_creator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 MaybeAddPadding(); 443 MaybeAddPadding();
444 444
445 DCHECK_GE(max_plaintext_size_, packet_size_); 445 DCHECK_GE(max_plaintext_size_, packet_size_);
446 // ACK Frames will be truncated due to length only if they're the only frame 446 // ACK Frames will be truncated due to length only if they're the only frame
447 // in the packet, and if packet_size_ was set to max_plaintext_size_. If 447 // in the packet, and if packet_size_ was set to max_plaintext_size_. If
448 // truncation due to length occurred, then GetSerializedFrameLength will have 448 // truncation due to length occurred, then GetSerializedFrameLength will have
449 // returned all bytes free. 449 // returned all bytes free.
450 bool possibly_truncated_by_length = packet_size_ == max_plaintext_size_ && 450 bool possibly_truncated_by_length = packet_size_ == max_plaintext_size_ &&
451 queued_frames_.size() == 1 && 451 queued_frames_.size() == 1 &&
452 queued_frames_.back().type == ACK_FRAME; 452 queued_frames_.back().type == ACK_FRAME;
453 char buffer[kMaxPacketSize]; 453 // The optimized encryption algorithm implementations run faster when
454 // operating on aligned memory.
455 // TODO(rtenneti): Change the default 64 alignas value (used the default
456 // value from CACHELINE_SIZE).
457 ALIGNAS(64) char buffer[kMaxPacketSize];
454 scoped_ptr<QuicPacket> packet; 458 scoped_ptr<QuicPacket> packet;
455 // Use the packet_size_ instead of the buffer size to ensure smaller 459 // Use the packet_size_ instead of the buffer size to ensure smaller
456 // packet sizes are properly used. 460 // packet sizes are properly used.
457 scoped_ptr<char[]> large_buffer; 461 scoped_ptr<char[]> large_buffer;
458 if (packet_size_ <= kMaxPacketSize) { 462 if (packet_size_ <= kMaxPacketSize) {
459 packet.reset( 463 packet.reset(
460 framer_->BuildDataPacket(header, queued_frames_, buffer, packet_size_)); 464 framer_->BuildDataPacket(header, queued_frames_, buffer, packet_size_));
461 } else { 465 } else {
462 large_buffer.reset(new char[packet_size_]); 466 large_buffer.reset(new char[packet_size_]);
463 packet.reset(framer_->BuildDataPacket(header, queued_frames_, 467 packet.reset(framer_->BuildDataPacket(header, queued_frames_,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // Don't pad full packets. 640 // Don't pad full packets.
637 return; 641 return;
638 } 642 }
639 643
640 QuicPaddingFrame padding; 644 QuicPaddingFrame padding;
641 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); 645 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr);
642 DCHECK(success); 646 DCHECK(success);
643 } 647 }
644 648
645 } // namespace net 649 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698