OLD | NEW |
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 250 } |
251 | 251 |
252 void ServiceWorkerDispatcher::OnUnregistered( | 252 void ServiceWorkerDispatcher::OnUnregistered( |
253 int thread_id, | 253 int thread_id, |
254 int request_id) { | 254 int request_id) { |
255 WebServiceWorkerUnregistrationCallbacks* callbacks = | 255 WebServiceWorkerUnregistrationCallbacks* callbacks = |
256 pending_unregistration_callbacks_.Lookup(request_id); | 256 pending_unregistration_callbacks_.Lookup(request_id); |
257 DCHECK(callbacks); | 257 DCHECK(callbacks); |
258 if (!callbacks) | 258 if (!callbacks) |
259 return; | 259 return; |
260 #ifdef DISABLE_SERVICEWORKER_UNREGISTER_RESOLVE_TO_BOOLEAN | |
261 callbacks->onSuccess(NULL); | |
262 #else | |
263 bool is_success = true; | 260 bool is_success = true; |
264 callbacks->onSuccess(&is_success); | 261 callbacks->onSuccess(&is_success); |
265 #endif | |
266 pending_unregistration_callbacks_.Remove(request_id); | 262 pending_unregistration_callbacks_.Remove(request_id); |
267 } | 263 } |
268 | 264 |
269 void ServiceWorkerDispatcher::OnRegistrationError( | 265 void ServiceWorkerDispatcher::OnRegistrationError( |
270 int thread_id, | 266 int thread_id, |
271 int request_id, | 267 int request_id, |
272 WebServiceWorkerError::ErrorType error_type, | 268 WebServiceWorkerError::ErrorType error_type, |
273 const base::string16& message) { | 269 const base::string16& message) { |
274 WebServiceWorkerRegistrationCallbacks* callbacks = | 270 WebServiceWorkerRegistrationCallbacks* callbacks = |
275 pending_registration_callbacks_.Lookup(request_id); | 271 pending_registration_callbacks_.Lookup(request_id); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 registrations_[registration_handle_id] = registration; | 467 registrations_[registration_handle_id] = registration; |
472 } | 468 } |
473 | 469 |
474 void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration( | 470 void ServiceWorkerDispatcher::RemoveServiceWorkerRegistration( |
475 int registration_handle_id) { | 471 int registration_handle_id) { |
476 DCHECK(ContainsKey(registrations_, registration_handle_id)); | 472 DCHECK(ContainsKey(registrations_, registration_handle_id)); |
477 registrations_.erase(registration_handle_id); | 473 registrations_.erase(registration_handle_id); |
478 } | 474 } |
479 | 475 |
480 } // namespace content | 476 } // namespace content |
OLD | NEW |