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

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

Issue 224733014: Introduce ServiceWorkerHandle for tracking WebServiceWorkerImpl reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 30 matching lines...) Expand all
41 } 41 }
42 42
43 RegistrationJobType ServiceWorkerUnregisterJob::GetType() { 43 RegistrationJobType ServiceWorkerUnregisterJob::GetType() {
44 return ServiceWorkerRegisterJobBase::UNREGISTER; 44 return ServiceWorkerRegisterJobBase::UNREGISTER;
45 } 45 }
46 46
47 void ServiceWorkerUnregisterJob::DeleteExistingRegistration( 47 void ServiceWorkerUnregisterJob::DeleteExistingRegistration(
48 ServiceWorkerStatusCode status, 48 ServiceWorkerStatusCode status,
49 const scoped_refptr<ServiceWorkerRegistration>& registration) { 49 const scoped_refptr<ServiceWorkerRegistration>& registration) {
50 if (status == SERVICE_WORKER_OK) { 50 if (status == SERVICE_WORKER_OK) {
51 registration->Shutdown();
52 context_->storage()->DeleteRegistration( 51 context_->storage()->DeleteRegistration(
53 pattern_, 52 pattern_,
54 base::Bind(&ServiceWorkerUnregisterJob::Complete, 53 base::Bind(&ServiceWorkerUnregisterJob::Complete,
55 weak_factory_.GetWeakPtr())); 54 weak_factory_.GetWeakPtr()));
56 return; 55 return;
57 } 56 }
58 57
59 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { 58 if (status == SERVICE_WORKER_ERROR_NOT_FOUND) {
60 // The previous registration does not exist, which is ok. 59 // The previous registration does not exist, which is ok.
61 Complete(SERVICE_WORKER_OK); 60 Complete(SERVICE_WORKER_OK);
62 return; 61 return;
63 } 62 }
64 63
65 Complete(status); 64 Complete(status);
66 } 65 }
67 66
68 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) { 67 void ServiceWorkerUnregisterJob::Complete(ServiceWorkerStatusCode status) {
69 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin(); 68 for (std::vector<UnregistrationCallback>::iterator it = callbacks_.begin();
70 it != callbacks_.end(); 69 it != callbacks_.end();
71 ++it) { 70 ++it) {
72 it->Run(status); 71 it->Run(status);
73 } 72 }
74 context_->job_coordinator()->FinishJob(pattern_, this); 73 context_->job_coordinator()->FinishJob(pattern_, this);
75 } 74 }
76 75
77 } // namespace content 76 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698