Chromium Code Reviews| Index: content/browser/storage_partition_impl.cc |
| diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc |
| index 5055f001d532fae0eba131cf38b6bc7a2c9ce314..c7e3669ab70b1cb99f1d82b6bfd05233648b9d48 100644 |
| --- a/content/browser/storage_partition_impl.cc |
| +++ b/content/browser/storage_partition_impl.cc |
| @@ -360,6 +360,7 @@ void StoragePartitionImpl::DataDeletionHelper::ClearQuotaManagedDataOnIOThread( |
| } |
| StoragePartitionImpl::StoragePartitionImpl( |
| + BrowserContext* browser_context, |
| const base::FilePath& partition_path, |
| storage::QuotaManager* quota_manager, |
| ChromeAppCacheService* appcache_service, |
| @@ -385,10 +386,13 @@ StoragePartitionImpl::StoragePartitionImpl( |
| special_storage_policy_(special_storage_policy), |
| geofencing_manager_(geofencing_manager), |
| host_zoom_level_context_(host_zoom_level_context), |
| - navigator_connect_context_(navigator_connect_context) { |
| + navigator_connect_context_(navigator_connect_context), |
| + browser_context_(browser_context) { |
| } |
| StoragePartitionImpl::~StoragePartitionImpl() { |
| + browser_context_ = nullptr; |
| + |
| // These message loop checks are just to avoid leaks in unittests. |
| if (GetDatabaseTracker() && |
| BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| @@ -411,8 +415,6 @@ StoragePartitionImpl::~StoragePartitionImpl() { |
| GetGeofencingManager()->Shutdown(); |
| } |
| -// TODO(ajwong): Break the direct dependency on |context|. We only |
| -// need 3 pieces of info from it. |
| StoragePartitionImpl* StoragePartitionImpl::Create( |
| BrowserContext* context, |
| bool in_memory, |
| @@ -468,8 +470,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create( |
| scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = |
| new ServiceWorkerContextWrapper(context); |
| - service_worker_context->Init( |
| - path, quota_manager->proxy(), context->GetSpecialStoragePolicy()); |
| + // Init() requires |storage_partition| so is done after the object is created. |
|
michaeln
2015/01/13 21:27:32
To avoid having to alter construction ordering, it
mlamouri (slow - plz ping)
2015/01/14 15:46:24
Ok. I guess we will never know if there are some s
|
| scoped_refptr<ChromeAppCacheService> appcache_service = |
| new ChromeAppCacheService(quota_manager->proxy()); |
| @@ -491,13 +492,20 @@ StoragePartitionImpl* StoragePartitionImpl::Create( |
| scoped_refptr<NavigatorConnectContext> navigator_connect_context = |
| new NavigatorConnectContext(service_worker_context); |
| - return new StoragePartitionImpl( |
| - partition_path, quota_manager.get(), appcache_service.get(), |
| + StoragePartitionImpl* storage_partition = new StoragePartitionImpl( |
| + context, partition_path, quota_manager.get(), appcache_service.get(), |
| filesystem_context.get(), database_tracker.get(), |
| dom_storage_context.get(), indexed_db_context.get(), |
| service_worker_context.get(), webrtc_identity_store.get(), |
| special_storage_policy.get(), geofencing_manager.get(), |
| host_zoom_level_context.get(), navigator_connect_context.get()); |
| + |
| + service_worker_context->Init(storage_partition, |
| + path, |
| + quota_manager->proxy(), |
| + context->GetSpecialStoragePolicy()); |
| + |
| + return storage_partition; |
| } |
| base::FilePath StoragePartitionImpl::GetPath() { |
| @@ -853,6 +861,10 @@ WebRTCIdentityStore* StoragePartitionImpl::GetWebRTCIdentityStore() { |
| return webrtc_identity_store_.get(); |
| } |
| +BrowserContext* StoragePartitionImpl::browser_context() const { |
| + return browser_context_; |
| +} |
| + |
| void StoragePartitionImpl::OverrideQuotaManagerForTesting( |
| storage::QuotaManager* quota_manager) { |
| quota_manager_ = quota_manager; |