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

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

Issue 2782033002: remove is_sparse_file_ from DownloadFileImpl (Closed)
Patch Set: add IsSparseFile() helper method Created 3 years, 9 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/base_file.cc
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc
index b95ef97ed98c372ddddcb82f12144b11418735ee..7c05f8deac393f8141a7006a039a758341635663 100644
--- a/content/browser/download/base_file.cc
+++ b/content/browser/download/base_file.cc
@@ -109,6 +109,13 @@ DownloadInterruptReason BaseFile::WriteDataToFile(int64_t offset,
return LogSystemError("Write", logging::GetLastSystemErrorCode());
DCHECK_EQ(static_cast<size_t>(write_result), data_len);
+
+ if (bytes_so_far_ != offset) {
+ // A hole is created in the file.
+ is_sparse_file_ = true;
+ secure_hash_.reset();
+ }
+
bytes_so_far_ += data_len;
net_log_.EndEvent(net::NetLogEventType::DOWNLOAD_FILE_WRITTEN,
net::NetLog::Int64Callback("bytes", data_len));
« no previous file with comments | « no previous file | content/browser/download/download_browsertest.cc » ('j') | content/browser/download/download_file_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698