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

Side by Side Diff: net/quic/core/frames/quic_stream_frame.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/core/frames/quic_stream_frame.h ('k') | net/quic/core/quic_client_session_base.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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/frames/quic_stream_frame.h" 5 #include "net/quic/core/frames/quic_stream_frame.h"
6 6
7 #include "net/quic/platform/api/quic_logging.h" 7 #include "net/quic/platform/api/quic_logging.h"
8 8
9 using base::StringPiece;
10
11 namespace net { 9 namespace net {
12 10
13 void StreamBufferDeleter::operator()(char* buffer) const { 11 void StreamBufferDeleter::operator()(char* buffer) const {
14 if (allocator_ != nullptr && buffer != nullptr) { 12 if (allocator_ != nullptr && buffer != nullptr) {
15 allocator_->Delete(buffer); 13 allocator_->Delete(buffer);
16 } 14 }
17 } 15 }
18 16
19 UniqueStreamBuffer NewStreamBuffer(QuicBufferAllocator* allocator, 17 UniqueStreamBuffer NewStreamBuffer(QuicBufferAllocator* allocator,
20 size_t size) { 18 size_t size) {
21 return UniqueStreamBuffer(allocator->New(size), 19 return UniqueStreamBuffer(allocator->New(size),
22 StreamBufferDeleter(allocator)); 20 StreamBufferDeleter(allocator));
23 } 21 }
24 22
25 QuicStreamFrame::QuicStreamFrame() 23 QuicStreamFrame::QuicStreamFrame()
26 : QuicStreamFrame(0, false, 0, nullptr, 0, nullptr) {} 24 : QuicStreamFrame(0, false, 0, nullptr, 0, nullptr) {}
27 25
28 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id, 26 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
29 bool fin, 27 bool fin,
30 QuicStreamOffset offset, 28 QuicStreamOffset offset,
31 StringPiece data) 29 QuicStringPiece data)
32 : QuicStreamFrame(stream_id, 30 : QuicStreamFrame(stream_id,
33 fin, 31 fin,
34 offset, 32 offset,
35 data.data(), 33 data.data(),
36 data.length(), 34 data.length(),
37 nullptr) {} 35 nullptr) {}
38 36
39 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id, 37 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
40 bool fin, 38 bool fin,
41 QuicStreamOffset offset, 39 QuicStreamOffset offset,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 71
74 std::ostream& operator<<(std::ostream& os, 72 std::ostream& operator<<(std::ostream& os,
75 const QuicStreamFrame& stream_frame) { 73 const QuicStreamFrame& stream_frame) {
76 os << "{ stream_id: " << stream_frame.stream_id 74 os << "{ stream_id: " << stream_frame.stream_id
77 << ", fin: " << stream_frame.fin << ", offset: " << stream_frame.offset 75 << ", fin: " << stream_frame.fin << ", offset: " << stream_frame.offset
78 << ", length: " << stream_frame.data_length << " }\n"; 76 << ", length: " << stream_frame.data_length << " }\n";
79 return os; 77 return os;
80 } 78 }
81 79
82 } // namespace net 80 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/frames/quic_stream_frame.h ('k') | net/quic/core/quic_client_session_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698