Chromium Code Reviews| 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 85d9830a529c493123c99ac40774c86816ed4696..1dafcef098b02b8f0fef19f5a4fd82da70792057 100644 |
| --- a/content/browser/service_worker/service_worker_context_wrapper.cc |
| +++ b/content/browser/service_worker/service_worker_context_wrapper.cc |
| @@ -130,6 +130,29 @@ void ServiceWorkerContextWrapper::Shutdown() { |
| base::Bind(&ServiceWorkerContextWrapper::ShutdownOnIO, this)); |
| } |
| +void ServiceWorkerContextWrapper::InitializeResourceContext( |
| + ResourceContext* resource_context, |
| + scoped_refptr<net::URLRequestContextGetter> request_context_getter) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + resource_context_ = resource_context; |
| + request_context_getter_ = request_context_getter; |
| + // Can be null in tests. |
| + if (request_context_getter_) |
| + request_context_getter_->AddObserver(this); |
| +} |
| + |
| +void ServiceWorkerContextWrapper::OnContextShuttingDown() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + request_context_getter_->RemoveObserver(this); |
|
michaeln
2016/03/10 21:15:53
You mentioned this isn't called on ContentShell.
mmenke
2016/03/10 21:20:51
I view this as a hack to resolve incorrect class d
|
| + |
| + // OnContextShuttingDown is called when the ProfileIOData (ResourceContext) is |
| + // shutting down, so call ShutdownOnIO() to clear resource_context_. |
| + // This doesn't seem to be called when using content_shell, so we still must |
| + // also call ShutdownOnIO() in Shutdown(), which is called when the storage |
| + // partition is destroyed. |
| + ShutdownOnIO(); |
| +} |
| + |
| void ServiceWorkerContextWrapper::DeleteAndStartOver() { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| if (!context_core_) { |
| @@ -158,12 +181,6 @@ ResourceContext* ServiceWorkerContextWrapper::resource_context() { |
| return resource_context_; |
| } |
| -void ServiceWorkerContextWrapper::set_resource_context( |
| - ResourceContext* resource_context) { |
| - DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| - resource_context_ = resource_context; |
| -} |
| - |
| static void FinishRegistrationOnIO( |
| const ServiceWorkerContext::ResultCallback& continuation, |
| ServiceWorkerStatusCode status, |