Chromium Code Reviews| Index: net/base/upload_bytes_element_reader.h |
| diff --git a/net/base/upload_bytes_element_reader.h b/net/base/upload_bytes_element_reader.h |
| index afc9560e54aec448732fd3a54db87b77ccda8b42..451c3c5fcc661c968c66b8933e883d2aa56322bb 100644 |
| --- a/net/base/upload_bytes_element_reader.h |
| +++ b/net/base/upload_bytes_element_reader.h |
| @@ -5,13 +5,15 @@ |
| #ifndef NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ |
| #define NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ |
| +#include <vector> |
| + |
| #include "base/compiler_specific.h" |
| #include "net/base/upload_element_reader.h" |
| namespace net { |
| // An UploadElementReader implementation for bytes. |
| -class NET_EXPORT_PRIVATE UploadBytesElementReader : public UploadElementReader { |
| +class NET_EXPORT UploadBytesElementReader : public UploadElementReader { |
|
kinuko
2012/12/12 01:19:17
Can we add a comment to note that this doesn't cop
hashimoto
2012/12/12 10:29:07
Done.
|
| public: |
| UploadBytesElementReader(const char* bytes, int length); |
| virtual ~UploadBytesElementReader(); |
| @@ -39,6 +41,19 @@ class NET_EXPORT_PRIVATE UploadBytesElementReader : public UploadElementReader { |
| DISALLOW_COPY_AND_ASSIGN(UploadBytesElementReader); |
| }; |
| +// A subclass of UplodBytesElementReader which owns the data given as a vector. |
| +class NET_EXPORT UploadOwnedBytesElementReader |
| + : public UploadBytesElementReader { |
| + public: |
| + UploadOwnedBytesElementReader(std::vector<char>* data); |
|
mmenke
2012/12/11 18:53:21
Think it's worth mentioning that we clear |data|.
mmenke
2012/12/11 18:53:21
Speaking of which...this function should also be e
hashimoto
2012/12/12 10:29:07
Oops, it seems presubmit check does not help for m
hashimoto
2012/12/12 10:29:07
Done.
|
| + virtual ~UploadOwnedBytesElementReader(); |
| + |
| + private: |
| + std::vector<char> data_; |
|
mmenke
2012/12/11 18:53:21
May make life easier to make UploadOwnedBytesEleme
hashimoto
2012/12/12 10:29:07
Since yet there are only two places which uses Upl
mmenke
2012/12/12 19:26:41
I admit to a bit of a bias against vectors used in
kinuko
2012/12/13 00:07:55
As for the use of &(*data)[0] I think vector_as_ar
mmenke
2012/12/13 00:43:47
Whether we could get empty data or not depends on
hashimoto
2012/12/13 03:58:47
Good point, it seems cleaner to support empty data
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(UploadOwnedBytesElementReader); |
| +}; |
| + |
| } // namespace net |
| #endif // NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ |