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

Unified Diff: net/quic/quic_protocol.cc

Issue 1397113003: relnote: Refactor stream buffer allocation out into a scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with TOT Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_protocol.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_protocol.cc
diff --git a/net/quic/quic_protocol.cc b/net/quic/quic_protocol.cc
index 5625d6c9500b513270410bdacbdab36a3fbd587a..d281358f9814b46ba2349d6038cd3c9f2548cf90 100644
--- a/net/quic/quic_protocol.cc
+++ b/net/quic/quic_protocol.cc
@@ -91,6 +91,10 @@ QuicPublicResetPacket::QuicPublicResetPacket(
const QuicPacketPublicHeader& header)
: public_header(header), nonce_proof(0), rejected_packet_number(0) {}
+UniqueStreamBuffer NewStreamBuffer(size_t size) {
+ return UniqueStreamBuffer(new char[size]);
+}
+
QuicStreamFrame::QuicStreamFrame() : stream_id(0), fin(false), offset(0) {
}
@@ -820,6 +824,8 @@ RetransmittableFrames::~RetransmittableFrames() {
DCHECK(false) << "Cannot delete type: " << it->type;
}
}
+ // TODO(rtenneti): Delete the for loop once chrome has c++11 library support
+ // for "std::vector<UniqueStreamBuffer> stream_data_;".
for (const char* buffer : stream_data_) {
delete[] buffer;
}
@@ -830,13 +836,13 @@ const QuicFrame& RetransmittableFrames::AddFrame(const QuicFrame& frame) {
}
const QuicFrame& RetransmittableFrames::AddFrame(const QuicFrame& frame,
- char* buffer) {
+ UniqueStreamBuffer buffer) {
if (frame.type == STREAM_FRAME &&
frame.stream_frame->stream_id == kCryptoStreamId) {
has_crypto_handshake_ = IS_HANDSHAKE;
}
if (buffer != nullptr) {
- stream_data_.push_back(buffer);
+ stream_data_.push_back(buffer.release());
}
frames_.push_back(frame);
return frames_.back();
« 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