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

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

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 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/quic_test_utils.cc ('k') | net/tools/quic/chlo_extractor.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/test_tools/simple_quic_framer.h" 5 #include "net/quic/test_tools/simple_quic_framer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "net/quic/core/crypto/quic_decrypter.h" 10 #include "net/quic/core/crypto/quic_decrypter.h"
11 #include "net/quic/core/crypto/quic_encrypter.h" 11 #include "net/quic/core/crypto/quic_encrypter.h"
12 #include "net/quic/platform/api/quic_ptr_util.h" 12 #include "net/quic/platform/api/quic_ptr_util.h"
13 #include "net/quic/platform/api/quic_string_piece.h"
13 14
14 using base::StringPiece;
15 using std::string; 15 using std::string;
16 16
17 namespace net { 17 namespace net {
18 namespace test { 18 namespace test {
19 19
20 class SimpleFramerVisitor : public QuicFramerVisitorInterface { 20 class SimpleFramerVisitor : public QuicFramerVisitorInterface {
21 public: 21 public:
22 SimpleFramerVisitor() : error_(QUIC_NO_ERROR) {} 22 SimpleFramerVisitor() : error_(QUIC_NO_ERROR) {}
23 23
24 ~SimpleFramerVisitor() override {} 24 ~SimpleFramerVisitor() override {}
(...skipping 24 matching lines...) Expand all
49 header_ = header; 49 header_ = header;
50 return true; 50 return true;
51 } 51 }
52 52
53 bool OnStreamFrame(const QuicStreamFrame& frame) override { 53 bool OnStreamFrame(const QuicStreamFrame& frame) override {
54 // Save a copy of the data so it is valid after the packet is processed. 54 // Save a copy of the data so it is valid after the packet is processed.
55 string* string_data = new string(frame.data_buffer, frame.data_length); 55 string* string_data = new string(frame.data_buffer, frame.data_length);
56 stream_data_.push_back(QuicWrapUnique(string_data)); 56 stream_data_.push_back(QuicWrapUnique(string_data));
57 // TODO(ianswett): A pointer isn't necessary with emplace_back. 57 // TODO(ianswett): A pointer isn't necessary with emplace_back.
58 stream_frames_.push_back(QuicMakeUnique<QuicStreamFrame>( 58 stream_frames_.push_back(QuicMakeUnique<QuicStreamFrame>(
59 frame.stream_id, frame.fin, frame.offset, StringPiece(*string_data))); 59 frame.stream_id, frame.fin, frame.offset,
60 QuicStringPiece(*string_data)));
60 return true; 61 return true;
61 } 62 }
62 63
63 bool OnAckFrame(const QuicAckFrame& frame) override { 64 bool OnAckFrame(const QuicAckFrame& frame) override {
64 ack_frames_.push_back(frame); 65 ack_frames_.push_back(frame);
65 return true; 66 return true;
66 } 67 }
67 68
68 bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override { 69 bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override {
69 stop_waiting_frames_.push_back(frame); 70 stop_waiting_frames_.push_back(frame);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return visitor_->goaway_frames(); 228 return visitor_->goaway_frames();
228 } 229 }
229 230
230 const std::vector<QuicConnectionCloseFrame>& 231 const std::vector<QuicConnectionCloseFrame>&
231 SimpleQuicFramer::connection_close_frames() const { 232 SimpleQuicFramer::connection_close_frames() const {
232 return visitor_->connection_close_frames(); 233 return visitor_->connection_close_frames();
233 } 234 }
234 235
235 } // namespace test 236 } // namespace test
236 } // namespace net 237 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/chlo_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698