summaryrefslogtreecommitdiffstats
path: root/net/base/io_buffer.h
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-28 00:01:33 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-28 00:01:33 +0000
commit28658b28eea506af35897723adb7c69e67327351 (patch)
tree9810112b06a9e97066d652a1c384c68e7c885cf4 /net/base/io_buffer.h
parent403c148688f2c23d2c9b56fff236f4ddfe03377c (diff)
downloadchromium_src-28658b28eea506af35897723adb7c69e67327351.zip
chromium_src-28658b28eea506af35897723adb7c69e67327351.tar.gz
chromium_src-28658b28eea506af35897723adb7c69e67327351.tar.bz2
Handle out of memory in GrowableIOBuffer more gracefully.
BUG=25826 TEST=none Review URL: http://codereview.chromium.org/338049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/io_buffer.h')
-rw-r--r--net/base/io_buffer.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h
index eaf3a39..e301df8 100644
--- a/net/base/io_buffer.h
+++ b/net/base/io_buffer.h
@@ -106,12 +106,14 @@ class GrowableIOBuffer : public IOBuffer {
GrowableIOBuffer() : IOBuffer(), capacity_(0), offset_(0) {}
~GrowableIOBuffer() { data_ = NULL; }
+ // realloc memory to the specified capacity. Returns true on success.
+ // On failure, the capacity and buffer are unchanged.
+ bool SetCapacity(int capacity);
int capacity() { return capacity_; }
- void set_capacity(int capacity);
// |offset| moves the |data_| pointer, allowing "seeking" in the data.
- int offset() { return offset_; }
void set_offset(int offset);
+ int offset() { return offset_; }
int RemainingCapacity() { return capacity_ - offset_; }
char* StartOfBuffer() { return real_data_.get(); }