| Index: net/spdy/spdy_frame_builder.cc
|
| diff --git a/net/spdy/spdy_frame_builder.cc b/net/spdy/spdy_frame_builder.cc
|
| index eed6eb224e992f392661bb9ddf55108a35e17be4..c9d82e2644486a4d1798a47447c2c94540bb84f1 100644
|
| --- a/net/spdy/spdy_frame_builder.cc
|
| +++ b/net/spdy/spdy_frame_builder.cc
|
| @@ -103,19 +103,14 @@ bool SpdyFrameBuilder::ReadData(void** iter, const char** data,
|
| return ReadBytes(iter, data, *length);
|
| }
|
|
|
| -char* SpdyFrameBuilder::BeginWrite(size_t length) {
|
| - size_t needed_size = length_ + length;
|
| - if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
|
| - return NULL;
|
| -
|
| -#ifdef ARCH_CPU_64_BITS
|
| - DCHECK_LE(length, std::numeric_limits<uint32>::max());
|
| -#endif
|
| +bool SpdyFrameBuilder::WriteString(const std::string& value) {
|
| + if (value.size() > 0xffff)
|
| + return false;
|
|
|
| - return buffer_ + length_;
|
| -}
|
| + if (!WriteUInt16(static_cast<int>(value.size())))
|
| + return false;
|
|
|
| -void SpdyFrameBuilder::EndWrite(char* dest, int length) {
|
| + return WriteBytes(value.data(), static_cast<uint16>(value.size()));
|
| }
|
|
|
| bool SpdyFrameBuilder::WriteBytes(const void* data, uint16 data_len) {
|
| @@ -132,16 +127,6 @@ bool SpdyFrameBuilder::WriteBytes(const void* data, uint16 data_len) {
|
| return true;
|
| }
|
|
|
| -bool SpdyFrameBuilder::WriteString(const std::string& value) {
|
| - if (value.size() > 0xffff)
|
| - return false;
|
| -
|
| - if (!WriteUInt16(static_cast<int>(value.size())))
|
| - return false;
|
| -
|
| - return WriteBytes(value.data(), static_cast<uint16>(value.size()));
|
| -}
|
| -
|
| char* SpdyFrameBuilder::BeginWriteData(uint16 length) {
|
| DCHECK_EQ(variable_buffer_offset_, 0U) <<
|
| "There can only be one variable buffer in a SpdyFrameBuilder";
|
| @@ -161,6 +146,21 @@ char* SpdyFrameBuilder::BeginWriteData(uint16 length) {
|
| return data_ptr;
|
| }
|
|
|
| +char* SpdyFrameBuilder::BeginWrite(size_t length) {
|
| + size_t needed_size = length_ + length;
|
| + if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
|
| + return NULL;
|
| +
|
| +#ifdef ARCH_CPU_64_BITS
|
| + DCHECK_LE(length, std::numeric_limits<uint32>::max());
|
| +#endif
|
| +
|
| + return buffer_ + length_;
|
| +}
|
| +
|
| +void SpdyFrameBuilder::EndWrite(char* dest, int length) {
|
| +}
|
| +
|
| bool SpdyFrameBuilder::Resize(size_t new_capacity) {
|
| if (new_capacity <= capacity_)
|
| return true;
|
|
|