diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 07:54:39 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 07:54:39 +0000 |
commit | bf96f533df6515f9ddea3278515a77ab81c00263 (patch) | |
tree | 72ba664e83a3a5880b1b16bd379d041c2e85e368 /net/base/upload_data_stream.h | |
parent | 26c2f823d194dc69819b7def92f920f0ec861df5 (diff) | |
download | chromium_src-bf96f533df6515f9ddea3278515a77ab81c00263.zip chromium_src-bf96f533df6515f9ddea3278515a77ab81c00263.tar.gz chromium_src-bf96f533df6515f9ddea3278515a77ab81c00263.tar.bz2 |
Add chunked uploads support to SPDY
As part of this, I had to move the chunked encoding part from UploadData::Element::SetChunk
to HttpStreamParser::DoSendBody as SPDY doesn't have this encoded format and UploadData
needs to serve both.
BUG=none
TEST=net_unittests (2 new tests added)
Review URL: http://codereview.chromium.org/6292013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/upload_data_stream.h')
-rw-r--r-- | net/base/upload_data_stream.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/base/upload_data_stream.h b/net/base/upload_data_stream.h index f291140..decc3f6 100644 --- a/net/base/upload_data_stream.h +++ b/net/base/upload_data_stream.h @@ -27,6 +27,12 @@ class UploadDataStream { IOBuffer* buf() const { return buf_; } size_t buf_len() const { return buf_len_; } + // TODO(satish): We should ideally have UploadDataStream expose a Read() + // method which returns data in a caller provided IOBuffer. That would do away + // with this method and make the interface cleaner as well with less memmove + // calls. + size_t GetMaxBufferSize() const { return kBufSize; } + // Call to indicate that a portion of the stream's buffer was consumed. This // call modifies the stream's buffer so that it contains the next segment of // the upload data to be consumed. @@ -50,6 +56,16 @@ class UploadDataStream { // position < size. bool eof() const { return eof_; } + // Returns whether the data available in buf() includes the last chunk in a + // chunked data stream. This method returns true once the final chunk has been + // placed in the IOBuffer returned by buf(), in contrast to eof() which + // returns true only after the data in buf() has been consumed. + bool IsOnLastChunk() const; + +#if defined(UNIT_TEST) + static void set_merge_chunks(bool merge) { merge_chunks_ = merge; } +#endif + private: enum { kBufSize = 16384 }; @@ -93,6 +109,10 @@ class UploadDataStream { // Whether there is no data left to read. bool eof_; + // TODO(satish): Remove this once we have a better way to unit test POST + // requests with chunked uploads. + static bool merge_chunks_; + DISALLOW_COPY_AND_ASSIGN(UploadDataStream); }; |