OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_unregister_job.h" | 5 #include "content/browser/service_worker/service_worker_unregister_job.h" |
6 | 6 |
7 #include "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
8 #include "content/browser/service_worker/service_worker_job_coordinator.h" | 8 #include "content/browser/service_worker/service_worker_job_coordinator.h" |
9 #include "content/browser/service_worker/service_worker_registration.h" | 9 #include "content/browser/service_worker/service_worker_registration.h" |
10 #include "content/browser/service_worker/service_worker_storage.h" | 10 #include "content/browser/service_worker/service_worker_storage.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 | 64 |
65 DCHECK(registration); | 65 DCHECK(registration); |
66 DeleteRegistration(registration); | 66 DeleteRegistration(registration); |
67 } | 67 } |
68 | 68 |
69 void ServiceWorkerUnregisterJob::DeleteRegistration( | 69 void ServiceWorkerUnregisterJob::DeleteRegistration( |
70 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 70 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
71 // TODO(nhiroki): When we've implemented the installing version, terminate and | 71 // TODO(nhiroki): When we've implemented the installing version, terminate and |
72 // set it to redundant here as per spec. | 72 // set it to redundant here as per spec. |
73 | 73 |
74 if (registration->waiting_version()) { | |
75 registration->waiting_version()->SetStatus( | |
76 ServiceWorkerVersion::REDUNDANT); | |
michaeln
2014/07/10 00:55:23
i think we have to Doom the active version if ther
falken
2014/07/10 14:05:12
I thought this would work because when an updated
| |
77 } | |
78 | |
79 context_->storage()->DeleteRegistration( | 74 context_->storage()->DeleteRegistration( |
80 registration->id(), | 75 registration->id(), |
81 registration->script_url().GetOrigin(), | 76 registration->script_url().GetOrigin(), |
82 base::Bind(&ServiceWorkerUnregisterJob::Complete, | 77 base::Bind(&ServiceWorkerUnregisterJob::Complete, |
83 weak_factory_.GetWeakPtr())); | 78 weak_factory_.GetWeakPtr())); |
84 } | 79 } |
85 | 80 |
86 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { | 81 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { |
87 CompleteInternal(status); | 82 CompleteInternal(status); |
88 context_->job_coordinator()->FinishJob(pattern_, this); | 83 context_->job_coordinator()->FinishJob(pattern_, this); |
89 } | 84 } |
90 | 85 |
91 void ServiceWorkerUnregisterJob::CompleteInternal( | 86 void ServiceWorkerUnregisterJob::CompleteInternal( |
92 ServiceWorkerStatusCode status) { | 87 ServiceWorkerStatusCode status) { |
93 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); | 88 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); |
94 it != callbacks_.end(); | 89 it != callbacks_.end(); |
95 ++it) { | 90 ++it) { |
96 it->Run(status); | 91 it->Run(status); |
97 } | 92 } |
98 } | 93 } |
99 | 94 |
100 } // namespace content | 95 } // namespace content |
OLD | NEW |