Index: content/browser/service_worker/service_worker_job_coordinator.cc |
diff --git a/content/browser/service_worker/service_worker_job_coordinator.cc b/content/browser/service_worker/service_worker_job_coordinator.cc |
index ccf42b062c29b8b15eee28c18017e022e5501fb9..f2b54389d1175e19292c0a9ed8ef78fad7ddf458 100644 |
--- a/content/browser/service_worker/service_worker_job_coordinator.cc |
+++ b/content/browser/service_worker/service_worker_job_coordinator.cc |
@@ -41,12 +41,23 @@ void ServiceWorkerJobCoordinator::JobQueue::Pop( |
jobs_.front()->Start(); |
} |
+void ServiceWorkerJobCoordinator::JobQueue::ClearForShutdown() { |
+ STLDeleteElements(&jobs_); |
+} |
+ |
ServiceWorkerJobCoordinator::ServiceWorkerJobCoordinator( |
base::WeakPtr<ServiceWorkerContextCore> context) |
: context_(context) { |
} |
ServiceWorkerJobCoordinator::~ServiceWorkerJobCoordinator() { |
+ if (!context_) { |
+ for (RegistrationJobMap::iterator it = jobs_.begin(); it != jobs_.end(); |
+ ++it) { |
+ it->second.ClearForShutdown(); |
+ } |
+ jobs_.clear(); |
+ } |
DCHECK(jobs_.empty()) << "Destroying ServiceWorkerJobCoordinator with " |
<< jobs_.size() << " job queues"; |
} |