Chromium Code Reviews| Index: storage/browser/blob/blob_data_builder.h |
| diff --git a/storage/browser/blob/blob_data_builder.h b/storage/browser/blob/blob_data_builder.h |
| index 115d1f4391a8ad1b9ab44bb29f553345c2cfa04a..88889eef6820ab86fbfdf0bb0f66dc3c2f03989e 100644 |
| --- a/storage/browser/blob/blob_data_builder.h |
| +++ b/storage/browser/blob/blob_data_builder.h |
| @@ -6,6 +6,7 @@ |
| #define STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ |
| #include <stdint.h> |
| +#include <ostream> |
| #include <string> |
| #include <vector> |
| @@ -32,12 +33,24 @@ class STORAGE_EXPORT BlobDataBuilder { |
| const std::string& uuid() const { return uuid_; } |
| + // Validates the data element, and copies the data if it's a 'bytes' element. |
| + // Cannot append elements of BYTES_DESCRIPTION or DISK_CACHE_ENTRY types. |
| + void AppendDataElement(const DataElement& element); |
|
michaeln
2015/10/20 01:16:14
Is this new method needed given the type specific
dmurph
2015/10/20 18:28:27
I renamed it to be mores specific for IPC data. I
|
| + |
| void AppendData(const std::string& data) { |
| AppendData(data.c_str(), data.size()); |
| } |
| void AppendData(const char* data, size_t length); |
| + // ***** Async construction methods ***** |
| + void AppendFutureData(size_t length); |
| + bool PopulateFutureData(size_t index, |
|
kinuko
2015/10/20 10:06:22
Could we add a comment when this returns true/fals
dmurph
2015/10/20 18:28:27
Done.
|
| + const char* data, |
| + size_t offset, |
| + size_t length); |
| + // ************************************** |
|
michaeln
2015/10/20 01:16:14
style nit: the asterisk heavy comments look out of
dmurph
2015/10/20 18:28:27
Done.
|
| + |
| // You must know the length of the file, you cannot use kuint64max to specify |
| // the whole file. This method creates a ShareableFileReference to the given |
| // file, which is stored in this builder. |
| @@ -67,10 +80,15 @@ class STORAGE_EXPORT BlobDataBuilder { |
| content_disposition_ = content_disposition; |
| } |
| + void Clear(); |
| + |
| private: |
| friend class BlobStorageContext; |
| + friend class BlobAsyncBuilderHostTest; |
| friend bool operator==(const BlobDataBuilder& a, const BlobDataBuilder& b); |
| friend bool operator==(const BlobDataSnapshot& a, const BlobDataBuilder& b); |
| + friend STORAGE_EXPORT void PrintTo(const BlobDataBuilder& x, |
| + ::std::ostream* os); |
| std::string uuid_; |
| std::string content_type_; |
| @@ -89,7 +107,7 @@ inline bool operator==(const BlobDataBuilder& a, const BlobDataBuilder& b) { |
| if (a.items_.size() != b.items_.size()) |
| return false; |
| for (size_t i = 0; i < a.items_.size(); ++i) { |
| - if (a.items_[i] != b.items_[i]) |
| + if (*(a.items_[i]) != *(b.items_[i])) |
| return false; |
| } |
| return true; |
| @@ -119,6 +137,7 @@ inline bool operator!=(const BlobDataSnapshot& a, const BlobDataBuilder& b) { |
| inline bool operator!=(const BlobDataBuilder& a, const BlobDataBuilder& b) { |
| return !(a == b); |
| } |
| + |
| #endif // defined(UNIT_TEST) |
| } // namespace storage |