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 | |
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')
-rw-r--r-- | net/base/client_socket_factory.cc | 9 | ||||
-rw-r--r-- | net/base/upload_data_stream.cc | 16 | ||||
-rw-r--r-- | net/base/upload_data_stream.h | 4 |
3 files changed, 29 insertions, 0 deletions
diff --git a/net/base/client_socket_factory.cc b/net/base/client_socket_factory.cc index 1701970..fb5c182 100644 --- a/net/base/client_socket_factory.cc +++ b/net/base/client_socket_factory.cc @@ -5,7 +5,10 @@ #include "net/base/client_socket_factory.h" #include "base/singleton.h" +#include "build/build_config.h" +#if defined(OS_WIN) #include "net/base/ssl_client_socket.h" +#endif #include "net/base/tcp_client_socket.h" namespace net { @@ -20,7 +23,13 @@ class DefaultClientSocketFactory : public ClientSocketFactory { virtual ClientSocket* CreateSSLClientSocket( ClientSocket* transport_socket, const std::string& hostname) { +#if defined(OS_WIN) return new SSLClientSocket(transport_socket, hostname); +#else + // TODO(pinkerton): turn on when we port SSL socket from win32 + NOTIMPLEMENTED(); + return NULL; +#endif } }; 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 } } } diff --git a/net/base/upload_data_stream.h b/net/base/upload_data_stream.h index b8b9719..f31cb80 100644 --- a/net/base/upload_data_stream.h +++ b/net/base/upload_data_stream.h @@ -5,6 +5,7 @@ #ifndef NET_BASE_UPLOAD_DATA_STREAM_H_ #define NET_BASE_UPLOAD_DATA_STREAM_H_ +#include "build/build_config.h" #include "net/base/upload_data.h" namespace net { @@ -50,9 +51,12 @@ class UploadDataStream { // a TYPE_BYTES element. size_t next_element_offset_; +#if defined(OS_WIN) // A handle to the currently open file (or INVALID_HANDLE_VALUE) for // next_element_ if the next element is a TYPE_FILE element. + // TODO(pinkerton): when we get a cross-platform file class, replace this HANDLE next_element_handle_; +#endif // The number of bytes remaining to be read from the currently open file // if the next element is of TYPE_FILE. |