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

Unified Diff: components/history/core/browser/history_backend.cc

Issue 2292733002: Commit a new download to history db immediately on Android (Closed)
Patch Set: nit Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/history_backend.cc
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
index 431eb37ba7507dba003f6933a0711812f5730397..fc73d72b31d597fca01fe260a4fccb2e07e01f96 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -1179,7 +1179,15 @@ bool HistoryBackend::CreateDownload(const DownloadRow& history_info) {
if (!db_)
return false;
bool success = db_->CreateDownload(history_info);
+#if defined(OS_ANDROID)
+ // On android, browser process can get easily killed. Download will no longer
+ // be able to resume and the temporary file will linger forever if the
+ // download is not committed before that. Do the commit right away to avoid
+ // uncommitted download entry if browser is killed.
+ Commit();
+#else
ScheduleCommit();
+#endif
return success;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698