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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_; | 89 scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_; |
90 installing_version_ = version; | 90 installing_version_ = version; |
91 if (version) | 91 if (version) |
92 version->AddPotentialControllee(this); | 92 version->AddPotentialControllee(this); |
93 if (previous_version) | 93 if (previous_version) |
94 previous_version->RemovePotentialControllee(this); | 94 previous_version->RemovePotentialControllee(this); |
95 | 95 |
96 if (!dispatcher_host_) | 96 if (!dispatcher_host_) |
97 return; // Could be NULL in some tests. | 97 return; // Could be NULL in some tests. |
98 | 98 |
99 // TODO(michaeln,nhiroki): Send SetInstallingServiceWorker msg once the | 99 dispatcher_host_->Send(new ServiceWorkerMsg_SetInstallingServiceWorker( |
100 // renderer side understands the .installing attribute value. | 100 kDocumentMainThreadId, provider_id(), CreateHandleAndPass(version))); |
101 } | 101 } |
102 | 102 |
103 void ServiceWorkerProviderHost::UnsetVersion(ServiceWorkerVersion* version) { | 103 void ServiceWorkerProviderHost::UnsetVersion(ServiceWorkerVersion* version) { |
104 if (!version) | 104 if (!version) |
105 return; | 105 return; |
106 if (installing_version_ == version) | 106 if (installing_version_ == version) |
107 SetInstallingVersion(NULL); | 107 SetInstallingVersion(NULL); |
108 else if (waiting_version_ == version) | 108 else if (waiting_version_ == version) |
109 SetWaitingVersion(NULL); | 109 SetWaitingVersion(NULL); |
110 else if (active_version_ == version) | 110 else if (active_version_ == version) |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); | 203 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); |
204 } | 204 } |
205 return info; | 205 return info; |
206 } | 206 } |
207 | 207 |
208 bool ServiceWorkerProviderHost::IsContextAlive() { | 208 bool ServiceWorkerProviderHost::IsContextAlive() { |
209 return context_ != NULL; | 209 return context_ != NULL; |
210 } | 210 } |
211 | 211 |
212 } // namespace content | 212 } // namespace content |
OLD | NEW |