| 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/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 g_dispatcher_tls.Pointer()->Get()); | 257 g_dispatcher_tls.Pointer()->Get()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void ServiceWorkerDispatcher::WillStopCurrentWorkerThread() { | 260 void ServiceWorkerDispatcher::WillStopCurrentWorkerThread() { |
| 261 delete this; | 261 delete this; |
| 262 } | 262 } |
| 263 | 263 |
| 264 scoped_refptr<WebServiceWorkerImpl> | 264 scoped_refptr<WebServiceWorkerImpl> |
| 265 ServiceWorkerDispatcher::GetOrCreateServiceWorker( | 265 ServiceWorkerDispatcher::GetOrCreateServiceWorker( |
| 266 scoped_ptr<ServiceWorkerHandleReference> handle_ref) { | 266 scoped_ptr<ServiceWorkerHandleReference> handle_ref) { |
| 267 if (handle_ref->handle_id() == kInvalidServiceWorkerHandleId) | 267 if (!handle_ref) |
| 268 return nullptr; | 268 return nullptr; |
| 269 | 269 |
| 270 WorkerObjectMap::iterator found = | 270 WorkerObjectMap::iterator found = |
| 271 service_workers_.find(handle_ref->handle_id()); | 271 service_workers_.find(handle_ref->handle_id()); |
| 272 if (found != service_workers_.end()) | 272 if (found != service_workers_.end()) |
| 273 return found->second; | 273 return found->second; |
| 274 | 274 |
| 275 // WebServiceWorkerImpl constructor calls AddServiceWorker. | 275 // WebServiceWorkerImpl constructor calls AddServiceWorker. |
| 276 return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get()); | 276 return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get()); |
| 277 } | 277 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 return ServiceWorkerRegistrationHandleReference::Adopt( | 762 return ServiceWorkerRegistrationHandleReference::Adopt( |
| 763 info, thread_safe_sender_.get()); | 763 info, thread_safe_sender_.get()); |
| 764 } | 764 } |
| 765 | 765 |
| 766 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( | 766 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( |
| 767 const ServiceWorkerObjectInfo& info) { | 767 const ServiceWorkerObjectInfo& info) { |
| 768 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); | 768 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace content | 771 } // namespace content |
| OLD | NEW |