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

Unified Diff: content/browser/download/download_file_impl.cc

Issue 2695153002: Refactor BaseFile class to support sparse files (Closed)
Patch Set: Created 3 years, 10 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: content/browser/download/download_file_impl.cc
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index 7e8a3f0c5099ca3e95a906585b21988a766217e8..95298b5de7e62016caa4c12496565c48e618baef 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -74,12 +74,10 @@ void DownloadFileImpl::Initialize(const InitializeCallback& callback) {
update_timer_.reset(new base::RepeatingTimer());
DownloadInterruptReason result =
- file_.Initialize(save_info_->file_path,
- default_download_directory_,
- std::move(save_info_->file),
- save_info_->offset,
+ file_.Initialize(save_info_->file_path, default_download_directory_,
+ std::move(save_info_->file), save_info_->offset,
save_info_->hash_of_partial_file,
- std::move(save_info_->hash_state));
+ std::move(save_info_->hash_state), BaseFile::EXCLUSIVE);
if (result != DOWNLOAD_INTERRUPT_REASON_NONE) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
@@ -112,7 +110,7 @@ DownloadInterruptReason DownloadFileImpl::AppendDataToFile(
this, &DownloadFileImpl::SendUpdate);
}
rate_estimator_.Increment(data_len);
- return file_.AppendDataToFile(data, data_len);
+ return file_.WriteDataToFile(data, data_len);
}
void DownloadFileImpl::RenameAndUniquify(

Powered by Google App Engine
This is Rietveld 408576698