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

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

Issue 2665243003: add a download slices table into history download db (Closed)
Patch Set: add test file to BUILD.gn 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: components/history/core/browser/download_types.cc
diff --git a/components/history/core/browser/download_types.cc b/components/history/core/browser/download_types.cc
index ccc20186d6373787fd514c05711835ae15ef650a..e75081e5b1c8f6a062e2c1af4919cfb1edd3cfc5 100644
--- a/components/history/core/browser/download_types.cc
+++ b/components/history/core/browser/download_types.cc
@@ -115,10 +115,11 @@ int DownloadInterruptReasonToInt(DownloadInterruptReason interrupt_reason) {
const DownloadId kInvalidDownloadId = 0;
-DownloadId IntToDownloadId(int64_t id) {
- DCHECK_GE(id, static_cast<int64_t>(0));
- DCHECK_NE(id, static_cast<int64_t>(kInvalidDownloadId));
- return static_cast<DownloadId>(id);
+bool ConvertIntToDownloadId(int64_t id, DownloadId* out) {
+ if (id <= static_cast<int64_t>(kInvalidDownloadId))
+ return false;
+ *out = static_cast<DownloadId>(id);
+ return true;
}
int64_t DownloadIdToInt(DownloadId id) {
« no previous file with comments | « components/history/core/browser/download_types.h ('k') | components/history/core/browser/history_backend_db_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698