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 3c426406c5e129cc641983ceba0b57bd26a2e9b6..f21f05766a93ec5953fd4a88ece5117ce38a3949 100644 |
--- a/storage/browser/blob/blob_data_builder.h |
+++ b/storage/browser/blob/blob_data_builder.h |
@@ -20,41 +20,59 @@ class BlobStorageContext; |
class STORAGE_EXPORT BlobDataBuilder { |
public: |
explicit BlobDataBuilder(const std::string& uuid); |
- virtual ~BlobDataBuilder(); |
+ ~BlobDataBuilder(); |
const std::string& uuid() const { return uuid_; } |
- void AppendData(const std::string& data) { |
+ // For builder-style use. |
michaeln
2015/02/05 20:02:09
We generally don't use this pattern in chromium so
dmurph
2015/02/06 01:32:30
Removed
|
+ static BlobDataBuilder* Create(const std::string& uuid); |
+ |
+ BlobDataBuilder* AppendData(const std::string& data) { |
AppendData(data.c_str(), data.size()); |
+ return this; |
} |
- void AppendData(const char* data, size_t length); |
+ BlobDataBuilder* AppendData(const char* data, size_t length); |
+ |
+ BlobDataBuilder* AppendFile(const base::FilePath& file_path, |
+ uint64 offset, |
+ uint64 length, |
+ const base::Time& expected_modification_time); |
- void AppendFile(const base::FilePath& file_path, |
- uint64 offset, |
- uint64 length, |
- const base::Time& expected_modification_time); |
+ BlobDataBuilder* AppendFile( |
+ const base::FilePath& file_path, |
+ uint64 offset, |
+ uint64 length, |
+ const base::Time& expected_modification_time, |
+ scoped_refptr<ShareableFileReference> shareable_file); |
- void AppendFile(const base::FilePath& file_path, |
- uint64 offset, |
- uint64 length, |
- const base::Time& expected_modification_time, |
- scoped_refptr<ShareableFileReference> shareable_file); |
+ BlobDataBuilder* AppendBlob(const std::string& uuid, |
+ uint64 offset, |
+ uint64 length); |
- void AppendBlob(const std::string& uuid, uint64 offset, uint64 length); |
- void AppendFileSystemFile(const GURL& url, |
- uint64 offset, |
- uint64 length, |
- const base::Time& expected_modification_time); |
+ BlobDataBuilder* AppendBlob(const std::string& uuid); |
- void set_content_type(const std::string& content_type) { |
+ BlobDataBuilder* AppendFileSystemFile( |
+ const GURL& url, |
+ uint64 offset, |
+ uint64 length, |
+ const base::Time& expected_modification_time); |
+ |
+ BlobDataBuilder* set_content_type(const std::string& content_type) { |
content_type_ = content_type; |
+ return this; |
} |
- void set_content_disposition(const std::string& content_disposition) { |
+ BlobDataBuilder* set_content_disposition( |
+ const std::string& content_disposition) { |
content_disposition_ = content_disposition; |
+ return this; |
} |
+ // Does a deep clone of this builder. Necessary for cleaning creating |
+ // multiple blobs with the same builder. |
+ scoped_ptr<BlobDataBuilder> Clone(); |
+ |
size_t GetMemoryUsage() const; |
scoped_ptr<BlobDataSnapshot> BuildSnapshot(); |
@@ -98,9 +116,8 @@ inline bool operator==(const BlobDataSnapshot& a, const BlobDataBuilder& b) { |
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; |
} |