| Index: chrome/browser/history/download_database.cc
|
| diff --git a/chrome/browser/history/download_database.cc b/chrome/browser/history/download_database.cc
|
| index 4f4bfac9e1d1b27fe02aacba4f03a3662d63b815..e485f2b5035bb875092e1cb8b23b872944de1d56 100644
|
| --- a/chrome/browser/history/download_database.cc
|
| +++ b/chrome/browser/history/download_database.cc
|
| @@ -52,9 +52,14 @@ FilePath ColumnFilePath(sql::Statement& statement, int col) {
|
|
|
| #endif
|
|
|
| +// Key in the meta_table containing the next id to use for a new download in
|
| +// this profile.
|
| +static const char kNextDownloadId[] = "next_download_id";
|
| +
|
| } // namespace
|
|
|
| -DownloadDatabase::DownloadDatabase() {
|
| +DownloadDatabase::DownloadDatabase()
|
| + : next_id_(0) {
|
| }
|
|
|
| DownloadDatabase::~DownloadDatabase() {
|
| @@ -73,6 +78,8 @@ bool DownloadDatabase::InitDownloadTable() {
|
| "state INTEGER NOT NULL)"))
|
| return false;
|
| }
|
| + meta_table_.Init(&GetDB(), 0, 0);
|
| + meta_table_.GetValue(kNextDownloadId, &next_id_);
|
| return true;
|
| }
|
|
|
| @@ -160,8 +167,12 @@ int64 DownloadDatabase::CreateDownload(const DownloadHistoryInfo& info) {
|
| statement.BindInt64(4, info.total_bytes);
|
| statement.BindInt(5, info.state);
|
|
|
| - if (statement.Run())
|
| - return GetDB().GetLastInsertRowId();
|
| + if (statement.Run()) {
|
| + int64 db_handle = GetDB().GetLastInsertRowId();
|
| + // TODO(benjhayden) if(info.id>next_id_){setvalue;next_id_=info.id;}
|
| + meta_table_.SetValue(kNextDownloadId, ++next_id_);
|
| + return db_handle;
|
| + }
|
| return 0;
|
| }
|
|
|
|
|