summaryrefslogtreecommitdiffstats
path: root/content/content_browser.gypi
diff options
context:
space:
mode:
authorbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 21:09:12 +0000
committerbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 21:09:12 +0000
commit5d051ea84671aa5092500360d5ab619e108ebadd (patch)
treeb9a39fd5d583b9a10b1472932298fcd58e934754 /content/content_browser.gypi
parent7179d2f456e41eca799a6c2070fca9ad123e0b65 (diff)
downloadchromium_src-5d051ea84671aa5092500360d5ab619e108ebadd.zip
chromium_src-5d051ea84671aa5092500360d5ab619e108ebadd.tar.gz
chromium_src-5d051ea84671aa5092500360d5ab619e108ebadd.tar.bz2
Make a new integer field in sql::MetaTable (a per-profile db) containing a counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs.
(Retry of r98656 again. That CL included <iostream> in a "promiscuous" header file, dramatically increasing the number of static initializers, and was reverted. This is the same CL, but includes <iosfwd> instead of <iostream>.) Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. Review URL: http://codereview.chromium.org/7776012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/content_browser.gypi')
-rw-r--r--content/content_browser.gypi2
1 files changed, 2 insertions, 0 deletions
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 44e8364..8ad694c 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -119,6 +119,8 @@
'browser/download/download_file.h',
'browser/download/download_file_manager.cc',
'browser/download/download_file_manager.h',
+ 'browser/download/download_id.cc',
+ 'browser/download/download_id.h',
'browser/download/download_item.cc',
'browser/download/download_item.h',
'browser/download/download_manager.cc',