diff options
author | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 17:02:25 +0000 |
---|---|---|
committer | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 17:02:25 +0000 |
commit | 530047eb199ea759e2b7e5e356cb260398381943 (patch) | |
tree | b1485f2dc0a5edf586345d56060593efc9c22a44 /content/content_tests.gypi | |
parent | b57037ab90c68f64e7538ab2f60549b9e7a77ed7 (diff) | |
download | chromium_src-530047eb199ea759e2b7e5e356cb260398381943.zip chromium_src-530047eb199ea759e2b7e5e356cb260398381943.tar.gz chromium_src-530047eb199ea759e2b7e5e356cb260398381943.tar.bz2 |
Persist download ids across sessions by merging them with db_handles.
Remove DownloadId from the content api. It made sense in a world with DownloadFileManager, but that world is no more.
Remove meta_table.next_download_id_. {HistoryService,HistoryBackend,DownloadDatabase}::GetNextDownloadId() returns `select max(id) from downloads` + 1. GetNextDownloadId() is called once when ChromeDownloadManagerDelegate is created, before DownloadDatabase::QueryDownloads() is called.
{DownloadManager,DownloadManagerDelegate}::GetNextId() is now *a*synchronous. If GetNextId() is called before History*::GetNextDownloadId() finishes, then the callback arguments go into a queue that is flushed when History*::GetNextDownloadId() calls back to CDMD.
Even if the `select max(id) from downloads` statement takes a long time, browser/profile initialization is not delayed. The only operations that are delayed in this case are downloads.
We cannot simply allow sqlite to automatically assign the id because some DownloadItems are never added to the history.
If all items were added to the history, then we could allow sqlite to automatically assign the id by merging DownloadDatabase::CreateDownload() with DownloadDatabase::GetNextDownloadId(). But some items are never added to the history, so we don't want to create records for them. Also, that would delay surfacing *every* download to the UI by a DB thread bounce, whereas this CL only delays the downloads that are started before DownloadDatabase::GetNextDownloadId() returns.
DownloadHistory now uses loading_id_ instead of loading_db_handle_. This way is safer.
DownloadHistoryData uses a tri-state enum {NOT_PERSISTED, PERSISTING, PERSISTED}.
The invalid id constant is moved to content::DownloadItem::kInvalidId.
BUG=98253
Review URL: https://chromiumcodereview.appspot.com/15584002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/content_tests.gypi')
-rw-r--r-- | content/content_tests.gypi | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 0b14921..37a6fb5 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -282,7 +282,6 @@ 'browser/device_orientation/provider_unittest.cc', 'browser/download/base_file_unittest.cc', 'browser/download/download_file_unittest.cc', - 'browser/download/download_id_unittest.cc', 'browser/download/download_item_impl_unittest.cc', 'browser/download/download_manager_impl_unittest.cc', 'browser/download/file_metadata_unittest_linux.cc', |