Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: content/browser/service_worker/service_worker_job_coordinator.cc

Issue 305723003: Shut down the ServiceWorker system as the browser's shutting down. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove a redundant clear() Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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";
}

Powered by Google App Engine
This is Rietveld 408576698