This source file includes following definitions.
- length_
- Swap
#include "net/spdy/spdy_pinnable_buffer_piece.h"
namespace net {
SpdyPinnableBufferPiece::SpdyPinnableBufferPiece()
: buffer_(0), length_(0) {}
SpdyPinnableBufferPiece::~SpdyPinnableBufferPiece() {}
void SpdyPinnableBufferPiece::Pin() {
if (!storage_ && buffer_ != NULL && length_ != 0) {
storage_.reset(new char[length_]);
std::copy(buffer_, buffer_ + length_, storage_.get());
buffer_ = storage_.get();
}
}
void SpdyPinnableBufferPiece::Swap(SpdyPinnableBufferPiece* other) {
size_t length = length_;
length_ = other->length_;
other->length_ = length;
const char* buffer = buffer_;
buffer_ = other->buffer_;
other->buffer_ = buffer;
storage_.swap(other->storage_);
}
}