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

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

Issue 312553003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_framer.h ('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 "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/crypto/crypto_framer.h" 9 #include "net/quic/crypto/crypto_framer.h"
10 #include "net/quic/crypto/crypto_handshake_message.h" 10 #include "net/quic/crypto/crypto_handshake_message.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 QuicFramer::AckFrameInfo::AckFrameInfo() : max_delta(0) { } 326 QuicFramer::AckFrameInfo::AckFrameInfo() : max_delta(0) { }
327 327
328 QuicFramer::AckFrameInfo::~AckFrameInfo() { } 328 QuicFramer::AckFrameInfo::~AckFrameInfo() { }
329 329
330 QuicPacketEntropyHash QuicFramer::GetPacketEntropyHash( 330 QuicPacketEntropyHash QuicFramer::GetPacketEntropyHash(
331 const QuicPacketHeader& header) const { 331 const QuicPacketHeader& header) const {
332 return header.entropy_flag << (header.packet_sequence_number % 8); 332 return header.entropy_flag << (header.packet_sequence_number % 8);
333 } 333 }
334 334
335 // Test only.
336 SerializedPacket QuicFramer::BuildUnsizedDataPacket(
337 const QuicPacketHeader& header,
338 const QuicFrames& frames) {
339 const size_t max_plaintext_size = GetMaxPlaintextSize(kMaxPacketSize);
340 size_t packet_size = GetPacketHeaderSize(header);
341 for (size_t i = 0; i < frames.size(); ++i) {
342 DCHECK_LE(packet_size, max_plaintext_size);
343 bool first_frame = i == 0;
344 bool last_frame = i == frames.size() - 1;
345 const size_t frame_size = GetSerializedFrameLength(
346 frames[i], max_plaintext_size - packet_size, first_frame, last_frame,
347 header.is_in_fec_group,
348 header.public_header.sequence_number_length);
349 DCHECK(frame_size);
350 packet_size += frame_size;
351 }
352 return BuildDataPacket(header, frames, packet_size);
353 }
354
355 SerializedPacket QuicFramer::BuildDataPacket( 335 SerializedPacket QuicFramer::BuildDataPacket(
356 const QuicPacketHeader& header, 336 const QuicPacketHeader& header,
357 const QuicFrames& frames, 337 const QuicFrames& frames,
358 size_t packet_size) { 338 size_t packet_size) {
359 QuicDataWriter writer(packet_size); 339 QuicDataWriter writer(packet_size);
360 const SerializedPacket kNoPacket( 340 const SerializedPacket kNoPacket(
361 0, PACKET_1BYTE_SEQUENCE_NUMBER, NULL, 0, NULL); 341 0, PACKET_1BYTE_SEQUENCE_NUMBER, NULL, 0, NULL);
362 if (!AppendPacketHeader(header, &writer)) { 342 if (!AppendPacketHeader(header, &writer)) {
363 LOG(DFATAL) << "AppendPacketHeader failed"; 343 LOG(DFATAL) << "AppendPacketHeader failed";
364 return kNoPacket; 344 return kNoPacket;
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 2337
2358 bool QuicFramer::RaiseError(QuicErrorCode error) { 2338 bool QuicFramer::RaiseError(QuicErrorCode error) {
2359 DVLOG(1) << "Error detail: " << detailed_error_; 2339 DVLOG(1) << "Error detail: " << detailed_error_;
2360 set_error(error); 2340 set_error(error);
2361 visitor_->OnError(this); 2341 visitor_->OnError(this);
2362 reader_.reset(NULL); 2342 reader_.reset(NULL);
2363 return false; 2343 return false;
2364 } 2344 }
2365 2345
2366 } // namespace net 2346 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698