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

Side by Side Diff: net/quic/quic_protocol.cc

Issue 1493483002: relnote: Refactor stream buffer allocation out into a unique_ptr with a custom deleter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add back a comment for deleter Created 5 years 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/quic_protocol.h ('k') | no next file » | 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/quic_protocol.h" 5 #include "net/quic/quic_protocol.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "net/quic/quic_utils.h" 9 #include "net/quic/quic_utils.h"
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 is_in_fec_group(NOT_IN_FEC_GROUP), 92 is_in_fec_group(NOT_IN_FEC_GROUP),
93 fec_group(0) {} 93 fec_group(0) {}
94 94
95 QuicPublicResetPacket::QuicPublicResetPacket() 95 QuicPublicResetPacket::QuicPublicResetPacket()
96 : nonce_proof(0), rejected_packet_number(0) {} 96 : nonce_proof(0), rejected_packet_number(0) {}
97 97
98 QuicPublicResetPacket::QuicPublicResetPacket( 98 QuicPublicResetPacket::QuicPublicResetPacket(
99 const QuicPacketPublicHeader& header) 99 const QuicPacketPublicHeader& header)
100 : public_header(header), nonce_proof(0), rejected_packet_number(0) {} 100 : public_header(header), nonce_proof(0), rejected_packet_number(0) {}
101 101
102 void StreamBufferDeleter::operator()(char* buf) const {
103 delete[] buf;
104 }
105
102 UniqueStreamBuffer NewStreamBuffer(size_t size) { 106 UniqueStreamBuffer NewStreamBuffer(size_t size) {
103 return UniqueStreamBuffer(new char[size]); 107 return UniqueStreamBuffer(new char[size]);
104 } 108 }
105 109
106 QuicStreamFrame::QuicStreamFrame() : stream_id(0), fin(false), offset(0) { 110 QuicStreamFrame::QuicStreamFrame() : stream_id(0), fin(false), offset(0) {
107 } 111 }
108 112
109 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id, 113 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
110 bool fin, 114 bool fin,
111 QuicStreamOffset offset, 115 QuicStreamOffset offset,
112 StringPiece data) 116 StringPiece data)
113 : stream_id(stream_id), fin(fin), offset(offset), data(data) { 117 : stream_id(stream_id), fin(fin), offset(offset), data(data) {
114 } 118 }
115 119
116 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id, 120 QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
117 bool fin, 121 bool fin,
118 QuicStreamOffset offset, 122 QuicStreamOffset offset,
119 StringPiece data, 123 StringPiece data,
120 UniqueStreamBuffer buffer) 124 UniqueStreamBuffer buffer)
121 : stream_id(stream_id), 125 : stream_id(stream_id),
122 fin(fin), 126 fin(fin),
123 offset(offset), 127 offset(offset),
124 data(data), 128 data(data),
125 buffer(buffer.release()) {} 129 buffer(std::move(buffer)) {}
126 130
127 QuicStreamFrame::~QuicStreamFrame() {} 131 QuicStreamFrame::~QuicStreamFrame() {}
128 132
129 uint32 MakeQuicTag(char a, char b, char c, char d) { 133 uint32 MakeQuicTag(char a, char b, char c, char d) {
130 return static_cast<uint32>(a) | 134 return static_cast<uint32>(a) |
131 static_cast<uint32>(b) << 8 | 135 static_cast<uint32>(b) << 8 |
132 static_cast<uint32>(c) << 16 | 136 static_cast<uint32>(c) << 16 |
133 static_cast<uint32>(d) << 24; 137 static_cast<uint32>(d) << 24;
134 } 138 }
135 139
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 transmission_type(transmission_type), 849 transmission_type(transmission_type),
846 in_flight(false), 850 in_flight(false),
847 is_unackable(false), 851 is_unackable(false),
848 is_fec_packet(is_fec_packet), 852 is_fec_packet(is_fec_packet),
849 all_transmissions(nullptr), 853 all_transmissions(nullptr),
850 retransmission(0) {} 854 retransmission(0) {}
851 855
852 TransmissionInfo::~TransmissionInfo() {} 856 TransmissionInfo::~TransmissionInfo() {}
853 857
854 } // namespace net 858 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698