| 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..5ed5d8c6d56cc1699e09860a4916b88be9ea8ba5 100644
|
| --- a/storage/browser/blob/blob_memory_controller.cc
|
| +++ b/storage/browser/blob/blob_memory_controller.cc
|
| @@ -45,6 +45,8 @@ File::Error CreateBlobDirectory(const FilePath& blob_storage_dir) {
|
| base::CreateDirectoryAndGetError(blob_storage_dir, &error);
|
| UMA_HISTOGRAM_ENUMERATION("Storage.Blob.CreateDirectoryResult", -error,
|
| -File::FILE_ERROR_MAX);
|
| + if (error != File::FILE_OK)
|
| + LOG(ERROR) << "Error creating blob storage directory: " << error;
|
| return error;
|
| }
|
|
|
| @@ -159,9 +161,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 +304,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 +319,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 +347,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
|
| @@ -379,6 +385,7 @@ BlobMemoryController::~BlobMemoryController() {}
|
| void BlobMemoryController::DisableFilePaging(base::File::Error reason) {
|
| UMA_HISTOGRAM_ENUMERATION("Storage.Blob.PagingDisabled", -reason,
|
| -File::FILE_ERROR_MAX);
|
| + LOG(ERROR) << "Blob storage paging disabled due to: " << reason;
|
| file_paging_enabled_ = false;
|
| in_flight_memory_used_ = 0;
|
| items_paging_to_file_.clear();
|
| @@ -398,7 +405,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);
|
| }
|
| }
|
|
|
|
|