OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 storage_partition_ = nullptr; | 136 storage_partition_ = nullptr; |
137 process_manager_->Shutdown(); | 137 process_manager_->Shutdown(); |
138 BrowserThread::PostTask( | 138 BrowserThread::PostTask( |
139 BrowserThread::IO, | 139 BrowserThread::IO, |
140 FROM_HERE, | 140 FROM_HERE, |
141 base::Bind(&ServiceWorkerContextWrapper::ShutdownOnIO, this)); | 141 base::Bind(&ServiceWorkerContextWrapper::ShutdownOnIO, this)); |
142 } | 142 } |
143 | 143 |
144 void ServiceWorkerContextWrapper::DeleteAndStartOver() { | 144 void ServiceWorkerContextWrapper::DeleteAndStartOver() { |
145 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 145 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 146 if (!context_core_) { |
| 147 // The context could be null due to system shutdown or restart failure. In |
| 148 // either case, we should not have to recover the system, so just return |
| 149 // here. |
| 150 LOG(ERROR) << "ServiceWorkerContextCore is no longer alive."; |
| 151 return; |
| 152 } |
146 context_core_->DeleteAndStartOver( | 153 context_core_->DeleteAndStartOver( |
147 base::Bind(&ServiceWorkerContextWrapper::DidDeleteAndStartOver, this)); | 154 base::Bind(&ServiceWorkerContextWrapper::DidDeleteAndStartOver, this)); |
148 } | 155 } |
149 | 156 |
150 StoragePartitionImpl* ServiceWorkerContextWrapper::storage_partition() const { | 157 StoragePartitionImpl* ServiceWorkerContextWrapper::storage_partition() const { |
151 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 158 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
152 return storage_partition_; | 159 return storage_partition_; |
153 } | 160 } |
154 | 161 |
155 void ServiceWorkerContextWrapper::set_storage_partition( | 162 void ServiceWorkerContextWrapper::set_storage_partition( |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 observer_list_->Notify(FROM_HERE, | 640 observer_list_->Notify(FROM_HERE, |
634 &ServiceWorkerContextObserver::OnStorageWiped); | 641 &ServiceWorkerContextObserver::OnStorageWiped); |
635 } | 642 } |
636 | 643 |
637 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 644 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
638 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 645 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
639 return context_core_.get(); | 646 return context_core_.get(); |
640 } | 647 } |
641 | 648 |
642 } // namespace content | 649 } // namespace content |
OLD | NEW |