diff options
author | jiayl@chromium.org <jiayl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-08 22:03:53 +0000 |
---|---|---|
committer | jiayl@chromium.org <jiayl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-08 22:03:53 +0000 |
commit | ec346e097fdc2b32dbf7305179182f43393b5be1 (patch) | |
tree | 7464385f6bbc638b3b6b6b1a59385db0b270e6c6 /content/browser/storage_partition_impl.cc | |
parent | f06dc19bf8afa46c8a74d94ab2c35cb4118de883 (diff) | |
download | chromium_src-ec346e097fdc2b32dbf7305179182f43393b5be1.zip chromium_src-ec346e097fdc2b32dbf7305179182f43393b5be1.tar.gz chromium_src-ec346e097fdc2b32dbf7305179182f43393b5be1.tar.bz2 |
Adds a SqlLite backend to WebRTCIdentityStore.
WebRTCIdentityStore maintains a list of inflight requests. If a new request is identical (i.e. same origin, identity_name, common_name) to a inflight request, the new one is joined into the existing one, so that it will not make duplicated requests to the backend or generate dupicated identities.
If the backend does not find an existing identity, WebRTCIdentityStore generates a new one and adds it to the backend.
The backend borrows most of the design from SQLiteServerBoundCertStore::Backend. It loads the database into memory on the first find request. Add or delete database operations are batched to commit every 30 seconds or every 512 operations.
BUG=
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=216264
Review URL: https://chromiumcodereview.appspot.com/21453002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/storage_partition_impl.cc')
-rw-r--r-- | content/browser/storage_partition_impl.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 1775b5f..361b4d1 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc @@ -252,6 +252,7 @@ struct StoragePartitionImpl::DataDeletionHelper { net::URLRequestContextGetter* rq_context, DOMStorageContextWrapper* dom_storage_context, quota::QuotaManager* quota_manager, + WebRTCIdentityStore* webrtc_identity_store, const base::Time begin, const base::Time end); @@ -284,7 +285,7 @@ StoragePartitionImpl::StoragePartitionImpl( webkit_database::DatabaseTracker* database_tracker, DOMStorageContextWrapper* dom_storage_context, IndexedDBContextImpl* indexed_db_context, - scoped_ptr<WebRTCIdentityStore> webrtc_identity_store) + WebRTCIdentityStore* webrtc_identity_store) : partition_path_(partition_path), quota_manager_(quota_manager), appcache_service_(appcache_service), @@ -292,7 +293,7 @@ StoragePartitionImpl::StoragePartitionImpl( database_tracker_(database_tracker), dom_storage_context_(dom_storage_context), indexed_db_context_(indexed_db_context), - webrtc_identity_store_(webrtc_identity_store.Pass()) {} + webrtc_identity_store_(webrtc_identity_store) {} StoragePartitionImpl::~StoragePartitionImpl() { // These message loop checks are just to avoid leaks in unittests. @@ -367,8 +368,8 @@ StoragePartitionImpl* StoragePartitionImpl::Create( scoped_refptr<ChromeAppCacheService> appcache_service = new ChromeAppCacheService(quota_manager->proxy()); - scoped_ptr<WebRTCIdentityStore> webrtc_identity_store( - new WebRTCIdentityStore()); + scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( + new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); return new StoragePartitionImpl(partition_path, quota_manager.get(), @@ -377,7 +378,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create( database_tracker.get(), dom_storage_context.get(), indexed_db_context.get(), - webrtc_identity_store.Pass()); + webrtc_identity_store.get()); } base::FilePath StoragePartitionImpl::GetPath() { @@ -431,7 +432,8 @@ void StoragePartitionImpl::ClearDataImpl( // DataDeletionHelper::DecrementTaskCountOnUI(). helper->ClearDataOnUIThread( remove_mask, quota_storage_remove_mask, remove_origin, - GetPath(), rq_context, dom_storage_context_, quota_manager_, begin, end); + GetPath(), rq_context, dom_storage_context_, quota_manager_, + webrtc_identity_store_, begin, end); } void StoragePartitionImpl:: @@ -546,6 +548,7 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( net::URLRequestContextGetter* rq_context, DOMStorageContextWrapper* dom_storage_context, quota::QuotaManager* quota_manager, + WebRTCIdentityStore* webrtc_identity_store, const base::Time begin, const base::Time end) { DCHECK_NE(remove_mask, 0u); @@ -602,6 +605,18 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( path, begin, end, decrement_callback)); } + if (remove_mask & REMOVE_DATA_MASK_WEBRTC_IDENTITY) { + IncrementTaskCountOnUI(); + BrowserThread::PostTask( + BrowserThread::IO, + FROM_HERE, + base::Bind(&WebRTCIdentityStore::DeleteBetween, + webrtc_identity_store, + begin, + end, + decrement_callback)); + } + DecrementTaskCountOnUI(); } |