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

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

Issue 1782143003: Remove FEC code from receive path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115997404
Patch Set: Created 4 years, 9 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/simple_quic_framer.h ('k') | net/tools/quic/quic_dispatcher.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) 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/test_tools/simple_quic_framer.h" 5 #include "net/quic/test_tools/simple_quic_framer.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/crypto/quic_decrypter.h" 9 #include "net/quic/crypto/quic_decrypter.h"
10 #include "net/quic/crypto/quic_encrypter.h" 10 #include "net/quic/crypto/quic_encrypter.h"
(...skipping 19 matching lines...) Expand all
30 bool OnProtocolVersionMismatch(QuicVersion version) override { return false; } 30 bool OnProtocolVersionMismatch(QuicVersion version) override { return false; }
31 31
32 void OnPacket() override {} 32 void OnPacket() override {}
33 void OnPublicResetPacket(const QuicPublicResetPacket& packet) override { 33 void OnPublicResetPacket(const QuicPublicResetPacket& packet) override {
34 public_reset_packet_.reset(new QuicPublicResetPacket(packet)); 34 public_reset_packet_.reset(new QuicPublicResetPacket(packet));
35 } 35 }
36 void OnVersionNegotiationPacket( 36 void OnVersionNegotiationPacket(
37 const QuicVersionNegotiationPacket& packet) override { 37 const QuicVersionNegotiationPacket& packet) override {
38 version_negotiation_packet_.reset(new QuicVersionNegotiationPacket(packet)); 38 version_negotiation_packet_.reset(new QuicVersionNegotiationPacket(packet));
39 } 39 }
40 void OnRevivedPacket() override {}
41 40
42 bool OnUnauthenticatedPublicHeader( 41 bool OnUnauthenticatedPublicHeader(
43 const QuicPacketPublicHeader& header) override { 42 const QuicPacketPublicHeader& header) override {
44 return true; 43 return true;
45 } 44 }
46 bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override { 45 bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override {
47 return true; 46 return true;
48 } 47 }
49 void OnDecryptedPacket(EncryptionLevel level) override {} 48 void OnDecryptedPacket(EncryptionLevel level) override {}
50 bool OnPacketHeader(const QuicPacketHeader& header) override { 49 bool OnPacketHeader(const QuicPacketHeader& header) override {
51 has_header_ = true; 50 has_header_ = true;
52 header_ = header; 51 header_ = header;
53 return true; 52 return true;
54 } 53 }
55 54
56 void OnFecProtectedPayload(StringPiece payload) override {}
57
58 bool OnStreamFrame(const QuicStreamFrame& frame) override { 55 bool OnStreamFrame(const QuicStreamFrame& frame) override {
59 // Save a copy of the data so it is valid after the packet is processed. 56 // Save a copy of the data so it is valid after the packet is processed.
60 string* string_data = new string(); 57 string* string_data = new string();
61 StringPiece(frame.frame_buffer, frame.frame_length) 58 StringPiece(frame.frame_buffer, frame.frame_length)
62 .AppendToString(string_data); 59 .AppendToString(string_data);
63 stream_data_.push_back(string_data); 60 stream_data_.push_back(string_data);
64 // TODO(ianswett): A pointer isn't necessary with emplace_back. 61 // TODO(ianswett): A pointer isn't necessary with emplace_back.
65 stream_frames_.push_back(new QuicStreamFrame( 62 stream_frames_.push_back(new QuicStreamFrame(
66 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data))); 63 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data)));
67 return true; 64 return true;
68 } 65 }
69 66
70 bool OnAckFrame(const QuicAckFrame& frame) override { 67 bool OnAckFrame(const QuicAckFrame& frame) override {
71 ack_frames_.push_back(frame); 68 ack_frames_.push_back(frame);
72 return true; 69 return true;
73 } 70 }
74 71
75 bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override { 72 bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override {
76 stop_waiting_frames_.push_back(frame); 73 stop_waiting_frames_.push_back(frame);
77 return true; 74 return true;
78 } 75 }
79 76
80 bool OnPingFrame(const QuicPingFrame& frame) override { 77 bool OnPingFrame(const QuicPingFrame& frame) override {
81 ping_frames_.push_back(frame); 78 ping_frames_.push_back(frame);
82 return true; 79 return true;
83 } 80 }
84 81
85 void OnFecData(StringPiece redundancy) override {
86 fec_redundancy_ = redundancy.as_string();
87 }
88
89 bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override { 82 bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override {
90 rst_stream_frames_.push_back(frame); 83 rst_stream_frames_.push_back(frame);
91 return true; 84 return true;
92 } 85 }
93 86
94 bool OnConnectionCloseFrame(const QuicConnectionCloseFrame& frame) override { 87 bool OnConnectionCloseFrame(const QuicConnectionCloseFrame& frame) override {
95 connection_close_frames_.push_back(frame); 88 connection_close_frames_.push_back(frame);
96 return true; 89 return true;
97 } 90 }
98 91
(...skipping 30 matching lines...) Expand all
129 const vector<QuicRstStreamFrame>& rst_stream_frames() const { 122 const vector<QuicRstStreamFrame>& rst_stream_frames() const {
130 return rst_stream_frames_; 123 return rst_stream_frames_;
131 } 124 }
132 const vector<QuicStreamFrame*>& stream_frames() const { 125 const vector<QuicStreamFrame*>& stream_frames() const {
133 return stream_frames_; 126 return stream_frames_;
134 } 127 }
135 const vector<QuicStopWaitingFrame>& stop_waiting_frames() const { 128 const vector<QuicStopWaitingFrame>& stop_waiting_frames() const {
136 return stop_waiting_frames_; 129 return stop_waiting_frames_;
137 } 130 }
138 const vector<QuicPingFrame>& ping_frames() const { return ping_frames_; } 131 const vector<QuicPingFrame>& ping_frames() const { return ping_frames_; }
139 StringPiece fec_data() const { return fec_redundancy_; }
140 const QuicVersionNegotiationPacket* version_negotiation_packet() const { 132 const QuicVersionNegotiationPacket* version_negotiation_packet() const {
141 return version_negotiation_packet_.get(); 133 return version_negotiation_packet_.get();
142 } 134 }
143 135
144 private: 136 private:
145 QuicErrorCode error_; 137 QuicErrorCode error_;
146 bool has_header_; 138 bool has_header_;
147 QuicPacketHeader header_; 139 QuicPacketHeader header_;
148 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_; 140 scoped_ptr<QuicVersionNegotiationPacket> version_negotiation_packet_;
149 scoped_ptr<QuicPublicResetPacket> public_reset_packet_; 141 scoped_ptr<QuicPublicResetPacket> public_reset_packet_;
150 string fec_redundancy_;
151 vector<QuicAckFrame> ack_frames_; 142 vector<QuicAckFrame> ack_frames_;
152 vector<QuicStopWaitingFrame> stop_waiting_frames_; 143 vector<QuicStopWaitingFrame> stop_waiting_frames_;
153 vector<QuicPingFrame> ping_frames_; 144 vector<QuicPingFrame> ping_frames_;
154 vector<QuicStreamFrame*> stream_frames_; 145 vector<QuicStreamFrame*> stream_frames_;
155 vector<QuicRstStreamFrame> rst_stream_frames_; 146 vector<QuicRstStreamFrame> rst_stream_frames_;
156 vector<QuicGoAwayFrame> goaway_frames_; 147 vector<QuicGoAwayFrame> goaway_frames_;
157 vector<QuicConnectionCloseFrame> connection_close_frames_; 148 vector<QuicConnectionCloseFrame> connection_close_frames_;
158 vector<QuicWindowUpdateFrame> window_update_frames_; 149 vector<QuicWindowUpdateFrame> window_update_frames_;
159 vector<QuicBlockedFrame> blocked_frames_; 150 vector<QuicBlockedFrame> blocked_frames_;
160 vector<QuicPathCloseFrame> path_close_frames_; 151 vector<QuicPathCloseFrame> path_close_frames_;
(...skipping 19 matching lines...) Expand all
180 } 171 }
181 172
182 void SimpleQuicFramer::Reset() { 173 void SimpleQuicFramer::Reset() {
183 visitor_.reset(new SimpleFramerVisitor); 174 visitor_.reset(new SimpleFramerVisitor);
184 } 175 }
185 176
186 const QuicPacketHeader& SimpleQuicFramer::header() const { 177 const QuicPacketHeader& SimpleQuicFramer::header() const {
187 return visitor_->header(); 178 return visitor_->header();
188 } 179 }
189 180
190 StringPiece SimpleQuicFramer::fec_data() const {
191 return visitor_->fec_data();
192 }
193
194 const QuicVersionNegotiationPacket* 181 const QuicVersionNegotiationPacket*
195 SimpleQuicFramer::version_negotiation_packet() const { 182 SimpleQuicFramer::version_negotiation_packet() const {
196 return visitor_->version_negotiation_packet(); 183 return visitor_->version_negotiation_packet();
197 } 184 }
198 185
199 QuicFramer* SimpleQuicFramer::framer() { 186 QuicFramer* SimpleQuicFramer::framer() {
200 return &framer_; 187 return &framer_;
201 } 188 }
202 189
203 size_t SimpleQuicFramer::num_frames() const { 190 size_t SimpleQuicFramer::num_frames() const {
(...skipping 28 matching lines...) Expand all
232 return visitor_->goaway_frames(); 219 return visitor_->goaway_frames();
233 } 220 }
234 221
235 const vector<QuicConnectionCloseFrame>& 222 const vector<QuicConnectionCloseFrame>&
236 SimpleQuicFramer::connection_close_frames() const { 223 SimpleQuicFramer::connection_close_frames() const {
237 return visitor_->connection_close_frames(); 224 return visitor_->connection_close_frames();
238 } 225 }
239 226
240 } // namespace test 227 } // namespace test
241 } // namespace net 228 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/simple_quic_framer.h ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698