| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "content/browser/message_port_message_filter.h" | 12 #include "content/browser/message_port_message_filter.h" |
| 13 #include "content/browser/service_worker/embedded_worker_status.h" |
| 13 #include "content/browser/service_worker/service_worker_context_core.h" | 14 #include "content/browser/service_worker/service_worker_context_core.h" |
| 14 #include "content/browser/service_worker/service_worker_context_request_handler.
h" | 15 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| 15 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 16 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
| 16 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 17 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 17 #include "content/browser/service_worker/service_worker_handle.h" | 18 #include "content/browser/service_worker/service_worker_handle.h" |
| 18 #include "content/browser/service_worker/service_worker_registration_handle.h" | 19 #include "content/browser/service_worker/service_worker_registration_handle.h" |
| 19 #include "content/browser/service_worker/service_worker_version.h" | 20 #include "content/browser/service_worker/service_worker_version.h" |
| 20 #include "content/common/resource_request_body.h" | 21 #include "content/common/resource_request_body.h" |
| 21 #include "content/common/service_worker/service_worker_messages.h" | 22 #include "content/common/service_worker/service_worker_messages.h" |
| 22 #include "content/common/service_worker/service_worker_types.h" | 23 #include "content/common/service_worker/service_worker_types.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 notify_controllerchange)); | 186 notify_controllerchange)); |
| 186 } | 187 } |
| 187 | 188 |
| 188 bool ServiceWorkerProviderHost::SetHostedVersion( | 189 bool ServiceWorkerProviderHost::SetHostedVersion( |
| 189 ServiceWorkerVersion* version) { | 190 ServiceWorkerVersion* version) { |
| 190 // TODO(falken): Unclear why we check active_version. Should this just check | 191 // TODO(falken): Unclear why we check active_version. Should this just check |
| 191 // that IsProviderForClient() is false? | 192 // that IsProviderForClient() is false? |
| 192 if (active_version()) | 193 if (active_version()) |
| 193 return false; // Unexpected bad message. | 194 return false; // Unexpected bad message. |
| 194 | 195 |
| 195 DCHECK_EQ(ServiceWorkerVersion::STARTING, version->running_status()); | 196 DCHECK_EQ(EmbeddedWorkerStatus::STARTING, version->running_status()); |
| 196 if (version->embedded_worker()->process_id() != render_process_id_) { | 197 if (version->embedded_worker()->process_id() != render_process_id_) { |
| 197 // If we aren't trying to start this version in our process | 198 // If we aren't trying to start this version in our process |
| 198 // something is amiss. | 199 // something is amiss. |
| 199 return false; | 200 return false; |
| 200 } | 201 } |
| 201 | 202 |
| 202 running_hosted_version_ = version; | 203 running_hosted_version_ = version; |
| 203 return true; | 204 return true; |
| 204 } | 205 } |
| 205 | 206 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 644 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
| 644 render_thread_id_, provider_id(), | 645 render_thread_id_, provider_id(), |
| 645 GetOrCreateServiceWorkerHandle( | 646 GetOrCreateServiceWorkerHandle( |
| 646 associated_registration_->active_version()), | 647 associated_registration_->active_version()), |
| 647 false /* shouldNotifyControllerChange */)); | 648 false /* shouldNotifyControllerChange */)); |
| 648 } | 649 } |
| 649 } | 650 } |
| 650 } | 651 } |
| 651 | 652 |
| 652 } // namespace content | 653 } // namespace content |
| OLD | NEW |