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..e6a556197310c47e1785b2bb5ae6e0955367495e 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, |
@@ -491,13 +493,17 @@ 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->set_storage_partition(storage_partition); |
+ |
+ return storage_partition; |
} |
base::FilePath StoragePartitionImpl::GetPath() { |
@@ -853,6 +859,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; |