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..91a10252092e002fdf8943e8fe7866e7a30743d9 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); |
+ |
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, |
+ const char* data, |
+ size_t offset, |
+ size_t length); |
+ // ************************************** |
+ |
// 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,14 @@ 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 std::ostream& operator<<(std::ostream& os, const BlobDataBuilder& x); |
std::string uuid_; |
std::string content_type_; |
@@ -80,6 +97,9 @@ class STORAGE_EXPORT BlobDataBuilder { |
DISALLOW_COPY_AND_ASSIGN(BlobDataBuilder); |
}; |
+STORAGE_EXPORT std::ostream& operator<<(std::ostream& os, |
+ const BlobDataBuilder& x); |
+ |
#if defined(UNIT_TEST) |
inline bool operator==(const BlobDataBuilder& a, const BlobDataBuilder& b) { |
if (a.content_type_ != b.content_type_) |
@@ -89,7 +109,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 +139,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 |