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

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: Add const 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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 registration->SetWaiting(GetServiceWorker(attrs.waiting, true)); 270 registration->SetWaiting(GetServiceWorker(attrs.waiting, true));
271 registration->SetActive(GetServiceWorker(attrs.active, true)); 271 registration->SetActive(GetServiceWorker(attrs.active, true));
272 272
273 callbacks->onSuccess(registration); 273 callbacks->onSuccess(registration);
274 pending_registration_callbacks_.Remove(request_id); 274 pending_registration_callbacks_.Remove(request_id);
275 TRACE_EVENT_ASYNC_END0("ServiceWorker", 275 TRACE_EVENT_ASYNC_END0("ServiceWorker",
276 "ServiceWorkerDispatcher::RegisterServiceWorker", 276 "ServiceWorkerDispatcher::RegisterServiceWorker",
277 request_id); 277 request_id);
278 } 278 }
279 279
280 void ServiceWorkerDispatcher::OnUnregistered( 280 void ServiceWorkerDispatcher::OnUnregistered(int thread_id,
281 int thread_id, 281 int request_id,
282 int request_id) { 282 bool is_success) {
283 WebServiceWorkerUnregistrationCallbacks* callbacks = 283 WebServiceWorkerUnregistrationCallbacks* callbacks =
284 pending_unregistration_callbacks_.Lookup(request_id); 284 pending_unregistration_callbacks_.Lookup(request_id);
285 TRACE_EVENT_ASYNC_STEP_INTO0( 285 TRACE_EVENT_ASYNC_STEP_INTO0(
286 "ServiceWorker", 286 "ServiceWorker",
287 "ServiceWorkerDispatcher::UnregisterServiceWorker", 287 "ServiceWorkerDispatcher::UnregisterServiceWorker",
288 request_id, 288 request_id,
289 "OnUnregistered"); 289 "OnUnregistered");
290 DCHECK(callbacks); 290 DCHECK(callbacks);
291 if (!callbacks) 291 if (!callbacks)
292 return; 292 return;
293 bool is_success = true;
294 callbacks->onSuccess(&is_success); 293 callbacks->onSuccess(&is_success);
295 pending_unregistration_callbacks_.Remove(request_id); 294 pending_unregistration_callbacks_.Remove(request_id);
296 TRACE_EVENT_ASYNC_END0("ServiceWorker", 295 TRACE_EVENT_ASYNC_END0("ServiceWorker",
297 "ServiceWorkerDispatcher::UnregisterServiceWorker", 296 "ServiceWorkerDispatcher::UnregisterServiceWorker",
298 request_id); 297 request_id);
299 } 298 }
300 299
301 void ServiceWorkerDispatcher::OnRegistrationError( 300 void ServiceWorkerDispatcher::OnRegistrationError(
302 int thread_id, 301 int thread_id,
303 int request_id, 302 int request_id,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 registrations_[registration_handle_id] = registration; 556 registrations_[registration_handle_id] = registration;
558 } 557 }
559 558
560 void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration( 559 void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration(
561 int registration_handle_id) { 560 int registration_handle_id) {
562 DCHECK(ContainsKey(registrations_, registration_handle_id)); 561 DCHECK(ContainsKey(registrations_, registration_handle_id));
563 registrations_.erase(registration_handle_id); 562 registrations_.erase(registration_handle_id);
564 } 563 }
565 564
566 } // namespace content 565 } // namespace content
OLDNEW
« no previous file with comments | « content/child/service_worker/service_worker_dispatcher.h ('k') | content/common/service_worker/service_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698