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

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

Issue 2516713002: [BlobStorage] Implementing disk. (Closed)
Patch Set: comments, and attempt at force flushing all tasks so Windows/Android test works Created 4 years 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_memory_controller.cc
diff --git a/storage/browser/blob/blob_memory_controller.cc b/storage/browser/blob/blob_memory_controller.cc
index 6cc6c3f291f72005a32f017737a24984faece169..4271b8d43708af2b80c6ee9e9f9b201456753342 100644
--- a/storage/browser/blob/blob_memory_controller.cc
+++ b/storage/browser/blob/blob_memory_controller.cc
@@ -159,9 +159,13 @@ uint64_t GetTotalSizeAndFileSizes(
file_id_to_sizes[file_id] = element.offset() + element.length();
total_size_output += element.length();
}
+ uint64_t sizes_from_files = 0;
for (const auto& size_pair : file_id_to_sizes) {
file_sizes_output->push_back(size_pair.second);
+ sizes_from_files += size_pair.second;
}
+ DCHECK_EQ(sizes_from_files, total_size_output)
+ << "Illegal builder configuration, temporary files must be totally used.";
return total_size_output;
}
@@ -298,7 +302,7 @@ class BlobMemoryController::FileQuotaAllocationTask
}
~FileQuotaAllocationTask() override {}
- void RunDoneCallback(bool success, std::vector<FileCreationInfo> file_info) {
+ void RunDoneCallback(std::vector<FileCreationInfo> file_info, bool success) {
// Make sure we clear the weak pointers we gave to the caller beforehand.
weak_factory_.InvalidateWeakPtrs();
@@ -313,7 +317,7 @@ class BlobMemoryController::FileQuotaAllocationTask
controller_->pending_file_quota_tasks_.erase(my_list_position_);
}
- done_callback_.Run(success, std::move(file_info));
+ done_callback_.Run(std::move(file_info), success);
}
base::WeakPtr<QuotaAllocationTask> GetWeakPtr() {
@@ -341,7 +345,7 @@ class BlobMemoryController::FileQuotaAllocationTask
for (size_t i = 0; i < files.size(); i++) {
files[i].file_reference = std::move(references[i]);
}
- RunDoneCallback(true, std::move(files));
+ RunDoneCallback(std::move(files), true);
}
// The my_list_position_ iterator is stored so that we can remove ourself
@@ -398,7 +402,7 @@ void BlobMemoryController::DisableFilePaging(base::File::Error reason) {
memory_request->RunDoneCallback(false);
}
for (auto& file_request : old_file_tasks) {
- file_request->RunDoneCallback(false, std::vector<FileCreationInfo>());
+ file_request->RunDoneCallback(std::vector<FileCreationInfo>(), false);
}
}

Powered by Google App Engine
This is Rietveld 408576698