diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-25 19:47:30 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-25 19:47:30 +0000 |
commit | 68bf915b57f9e781622c433f8795153cca8b5b9e (patch) | |
tree | 9951f7fa93ba72213f2057e82b13f84248f904b6 /net/base/upload_data_stream.cc | |
parent | ec9a68914f38540671f2d1ea1b3d8e10e29e50c6 (diff) | |
download | chromium_src-68bf915b57f9e781622c433f8795153cca8b5b9e.zip chromium_src-68bf915b57f9e781622c433f8795153cca8b5b9e.tar.gz chromium_src-68bf915b57f9e781622c433f8795153cca8b5b9e.tar.bz2 |
add http layer and unit tests to mac build. stub out file uploading in upload_data_stream until we have a common file wrapper.
Review URL: http://codereview.chromium.org/4090
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/upload_data_stream.cc')
-rw-r--r-- | net/base/upload_data_stream.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc index 61e8b59..702aeca 100644 --- a/net/base/upload_data_stream.cc +++ b/net/base/upload_data_stream.cc @@ -10,15 +10,19 @@ namespace net { UploadDataStream::UploadDataStream(const UploadData* data) : data_(data), +#if defined(OS_WIN) next_element_handle_(INVALID_HANDLE_VALUE), +#endif total_size_(data->GetContentLength()) { Reset(); FillBuf(); } UploadDataStream::~UploadDataStream() { +#if defined(OS_WIN) if (next_element_handle_ != INVALID_HANDLE_VALUE) CloseHandle(next_element_handle_); +#endif } void UploadDataStream::DidConsume(size_t num_bytes) { @@ -34,10 +38,12 @@ void UploadDataStream::DidConsume(size_t num_bytes) { } void UploadDataStream::Reset() { +#if defined(OS_WIN) if (next_element_handle_ != INVALID_HANDLE_VALUE) { CloseHandle(next_element_handle_); next_element_handle_ = INVALID_HANDLE_VALUE; } +#endif buf_len_ = 0; next_element_ = data_->elements().begin(); next_element_offset_ = 0; @@ -70,6 +76,7 @@ void UploadDataStream::FillBuf() { } else { DCHECK((*next_element_).type() == UploadData::TYPE_FILE); +#if defined(OS_WIN) if (next_element_handle_ == INVALID_HANDLE_VALUE) { next_element_handle_ = CreateFile((*next_element_).file_path().c_str(), GENERIC_READ, @@ -112,15 +119,24 @@ void UploadDataStream::FillBuf() { if (!ok || bytes_read == 0) advance_to_next_element = true; +#elif defined(OS_POSIX) + // TODO(pinkerton): unify the file upload handling for all platforms once + // we have a cross-platform file representation. There shouldn't be any + // difference among them. + NOTIMPLEMENTED(); + advance_to_next_element = true; +#endif } if (advance_to_next_element) { ++next_element_; next_element_offset_ = 0; +#if defined(OS_WIN) if (next_element_handle_ != INVALID_HANDLE_VALUE) { CloseHandle(next_element_handle_); next_element_handle_ = INVALID_HANDLE_VALUE; } +#endif } } } |