diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-29 00:30:47 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-29 00:30:47 +0000 |
commit | 9dea9e1fea04be579e34c634cb3be1b6654ef506 (patch) | |
tree | 6615f05d4b92199300d63cb5f2203ca7345e2cff /net/base/io_buffer.h | |
parent | d615ad7ae65beddc26c9833b7bfd1d7bdb6f3d7b (diff) | |
download | chromium_src-9dea9e1fea04be579e34c634cb3be1b6654ef506.zip chromium_src-9dea9e1fea04be579e34c634cb3be1b6654ef506.tar.gz chromium_src-9dea9e1fea04be579e34c634cb3be1b6654ef506.tar.bz2 |
Change URLRequest to use a ref-counted buffer for actual IO.
This will re-land http://codereview.chromium.org/18390
BUG=5325
Review URL: http://codereview.chromium.org/19004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/io_buffer.h')
-rw-r--r-- | net/base/io_buffer.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h new file mode 100644 index 0000000..b390103 --- /dev/null +++ b/net/base/io_buffer.h @@ -0,0 +1,32 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_BASE_IO_BUFFER_H_ +#define NET_BASE_IO_BUFFER_H_ + +#include "base/ref_counted.h" + +namespace net { + +// This is a simple wrapper around a buffer that provides ref counting for +// easier asynchronous IO handling. +class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> { + public: + explicit IOBuffer(int buffer_size) { + data_ = new char[buffer_size]; + } + explicit IOBuffer(char* buffer) : data_(buffer) {} + virtual ~IOBuffer() { + delete[] data_; + } + + char* data() { return data_; } + + protected: + char* data_; +}; + +} // namespace net + +#endif // NET_BASE_IO_BUFFER_H_ |