Index: content/browser/service_worker/service_worker_context_wrapper.cc |
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc |
index 8f9b1db06205cb20187df3d079abd442e3c29f44..50e710f64549a4cc3c41c5667daffe5a5cfe2d3e 100644 |
--- a/content/browser/service_worker/service_worker_context_wrapper.cc |
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc |
@@ -21,6 +21,7 @@ |
#include "content/browser/service_worker/service_worker_process_manager.h" |
#include "content/browser/service_worker/service_worker_quota_client.h" |
#include "content/browser/service_worker/service_worker_request_handler.h" |
+#include "content/browser/storage_partition_impl.h" |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/service_worker_context.h" |
@@ -74,15 +75,20 @@ ServiceWorkerContextWrapper::ServiceWorkerContextWrapper( |
new ObserverListThreadSafe<ServiceWorkerContextObserver>()), |
process_manager_(new ServiceWorkerProcessManager(browser_context)), |
is_incognito_(false) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
} |
ServiceWorkerContextWrapper::~ServiceWorkerContextWrapper() { |
} |
void ServiceWorkerContextWrapper::Init( |
+ StoragePartitionImpl* storage_partition, |
const base::FilePath& user_data_directory, |
storage::QuotaManagerProxy* quota_manager_proxy, |
storage::SpecialStoragePolicy* special_storage_policy) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
+ storage_partition_ = storage_partition; |
is_incognito_ = user_data_directory.empty(); |
base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager( |
@@ -103,6 +109,8 @@ void ServiceWorkerContextWrapper::Init( |
void ServiceWorkerContextWrapper::Shutdown() { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
+ storage_partition_ = nullptr; |
process_manager_->Shutdown(); |
BrowserThread::PostTask( |
BrowserThread::IO, |
@@ -121,6 +129,11 @@ ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
return context_core_.get(); |
} |
+StoragePartitionImpl* ServiceWorkerContextWrapper::storage_partition() const { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ return storage_partition_; |
+} |
+ |
static void FinishRegistrationOnIO( |
const ServiceWorkerContext::ResultCallback& continuation, |
ServiceWorkerStatusCode status, |