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

Side by Side Diff: content/browser/service_worker/service_worker_unregister_job.cc

Issue 377153003: Service Worker: set active worker to REDUNDANT when unregistered (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make setting redundant clearly the responsibility of SWStorage Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698