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

Side by Side Diff: net/quic/test_tools/quic_packet_creator_peer.cc

Issue 1660593004: Landing Recent QUIC changes until 01/28/2016 18:41 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0202
Patch Set: Created 4 years, 10 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/test_tools/quic_packet_creator_peer.h ('k') | net/quic/test_tools/quic_session_peer.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/test_tools/quic_packet_creator_peer.h" 5 #include "net/quic/test_tools/quic_packet_creator_peer.h"
6 6
7 #include "net/quic/quic_packet_creator.h" 7 #include "net/quic/quic_packet_creator.h"
8 8
9 namespace net { 9 namespace net {
10 namespace test { 10 namespace test {
(...skipping 18 matching lines...) Expand all
29 // static 29 // static
30 void QuicPacketCreatorPeer::SetSendPathIdInPacket(QuicPacketCreator* creator, 30 void QuicPacketCreatorPeer::SetSendPathIdInPacket(QuicPacketCreator* creator,
31 bool send_path_id_in_packet) { 31 bool send_path_id_in_packet) {
32 creator->send_path_id_in_packet_ = send_path_id_in_packet; 32 creator->send_path_id_in_packet_ = send_path_id_in_packet;
33 } 33 }
34 34
35 // static 35 // static
36 void QuicPacketCreatorPeer::SetPacketNumberLength( 36 void QuicPacketCreatorPeer::SetPacketNumberLength(
37 QuicPacketCreator* creator, 37 QuicPacketCreator* creator,
38 QuicPacketNumberLength packet_number_length) { 38 QuicPacketNumberLength packet_number_length) {
39 creator->packet_number_length_ = packet_number_length; 39 creator->packet_.packet_number_length = packet_number_length;
40 } 40 }
41 41
42 // static 42 // static
43 void QuicPacketCreatorPeer::SetNextPacketNumberLength( 43 void QuicPacketCreatorPeer::SetNextPacketNumberLength(
44 QuicPacketCreator* creator, 44 QuicPacketCreator* creator,
45 QuicPacketNumberLength next_packet_number_length) { 45 QuicPacketNumberLength next_packet_number_length) {
46 creator->next_packet_number_length_ = next_packet_number_length; 46 creator->next_packet_number_length_ = next_packet_number_length;
47 } 47 }
48 48
49 // static 49 // static
50 QuicPacketNumberLength QuicPacketCreatorPeer::NextPacketNumberLength( 50 QuicPacketNumberLength QuicPacketCreatorPeer::NextPacketNumberLength(
51 QuicPacketCreator* creator) { 51 QuicPacketCreator* creator) {
52 return creator->next_packet_number_length_; 52 return creator->next_packet_number_length_;
53 } 53 }
54 54
55 // static 55 // static
56 QuicPacketNumberLength QuicPacketCreatorPeer::GetPacketNumberLength( 56 QuicPacketNumberLength QuicPacketCreatorPeer::GetPacketNumberLength(
57 QuicPacketCreator* creator) { 57 QuicPacketCreator* creator) {
58 return creator->packet_number_length_; 58 return creator->packet_.packet_number_length;
59 } 59 }
60 60
61 void QuicPacketCreatorPeer::SetPacketNumber(QuicPacketCreator* creator, 61 void QuicPacketCreatorPeer::SetPacketNumber(QuicPacketCreator* creator,
62 QuicPacketNumber s) { 62 QuicPacketNumber s) {
63 creator->packet_number_ = s; 63 creator->packet_.packet_number = s;
64 } 64 }
65 65
66 // static 66 // static
67 void QuicPacketCreatorPeer::FillPacketHeader(QuicPacketCreator* creator, 67 void QuicPacketCreatorPeer::FillPacketHeader(QuicPacketCreator* creator,
68 QuicFecGroupNumber fec_group, 68 QuicFecGroupNumber fec_group,
69 bool fec_flag, 69 bool fec_flag,
70 QuicPacketHeader* header) { 70 QuicPacketHeader* header) {
71 creator->FillPacketHeader(fec_group, fec_flag, header); 71 creator->FillPacketHeader(fec_group, fec_flag, header);
72 } 72 }
73 73
(...skipping 24 matching lines...) Expand all
98 creator->StartFecProtectingPackets(); 98 creator->StartFecProtectingPackets();
99 } 99 }
100 100
101 // static 101 // static
102 void QuicPacketCreatorPeer::StopFecProtectingPackets( 102 void QuicPacketCreatorPeer::StopFecProtectingPackets(
103 QuicPacketCreator* creator) { 103 QuicPacketCreator* creator) {
104 creator->StopFecProtectingPackets(); 104 creator->StopFecProtectingPackets();
105 } 105 }
106 106
107 // static 107 // static
108 SerializedPacket QuicPacketCreatorPeer::SerializeFec(QuicPacketCreator* creator, 108 void QuicPacketCreatorPeer::SerializeFec(QuicPacketCreator* creator,
109 char* buffer, 109 char* buffer,
110 size_t buffer_len) { 110 size_t buffer_len) {
111 return creator->SerializeFec(buffer, buffer_len); 111 creator->SerializeFec(buffer, buffer_len);
112 } 112 }
113 113
114 // static 114 // static
115 SerializedPacket QuicPacketCreatorPeer::SerializeAllFrames(
116 QuicPacketCreator* creator,
117 const QuicFrames& frames,
118 char* buffer,
119 size_t buffer_len) {
120 DCHECK(creator->queued_frames_.empty());
121 DCHECK(!frames.empty());
122 for (const QuicFrame& frame : frames) {
123 bool success = creator->AddFrame(frame, false);
124 DCHECK(success);
125 }
126 creator->SerializePacket(buffer, buffer_len);
127 SerializedPacket packet = creator->packet_;
128 // The caller takes ownership of the QuicEncryptedPacket.
129 creator->packet_.packet = nullptr;
130 DCHECK(packet.retransmittable_frames.empty());
131 return packet;
132 }
133
134 // static
115 void QuicPacketCreatorPeer::ResetFecGroup(QuicPacketCreator* creator) { 135 void QuicPacketCreatorPeer::ResetFecGroup(QuicPacketCreator* creator) {
116 creator->ResetFecGroup(); 136 creator->ResetFecGroup();
117 } 137 }
118 138
119 // static 139 // static
120 QuicTime::Delta QuicPacketCreatorPeer::GetFecTimeout( 140 QuicTime::Delta QuicPacketCreatorPeer::GetFecTimeout(
121 QuicPacketCreator* creator) { 141 QuicPacketCreator* creator) {
122 return creator->fec_timeout_; 142 return creator->fec_timeout_;
123 } 143 }
124 144
125 // static 145 // static
126 float QuicPacketCreatorPeer::GetRttMultiplierForFecTimeout( 146 float QuicPacketCreatorPeer::GetRttMultiplierForFecTimeout(
127 QuicPacketCreator* creator) { 147 QuicPacketCreator* creator) {
128 return creator->rtt_multiplier_for_fec_timeout_; 148 return creator->rtt_multiplier_for_fec_timeout_;
129 } 149 }
130 150
131 // static 151 // static
132 EncryptionLevel QuicPacketCreatorPeer::GetEncryptionLevel( 152 EncryptionLevel QuicPacketCreatorPeer::GetEncryptionLevel(
133 QuicPacketCreator* creator) { 153 QuicPacketCreator* creator) {
134 return creator->encryption_level_; 154 return creator->packet_.encryption_level;
135 } 155 }
136 156
137 // static 157 // static
138 QuicPathId QuicPacketCreatorPeer::GetCurrentPath(QuicPacketCreator* creator) { 158 QuicPathId QuicPacketCreatorPeer::GetCurrentPath(QuicPacketCreator* creator) {
139 return creator->current_path_; 159 return creator->packet_.path_id;
140 } 160 }
141 161
142 } // namespace test 162 } // namespace test
143 } // namespace net 163 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_packet_creator_peer.h ('k') | net/quic/test_tools/quic_session_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698