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

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

Issue 319603003: [Downloads] Retry renames after transient failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prepare to reland after XP test fix. Created 6 years, 3 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
« no previous file with comments | « no previous file | content/browser/download/base_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/base_file.h
diff --git a/content/browser/download/base_file.h b/content/browser/download/base_file.h
index a14c5daef3124e6473c4587a8e14a5cb96f8da0f..037aecca3b57cd2912190c3f25f9d0d8215fb0c0 100644
--- a/content/browser/download/base_file.h
+++ b/content/browser/download/base_file.h
@@ -56,7 +56,10 @@ class CONTENT_EXPORT BaseFile {
DownloadInterruptReason AppendDataToFile(const char* data, size_t data_len);
// Rename the download file. Returns a DownloadInterruptReason indicating the
- // result of the operation.
+ // result of the operation. A return code of NONE indicates that the rename
+ // was successful. After a failure, the full_path() and in_progress() can be
+ // used to determine the last known filename and whether the file is available
+ // for writing or retrying the rename.
virtual DownloadInterruptReason Rename(const base::FilePath& full_path);
// Detach the file so it is not deleted on destruction.
@@ -79,8 +82,15 @@ class CONTENT_EXPORT BaseFile {
// Windows to ensure the correct app client ID is available.
DownloadInterruptReason AnnotateWithSourceInformation();
- base::FilePath full_path() const { return full_path_; }
+ // Returns the last known path to the download file. Can be empty if there's
+ // no file.
+ const base::FilePath& full_path() const { return full_path_; }
+
+ // Returns true if the file is open. If true, the file can be written to or
+ // renamed.
bool in_progress() const { return file_.IsValid(); }
+
+ // Returns the number of bytes in the file pointed to by full_path().
int64 bytes_so_far() const { return bytes_so_far_; }
// Fills |hash| with the hash digest for the file.
« no previous file with comments | « no previous file | content/browser/download/base_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698