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

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 554573002: SWRegistration::unregister returns false when the registration is already unregistered. (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/child/service_worker/service_worker_dispatcher.h" 5 #include "content/child/service_worker/service_worker_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "content/child/child_thread.h" 10 #include "content/child/child_thread.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 registration->SetInstalling(GetServiceWorker(attrs.installing, true)); 255 registration->SetInstalling(GetServiceWorker(attrs.installing, true));
256 registration->SetWaiting(GetServiceWorker(attrs.waiting, true)); 256 registration->SetWaiting(GetServiceWorker(attrs.waiting, true));
257 registration->SetActive(GetServiceWorker(attrs.active, true)); 257 registration->SetActive(GetServiceWorker(attrs.active, true));
258 258
259 callbacks->onSuccess(registration); 259 callbacks->onSuccess(registration);
260 pending_registration_callbacks_.Remove(request_id); 260 pending_registration_callbacks_.Remove(request_id);
261 } 261 }
262 262
263 void ServiceWorkerDispatcher::OnUnregistered( 263 void ServiceWorkerDispatcher::OnUnregistered(
264 int thread_id, 264 int thread_id,
265 int request_id) { 265 int request_id,
266 ServiceWorkerStatusCode status) {
266 WebServiceWorkerUnregistrationCallbacks* callbacks = 267 WebServiceWorkerUnregistrationCallbacks* callbacks =
267 pending_unregistration_callbacks_.Lookup(request_id); 268 pending_unregistration_callbacks_.Lookup(request_id);
268 DCHECK(callbacks); 269 DCHECK(callbacks);
269 if (!callbacks) 270 if (!callbacks)
270 return; 271 return;
271 bool is_success = true; 272 bool is_success = (status == SERVICE_WORKER_OK);
272 callbacks->onSuccess(&is_success); 273 callbacks->onSuccess(&is_success);
273 pending_unregistration_callbacks_.Remove(request_id); 274 pending_unregistration_callbacks_.Remove(request_id);
274 } 275 }
275 276
276 void ServiceWorkerDispatcher::OnRegistrationError( 277 void ServiceWorkerDispatcher::OnRegistrationError(
277 int thread_id, 278 int thread_id,
278 int request_id, 279 int request_id,
279 WebServiceWorkerError::ErrorType error_type, 280 WebServiceWorkerError::ErrorType error_type,
280 const base::string16& message) { 281 const base::string16& message) {
281 WebServiceWorkerRegistrationCallbacks* callbacks = 282 WebServiceWorkerRegistrationCallbacks* callbacks =
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 registrations_[registration_handle_id] = registration; 502 registrations_[registration_handle_id] = registration;
502 } 503 }
503 504
504 void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration( 505 void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration(
505 int registration_handle_id) { 506 int registration_handle_id) {
506 DCHECK(ContainsKey(registrations_, registration_handle_id)); 507 DCHECK(ContainsKey(registrations_, registration_handle_id));
507 registrations_.erase(registration_handle_id); 508 registrations_.erase(registration_handle_id);
508 } 509 }
509 510
510 } // namespace content 511 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698