| 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 "content/child/service_worker/service_worker_dispatcher.h" | 11 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 11 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" | 12 #include "content/child/service_worker/service_worker_registration_handle_refere
nce.h" |
| 12 #include "content/child/service_worker/web_service_worker_impl.h" | 13 #include "content/child/service_worker/web_service_worker_impl.h" |
| 13 #include "content/child/service_worker/web_service_worker_provider_impl.h" | 14 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
| 14 #include "content/common/service_worker/service_worker_types.h" | 15 #include "content/common/service_worker/service_worker_types.h" |
| 15 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRegistrationProxy.h" | 16 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRegistrationProxy.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 DCHECK(dispatcher); | 143 DCHECK(dispatcher); |
| 143 dispatcher->UnregisterServiceWorker(provider_impl->provider_id(), | 144 dispatcher->UnregisterServiceWorker(provider_impl->provider_id(), |
| 144 registration_id(), callbacks); | 145 registration_id(), callbacks); |
| 145 } | 146 } |
| 146 | 147 |
| 147 int64_t WebServiceWorkerRegistrationImpl::registration_id() const { | 148 int64_t WebServiceWorkerRegistrationImpl::registration_id() const { |
| 148 return handle_ref_->registration_id(); | 149 return handle_ref_->registration_id(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 // static | 152 // static |
| 152 blink::WebPassOwnPtr<blink::WebServiceWorkerRegistration::Handle> | 153 std::unique_ptr<blink::WebServiceWorkerRegistration::Handle> |
| 153 WebServiceWorkerRegistrationImpl::CreateHandle( | 154 WebServiceWorkerRegistrationImpl::CreateHandle( |
| 154 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { | 155 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { |
| 155 if (!registration) | 156 if (!registration) |
| 156 return nullptr; | 157 return nullptr; |
| 157 return blink::adoptWebPtr(new HandleImpl(registration)); | 158 return base::WrapUnique(new HandleImpl(registration)); |
| 158 } | 159 } |
| 159 | 160 |
| 160 blink::WebServiceWorkerRegistration::Handle* | 161 blink::WebServiceWorkerRegistration::Handle* |
| 161 WebServiceWorkerRegistrationImpl::CreateLeakyHandle( | 162 WebServiceWorkerRegistrationImpl::CreateLeakyHandle( |
| 162 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { | 163 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { |
| 163 if (!registration) | 164 if (!registration) |
| 164 return nullptr; | 165 return nullptr; |
| 165 return new HandleImpl(registration); | 166 return new HandleImpl(registration); |
| 166 } | 167 } |
| 167 | 168 |
| 168 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { | 169 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { |
| 169 ServiceWorkerDispatcher* dispatcher = | 170 ServiceWorkerDispatcher* dispatcher = |
| 170 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 171 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 171 if (dispatcher) | 172 if (dispatcher) |
| 172 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); | 173 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace content | 176 } // namespace content |
| OLD | NEW |