| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 WebServiceWorkerRegistrationImpl::WebServiceWorkerRegistrationImpl( | 51 WebServiceWorkerRegistrationImpl::WebServiceWorkerRegistrationImpl( |
| 52 std::unique_ptr<ServiceWorkerRegistrationHandleReference> handle_ref) | 52 std::unique_ptr<ServiceWorkerRegistrationHandleReference> handle_ref) |
| 53 : handle_ref_(std::move(handle_ref)), proxy_(nullptr) { | 53 : handle_ref_(std::move(handle_ref)), proxy_(nullptr) { |
| 54 DCHECK(handle_ref_); | 54 DCHECK(handle_ref_); |
| 55 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, | 55 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, |
| 56 handle_ref_->handle_id()); | 56 handle_ref_->handle_id()); |
| 57 ServiceWorkerDispatcher* dispatcher = | 57 ServiceWorkerDispatcher* dispatcher = |
| 58 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 58 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 59 DCHECK(dispatcher); | 59 DCHECK(dispatcher); |
| 60 if (!dispatcher) |
| 61 return; |
| 60 dispatcher->AddServiceWorkerRegistration(handle_ref_->handle_id(), this); | 62 dispatcher->AddServiceWorkerRegistration(handle_ref_->handle_id(), this); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void WebServiceWorkerRegistrationImpl::SetInstalling( | 65 void WebServiceWorkerRegistrationImpl::SetInstalling( |
| 64 const scoped_refptr<WebServiceWorkerImpl>& service_worker) { | 66 const scoped_refptr<WebServiceWorkerImpl>& service_worker) { |
| 65 if (proxy_) | 67 if (proxy_) |
| 66 proxy_->setInstalling(WebServiceWorkerImpl::CreateHandle(service_worker)); | 68 proxy_->setInstalling(WebServiceWorkerImpl::CreateHandle(service_worker)); |
| 67 else | 69 else |
| 68 queued_tasks_.push_back(QueuedTask(INSTALLING, service_worker)); | 70 queued_tasks_.push_back(QueuedTask(INSTALLING, service_worker)); |
| 69 } | 71 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 169 } |
| 168 | 170 |
| 169 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { | 171 WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { |
| 170 ServiceWorkerDispatcher* dispatcher = | 172 ServiceWorkerDispatcher* dispatcher = |
| 171 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 173 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| 172 if (dispatcher) | 174 if (dispatcher) |
| 173 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); | 175 dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); |
| 174 } | 176 } |
| 175 | 177 |
| 176 } // namespace content | 178 } // namespace content |
| OLD | NEW |