summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-21 18:57:01 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-21 18:57:01 +0000
commit504829400b156f8ab93afabeed5cb5837902a5c4 (patch)
tree32be186199ebcbb23e544be40315b46eeee07b44 /net/base
parentcef3362fd03475dc6e47637a823b086e8cf13b95 (diff)
downloadchromium_src-504829400b156f8ab93afabeed5cb5837902a5c4.zip
chromium_src-504829400b156f8ab93afabeed5cb5837902a5c4.tar.gz
chromium_src-504829400b156f8ab93afabeed5cb5837902a5c4.tar.bz2
Http cache: Use asynchronous IO to read an write the
response headers from the disk cache. BUG=26729 TEST=current unit tests. Review URL: http://codereview.chromium.org/506081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/io_buffer.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h
index 671b263..d908eec 100644
--- a/net/base/io_buffer.h
+++ b/net/base/io_buffer.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/pickle.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
@@ -131,6 +132,26 @@ class GrowableIOBuffer : public IOBuffer {
int offset_;
};
+// This versions allows a pickle to be used as the storage for a write-style
+// operation, avoiding an extra data copy.
+class PickledIOBuffer : public IOBuffer {
+ public:
+ PickledIOBuffer() : IOBuffer() {}
+
+ Pickle* pickle() { return &pickle_; }
+
+ // Signals that we are done writing to the picke and we can use it for a
+ // write-style IO operation.
+ void Done() {
+ data_ = const_cast<char*>(static_cast<const char*>(pickle_.data()));
+ }
+
+ private:
+ ~PickledIOBuffer() { data_ = NULL; }
+
+ Pickle pickle_;
+};
+
// This class allows the creation of a temporary IOBuffer that doesn't really
// own the underlying buffer. Please use this class only as a last resort.
// A good example is the buffer for a synchronous operation, where we can be