Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: storage/browser/blob/blob_data_builder.cc

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes, working w/ Layout tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: storage/browser/blob/blob_data_builder.cc
diff --git a/storage/browser/blob/blob_data_builder.cc b/storage/browser/blob/blob_data_builder.cc
index 1397cede297e47dbb88f2f52f3fa5f24172c39b9..7515fe3686e3e4360927e2980e038ebb7fb2c43f 100644
--- a/storage/browser/blob/blob_data_builder.cc
+++ b/storage/browser/blob/blob_data_builder.cc
@@ -14,7 +14,6 @@
#include "base/numerics/safe_math.h"
#include "base/time/time.h"
#include "net/disk_cache/disk_cache.h"
-#include "storage/browser/blob/shareable_file_reference.h"
namespace storage {
@@ -125,22 +124,21 @@ bool BlobDataBuilder::PopulateFutureFile(
const scoped_refptr<ShareableFileReference>& file_reference,
const base::Time& expected_modification_time) {
DCHECK_LT(index, items_.size());
- DataElement* old_element = items_.at(index)->data_element_ptr();
+ DataElement* element = items_.at(index)->data_element_ptr();
- if (old_element->type() != DataElement::TYPE_FILE) {
+ if (element->type() != DataElement::TYPE_FILE) {
DVLOG(1) << "Invalid item type.";
return false;
- } else if (old_element->path().AsUTF8Unsafe() !=
+ } else if (element->path().AsUTF8Unsafe() !=
std::string(kAppendFutureFileTemporaryFileName)) {
DVLOG(1) << "Item not created by AppendFutureFile";
return false;
}
- uint64_t length = old_element->length();
- uint64_t offset = old_element->offset();
- std::unique_ptr<DataElement> element(new DataElement());
+ uint64_t length = element->length();
+ uint64_t offset = element->offset();
+ items_.at(index)->data_handle_ = std::move(file_reference);
element->SetToFilePathRange(file_reference->path(), offset, length,
expected_modification_time);
- items_[index] = new BlobDataItem(std::move(element), file_reference);
return true;
}
@@ -155,6 +153,17 @@ void BlobDataBuilder::AppendFile(const base::FilePath& file_path,
ShareableFileReference::Get(file_path)));
}
+void BlobDataBuilder::AppendShareableFileReference(
+ const scoped_refptr<ShareableFileReference> file,
+ uint64_t offset,
+ uint64_t length,
+ const base::Time& expected_modification_time) {
+ std::unique_ptr<DataElement> element(new DataElement());
+ element->SetToFilePathRange(file->path(), offset, length,
+ expected_modification_time);
+ items_.push_back(new BlobDataItem(std::move(element), file));
+}
+
void BlobDataBuilder::AppendBlob(const std::string& uuid,
uint64_t offset,
uint64_t length) {

Powered by Google App Engine
This is Rietveld 408576698