OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ |
6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <ostream> | 10 #include <ostream> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "storage/browser/blob/blob_data_item.h" | 17 #include "storage/browser/blob/blob_data_item.h" |
18 #include "storage/browser/blob/blob_data_snapshot.h" | 18 #include "storage/browser/blob/blob_data_snapshot.h" |
| 19 #include "storage/browser/blob/shareable_file_reference.h" |
19 #include "storage/browser/storage_browser_export.h" | 20 #include "storage/browser/storage_browser_export.h" |
20 | 21 |
21 namespace disk_cache { | 22 namespace disk_cache { |
22 class Entry; | 23 class Entry; |
23 } | 24 } |
24 | 25 |
25 namespace storage { | 26 namespace storage { |
26 class BlobStorageContext; | 27 class BlobStorageContext; |
27 class ShareableFileReference; | 28 class ShareableFileReference; |
28 | 29 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void AppendBlob(const std::string& uuid); | 100 void AppendBlob(const std::string& uuid); |
100 | 101 |
101 void AppendFileSystemFile(const GURL& url, | 102 void AppendFileSystemFile(const GURL& url, |
102 uint64_t offset, | 103 uint64_t offset, |
103 uint64_t length, | 104 uint64_t length, |
104 const base::Time& expected_modification_time); | 105 const base::Time& expected_modification_time); |
105 | 106 |
106 void AppendDiskCacheEntry(const scoped_refptr<DataHandle>& data_handle, | 107 void AppendDiskCacheEntry(const scoped_refptr<DataHandle>& data_handle, |
107 disk_cache::Entry* disk_cache_entry, | 108 disk_cache::Entry* disk_cache_entry, |
108 int disk_cache_stream_index); | 109 int disk_cache_stream_index); |
| 110 |
109 // The content of the side data is accessible with BlobReader::ReadSideData(). | 111 // The content of the side data is accessible with BlobReader::ReadSideData(). |
110 void AppendDiskCacheEntryWithSideData( | 112 void AppendDiskCacheEntryWithSideData( |
111 const scoped_refptr<DataHandle>& data_handle, | 113 const scoped_refptr<DataHandle>& data_handle, |
112 disk_cache::Entry* disk_cache_entry, | 114 disk_cache::Entry* disk_cache_entry, |
113 int disk_cache_stream_index, | 115 int disk_cache_stream_index, |
114 int disk_cache_side_stream_index); | 116 int disk_cache_side_stream_index); |
115 | 117 |
116 void set_content_type(const std::string& content_type) { | 118 void set_content_type(const std::string& content_type) { |
117 content_type_ = content_type; | 119 content_type_ = content_type; |
118 } | 120 } |
119 | 121 |
120 void set_content_disposition(const std::string& content_disposition) { | 122 void set_content_disposition(const std::string& content_disposition) { |
121 content_disposition_ = content_disposition; | 123 content_disposition_ = content_disposition; |
122 } | 124 } |
123 | 125 |
124 void Clear(); | 126 void Clear(); |
125 | 127 |
126 private: | 128 private: |
| 129 friend class BlobAsyncBuilderHostTest; |
| 130 friend class BlobFlattener; |
127 friend class BlobStorageContext; | 131 friend class BlobStorageContext; |
128 friend class BlobAsyncBuilderHostTest; | |
129 friend bool operator==(const BlobDataBuilder& a, const BlobDataBuilder& b); | 132 friend bool operator==(const BlobDataBuilder& a, const BlobDataBuilder& b); |
130 friend bool operator==(const BlobDataSnapshot& a, const BlobDataBuilder& b); | 133 friend bool operator==(const BlobDataSnapshot& a, const BlobDataBuilder& b); |
131 friend STORAGE_EXPORT void PrintTo(const BlobDataBuilder& x, | 134 friend STORAGE_EXPORT void PrintTo(const BlobDataBuilder& x, |
132 ::std::ostream* os); | 135 ::std::ostream* os); |
133 | 136 |
134 std::string uuid_; | 137 std::string uuid_; |
135 std::string content_type_; | 138 std::string content_type_; |
136 std::string content_disposition_; | 139 std::string content_disposition_; |
137 std::vector<scoped_refptr<BlobDataItem>> items_; | 140 std::vector<scoped_refptr<BlobDataItem>> items_; |
138 | 141 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 187 } |
185 | 188 |
186 inline bool operator!=(const BlobDataBuilder& a, const BlobDataSnapshot& b) { | 189 inline bool operator!=(const BlobDataBuilder& a, const BlobDataSnapshot& b) { |
187 return b != a; | 190 return b != a; |
188 } | 191 } |
189 | 192 |
190 #endif // defined(UNIT_TEST) | 193 #endif // defined(UNIT_TEST) |
191 | 194 |
192 } // namespace storage | 195 } // namespace storage |
193 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ | 196 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_BUILDER_H_ |
OLD | NEW |