| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 DCHECK(!url.has_ref()); | 67 DCHECK(!url.has_ref()); |
| 68 document_url_ = url; | 68 document_url_ = url; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ServiceWorkerProviderHost::UpdatePotentialControllees( | 71 void ServiceWorkerProviderHost::UpdatePotentialControllees( |
| 72 ServiceWorkerVersion* installing_version, | 72 ServiceWorkerVersion* installing_version, |
| 73 ServiceWorkerVersion* waiting_version, | 73 ServiceWorkerVersion* waiting_version, |
| 74 ServiceWorkerVersion* active_version) { | 74 ServiceWorkerVersion* active_version) { |
| 75 if (installing_version != installing_version_.get()) { | 75 if (installing_version != installing_version_.get()) { |
| 76 scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_; | 76 scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_; |
| 77 if (previous_version) | 77 if (previous_version.get()) |
| 78 previous_version->RemovePotentialControllee(this); | 78 previous_version->RemovePotentialControllee(this); |
| 79 if (installing_version) | 79 if (installing_version) |
| 80 installing_version->AddPotentialControllee(this); | 80 installing_version->AddPotentialControllee(this); |
| 81 installing_version_ = installing_version; | 81 installing_version_ = installing_version; |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (waiting_version != waiting_version_.get()) { | 84 if (waiting_version != waiting_version_.get()) { |
| 85 scoped_refptr<ServiceWorkerVersion> previous_version = waiting_version_; | 85 scoped_refptr<ServiceWorkerVersion> previous_version = waiting_version_; |
| 86 if (previous_version) | 86 if (previous_version.get()) |
| 87 previous_version->RemovePotentialControllee(this); | 87 previous_version->RemovePotentialControllee(this); |
| 88 if (waiting_version) | 88 if (waiting_version) |
| 89 waiting_version->AddPotentialControllee(this); | 89 waiting_version->AddPotentialControllee(this); |
| 90 waiting_version_ = waiting_version; | 90 waiting_version_ = waiting_version; |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (active_version != active_version_.get()) { | 93 if (active_version != active_version_.get()) { |
| 94 scoped_refptr<ServiceWorkerVersion> previous_version = active_version_; | 94 scoped_refptr<ServiceWorkerVersion> previous_version = active_version_; |
| 95 if (previous_version) | 95 if (previous_version.get()) |
| 96 previous_version->RemovePotentialControllee(this); | 96 previous_version->RemovePotentialControllee(this); |
| 97 if (active_version) | 97 if (active_version) |
| 98 active_version->AddPotentialControllee(this); | 98 active_version->AddPotentialControllee(this); |
| 99 active_version_ = active_version; | 99 active_version_ = active_version; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ServiceWorkerProviderHost::SetControllerVersionAttribute( | 103 void ServiceWorkerProviderHost::SetControllerVersionAttribute( |
| 104 ServiceWorkerVersion* version) { | 104 ServiceWorkerVersion* version) { |
| 105 if (version == controlling_version_.get()) | 105 if (version == controlling_version_.get()) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); | 224 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); |
| 225 } | 225 } |
| 226 return info; | 226 return info; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool ServiceWorkerProviderHost::IsContextAlive() { | 229 bool ServiceWorkerProviderHost::IsContextAlive() { |
| 230 return context_ != NULL; | 230 return context_ != NULL; |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace content | 233 } // namespace content |
| OLD | NEW |