Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ | 5 #ifndef NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ |
| 6 #define NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ | 6 #define NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "net/base/net_export.h" | |
| 13 #include "net/base/upload_element_reader.h" | 14 #include "net/base/upload_element_reader.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 // An UploadElementReader implementation for bytes. | 18 // An UploadElementReader implementation for bytes. The caller keeps ownership |
| 18 // |data| should outlive this class because this class does not take the | 19 // of |data|, and is responsible for ensuring it outlives the |
|
mmenke
2015/06/17 19:11:16
While you're here, |data| -> |bytes|?
gavinp
2015/06/18 18:50:55
Done. Also edited slightly for prettier justificat
| |
| 19 // ownership of the data. | 20 // UploadBytesElementReader. |
| 20 class NET_EXPORT UploadBytesElementReader : public UploadElementReader { | 21 class NET_EXPORT UploadBytesElementReader : public UploadElementReader { |
| 21 public: | 22 public: |
| 22 UploadBytesElementReader(const char* bytes, uint64_t length); | 23 UploadBytesElementReader(const char* bytes, uint64_t length); |
| 23 ~UploadBytesElementReader() override; | 24 ~UploadBytesElementReader() override; |
| 24 | 25 |
| 25 const char* bytes() const { return bytes_; } | 26 const char* bytes() const { return bytes_; } |
| 26 uint64_t length() const { return length_; } | 27 uint64_t length() const { return length_; } |
| 27 | 28 |
| 28 // UploadElementReader overrides: | 29 // UploadElementReader overrides: |
| 29 const UploadBytesElementReader* AsBytesReader() const override; | 30 const UploadBytesElementReader* AsBytesReader() const override; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 std::vector<char> data_; | 60 std::vector<char> data_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(UploadOwnedBytesElementReader); | 62 DISALLOW_COPY_AND_ASSIGN(UploadOwnedBytesElementReader); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace net | 65 } // namespace net |
| 65 | 66 |
| 66 #endif // NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ | 67 #endif // NET_BASE_UPLOAD_BYTES_ELEMENT_READER_H_ |
| OLD | NEW |