OLD | NEW |
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/core/quic_framer.h" | 5 #include "net/quic/core/quic_framer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 bool OnPacketHeader(const QuicPacketHeader& header) override { | 241 bool OnPacketHeader(const QuicPacketHeader& header) override { |
242 ++packet_count_; | 242 ++packet_count_; |
243 header_.reset(new QuicPacketHeader(header)); | 243 header_.reset(new QuicPacketHeader(header)); |
244 return accept_packet_; | 244 return accept_packet_; |
245 } | 245 } |
246 | 246 |
247 bool OnStreamFrame(const QuicStreamFrame& frame) override { | 247 bool OnStreamFrame(const QuicStreamFrame& frame) override { |
248 ++frame_count_; | 248 ++frame_count_; |
249 // Save a copy of the data so it is valid after the packet is processed. | 249 // Save a copy of the data so it is valid after the packet is processed. |
250 string* string_data = new string(); | 250 string* string_data = new string(frame.data_buffer, frame.data_length); |
251 StringPiece(frame.data_buffer, frame.data_length) | |
252 .AppendToString(string_data); | |
253 stream_data_.push_back(base::WrapUnique(string_data)); | 251 stream_data_.push_back(base::WrapUnique(string_data)); |
254 stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>( | 252 stream_frames_.push_back(base::MakeUnique<QuicStreamFrame>( |
255 frame.stream_id, frame.fin, frame.offset, *string_data)); | 253 frame.stream_id, frame.fin, frame.offset, *string_data)); |
256 return true; | 254 return true; |
257 } | 255 } |
258 | 256 |
259 bool OnAckFrame(const QuicAckFrame& frame) override { | 257 bool OnAckFrame(const QuicAckFrame& frame) override { |
260 ++frame_count_; | 258 ++frame_count_; |
261 ack_frames_.push_back(base::MakeUnique<QuicAckFrame>(frame)); | 259 ack_frames_.push_back(base::MakeUnique<QuicAckFrame>(frame)); |
262 return true; | 260 return true; |
(...skipping 3925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4188 'o', ' ', 'w', 'o', | 4186 'o', ' ', 'w', 'o', |
4189 'r', 'l', 'd', '!', | 4187 'r', 'l', 'd', '!', |
4190 }; | 4188 }; |
4191 // clang-format on | 4189 // clang-format on |
4192 | 4190 |
4193 QuicFramerFuzzFunc(packet, arraysize(packet)); | 4191 QuicFramerFuzzFunc(packet, arraysize(packet)); |
4194 } | 4192 } |
4195 | 4193 |
4196 } // namespace test | 4194 } // namespace test |
4197 } // namespace net | 4195 } // namespace net |
OLD | NEW |