Chromium Code Reviews| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 DCHECK(dispatcher); | 184 DCHECK(dispatcher); |
| 185 dispatcher->SetNavigationPreloadHeader(provider_impl->provider_id(), | 185 dispatcher->SetNavigationPreloadHeader(provider_impl->provider_id(), |
| 186 registration_id(), value.utf8(), | 186 registration_id(), value.utf8(), |
| 187 std::move(callbacks)); | 187 std::move(callbacks)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 int64_t WebServiceWorkerRegistrationImpl::registration_id() const { | 190 int64_t WebServiceWorkerRegistrationImpl::registration_id() const { |
| 191 return handle_ref_->registration_id(); | 191 return handle_ref_->registration_id(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 int64_t WebServiceWorkerRegistrationImpl::registrationId() const { | |
| 195 return registration_id(); | |
| 196 } | |
|
falken
2016/11/11 07:59:17
For code health, can we remove registration_id() a
falken
2016/11/11 08:08:07
(it's OK to do this as a followup patch, perhaps j
adithyas
2016/11/11 15:11:56
The function is used in 6 other files, so I'll mak
| |
| 197 | |
| 194 // static | 198 // static |
| 195 std::unique_ptr<blink::WebServiceWorkerRegistration::Handle> | 199 std::unique_ptr<blink::WebServiceWorkerRegistration::Handle> |
| 196 WebServiceWorkerRegistrationImpl::CreateHandle( | 200 WebServiceWorkerRegistrationImpl::CreateHandle( |
| 197 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { | 201 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { |
| 198 if (!registration) | 202 if (!registration) |
| 199 return nullptr; | 203 return nullptr; |
| 200 return base::MakeUnique<HandleImpl>(registration); | 204 return base::MakeUnique<HandleImpl>(registration); |
| 201 } | 205 } |
| 202 | 206 |
| 203 blink::WebServiceWorkerRegistration::Handle* | 207 blink::WebServiceWorkerRegistration::Handle* |
| 204 WebServiceWorkerRegistrationImpl::CreateLeakyHandle( | 208 WebServiceWorkerRegistrationImpl::CreateLeakyHandle( |
| 205 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { | 209 const scoped_refptr<WebServiceWorkerRegistrationImpl>& registration) { |
| 206 if (!registration) | 210 if (!registration) |
| 207 return nullptr; | 211 return nullptr; |
| 208 return new HandleImpl(registration); | 212 return new HandleImpl(registration); |
| 209 } | 213 } |
| 210 | 214 |
| 211 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { | 215 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { |
| 212 ServiceWorkerDispatcher* dispatcher = | 216 ServiceWorkerDispatcher* dispatcher = |
| 213 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 217 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 214 if (dispatcher) | 218 if (dispatcher) |
| 215 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); | 219 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); |
| 216 } | 220 } |
| 217 | 221 |
| 218 } // namespace content | 222 } // namespace content |
| OLD | NEW |