| Index: net/base/io_buffer.h
|
| diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h
|
| index 0ce52e8d79c02473adabd6af98e2e9272d9b2fdb..421fa23faea48333ab3a594e707ca38ad1b34ec7 100644
|
| --- a/net/base/io_buffer.h
|
| +++ b/net/base/io_buffer.h
|
| @@ -123,6 +123,24 @@ class NET_EXPORT StringIOBuffer : public IOBuffer {
|
| std::string string_data_;
|
| };
|
|
|
| +// This versions allows a string to be used as the storage for a write-style
|
| +// operation, avoiding an extra data copy.
|
| +class NET_EXPORT ZeroCopyStringIOBuffer : public IOBuffer {
|
| + public:
|
| + ZeroCopyStringIOBuffer();
|
| +
|
| + std::string* string() { return &string_; }
|
| +
|
| + // Signals that we are done writing to the string and we can use it for a
|
| + // write-style IO operation.
|
| + void Done();
|
| +
|
| + private:
|
| + virtual ~ZeroCopyStringIOBuffer();
|
| +
|
| + std::string string_;
|
| +};
|
| +
|
| // This version wraps an existing IOBuffer and provides convenient functions
|
| // to progressively read all the data.
|
| //
|
|
|