| 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/browser/service_worker/service_worker_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "content/browser/message_port_message_filter.h" | 8 #include "content/browser/message_port_message_filter.h" |
| 9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
| 10 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 10 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DecreaseProcessReference(*it); | 48 DecreaseProcessReference(*it); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ServiceWorkerProviderHost::OnRegistrationFailed( | 52 void ServiceWorkerProviderHost::OnRegistrationFailed( |
| 53 ServiceWorkerRegistration* registration) { | 53 ServiceWorkerRegistration* registration) { |
| 54 DCHECK_EQ(associated_registration_.get(), registration); | 54 DCHECK_EQ(associated_registration_.get(), registration); |
| 55 DisassociateRegistration(); | 55 DisassociateRegistration(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ServiceWorkerProviderHost::OnVersionAttributesChanged( |
| 59 ServiceWorkerRegistration* registration, |
| 60 ChangedVersionAttributesMask changed_mask, |
| 61 const ServiceWorkerRegistrationInfo& info) { |
| 62 DCHECK_EQ(associated_registration_.get(), registration); |
| 63 scoped_refptr<ServiceWorkerVersion> active_version = |
| 64 registration->active_version(); |
| 65 if (active_version.get() && active_version->skip_waiting() && |
| 66 active_version->status() == ServiceWorkerVersion::INSTALLED) { |
| 67 active_version->RegisterStatusChangeCallback( |
| 68 base::Bind(&ServiceWorkerProviderHost::SetControllerVersionAttribute, |
| 69 AsWeakPtr(), active_version)); |
| 70 } |
| 71 } |
| 72 |
| 58 void ServiceWorkerProviderHost::SetDocumentUrl(const GURL& url) { | 73 void ServiceWorkerProviderHost::SetDocumentUrl(const GURL& url) { |
| 59 DCHECK(!url.has_ref()); | 74 DCHECK(!url.has_ref()); |
| 60 document_url_ = url; | 75 document_url_ = url; |
| 61 } | 76 } |
| 62 | 77 |
| 63 void ServiceWorkerProviderHost::SetTopmostFrameUrl(const GURL& url) { | 78 void ServiceWorkerProviderHost::SetTopmostFrameUrl(const GURL& url) { |
| 64 topmost_frame_url_ = url; | 79 topmost_frame_url_ = url; |
| 65 } | 80 } |
| 66 | 81 |
| 67 void ServiceWorkerProviderHost::SetControllerVersionAttribute( | 82 void ServiceWorkerProviderHost::SetControllerVersionAttribute( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 context_->process_manager()->RemoveProcessReferenceFromPattern( | 259 context_->process_manager()->RemoveProcessReferenceFromPattern( |
| 245 pattern, process_id_); | 260 pattern, process_id_); |
| 246 } | 261 } |
| 247 } | 262 } |
| 248 | 263 |
| 249 bool ServiceWorkerProviderHost::IsContextAlive() { | 264 bool ServiceWorkerProviderHost::IsContextAlive() { |
| 250 return context_ != NULL; | 265 return context_ != NULL; |
| 251 } | 266 } |
| 252 | 267 |
| 253 } // namespace content | 268 } // namespace content |
| OLD | NEW |