| OLD | NEW |
| 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/child/service_worker/web_service_worker_registration_impl.h" | 5 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 // static | 194 // static |
| 195 std::unique_ptr<blink::WebServiceWorkerRegistration::Handle> | 195 std::unique_ptr<blink::WebServiceWorkerRegistration::Handle> |
| 196 WebServiceWorkerRegistrationImpl::CreateHandle( | 196 WebServiceWorkerRegistrationImpl::CreateHandle( |
| 197 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { | 197 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { |
| 198 if (!registration) | 198 if (!registration) |
| 199 return nullptr; | 199 return nullptr; |
| 200 return base::MakeUnique<HandleImpl>(registration); | 200 return base::MakeUnique<HandleImpl>(registration); |
| 201 } | 201 } |
| 202 | 202 |
| 203 blink::WebServiceWorkerRegistration::Handle* | |
| 204 WebServiceWorkerRegistrationImpl::CreateLeakyHandle( | |
| 205 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { | |
| 206 if (!registration) | |
| 207 return nullptr; | |
| 208 return new HandleImpl(registration); | |
| 209 } | |
| 210 | |
| 211 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { | 203 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { |
| 212 ServiceWorkerDispatcher* dispatcher = | 204 ServiceWorkerDispatcher* dispatcher = |
| 213 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 205 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 214 if (dispatcher) | 206 if (dispatcher) |
| 215 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); | 207 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); |
| 216 } | 208 } |
| 217 | 209 |
| 218 } // namespace content | 210 } // namespace content |
| OLD | NEW |