| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 notify_controllerchange)); | 207 notify_controllerchange)); |
| 207 } | 208 } |
| 208 | 209 |
| 209 bool ServiceWorkerProviderHost::SetHostedVersion( | 210 bool ServiceWorkerProviderHost::SetHostedVersion( |
| 210 ServiceWorkerVersion* version) { | 211 ServiceWorkerVersion* version) { |
| 211 // TODO(falken): Unclear why we check active_version. Should this just check | 212 // TODO(falken): Unclear why we check active_version. Should this just check |
| 212 // that IsProviderForClient() is false? | 213 // that IsProviderForClient() is false? |
| 213 if (active_version()) | 214 if (active_version()) |
| 214 return false; // Unexpected bad message. | 215 return false; // Unexpected bad message. |
| 215 | 216 |
| 216 DCHECK_EQ(ServiceWorkerVersion::STARTING, version->running_status()); | 217 DCHECK_EQ(EmbeddedWorkerStatus::STARTING, version->running_status()); |
| 217 if (version->embedded_worker()->process_id() != render_process_id_) { | 218 if (version->embedded_worker()->process_id() != render_process_id_) { |
| 218 // If we aren't trying to start this version in our process | 219 // If we aren't trying to start this version in our process |
| 219 // something is amiss. | 220 // something is amiss. |
| 220 return false; | 221 return false; |
| 221 } | 222 } |
| 222 | 223 |
| 223 running_hosted_version_ = version; | 224 running_hosted_version_ = version; |
| 224 return true; | 225 return true; |
| 225 } | 226 } |
| 226 | 227 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 665 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
| 665 render_thread_id_, provider_id(), | 666 render_thread_id_, provider_id(), |
| 666 GetOrCreateServiceWorkerHandle( | 667 GetOrCreateServiceWorkerHandle( |
| 667 associated_registration_->active_version()), | 668 associated_registration_->active_version()), |
| 668 false /* shouldNotifyControllerChange */)); | 669 false /* shouldNotifyControllerChange */)); |
| 669 } | 670 } |
| 670 } | 671 } |
| 671 } | 672 } |
| 672 | 673 |
| 673 } // namespace content | 674 } // namespace content |
| OLD | NEW |