| 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_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "content/browser/bad_message.h" | 16 #include "content/browser/bad_message.h" |
| 17 #include "content/browser/message_port_message_filter.h" | 17 #include "content/browser/message_port_message_filter.h" |
| 18 #include "content/browser/message_port_service.h" | 18 #include "content/browser/message_port_service.h" |
| 19 #include "content/browser/service_worker/embedded_worker_registry.h" | 19 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 20 #include "content/browser/service_worker/embedded_worker_status.h" |
| 20 #include "content/browser/service_worker/service_worker_client_utils.h" | 21 #include "content/browser/service_worker/service_worker_client_utils.h" |
| 21 #include "content/browser/service_worker/service_worker_context_core.h" | 22 #include "content/browser/service_worker/service_worker_context_core.h" |
| 22 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 23 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 23 #include "content/browser/service_worker/service_worker_handle.h" | 24 #include "content/browser/service_worker/service_worker_handle.h" |
| 24 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" | 25 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" |
| 25 #include "content/browser/service_worker/service_worker_registration.h" | 26 #include "content/browser/service_worker/service_worker_registration.h" |
| 26 #include "content/browser/service_worker/service_worker_registration_handle.h" | 27 #include "content/browser/service_worker/service_worker_registration_handle.h" |
| 27 #include "content/common/service_worker/embedded_worker_messages.h" | 28 #include "content/common/service_worker/embedded_worker_messages.h" |
| 28 #include "content/common/service_worker/service_worker_messages.h" | 29 #include "content/common/service_worker/service_worker_messages.h" |
| 29 #include "content/common/service_worker/service_worker_types.h" | 30 #include "content/common/service_worker/service_worker_types.h" |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 bad_message::ReceivedBadMessage( | 832 bad_message::ReceivedBadMessage( |
| 832 this, bad_message::SWDH_SET_HOSTED_VERSION_NO_HOST); | 833 this, bad_message::SWDH_SET_HOSTED_VERSION_NO_HOST); |
| 833 return; | 834 return; |
| 834 } | 835 } |
| 835 if (!provider_host->IsContextAlive()) | 836 if (!provider_host->IsContextAlive()) |
| 836 return; | 837 return; |
| 837 | 838 |
| 838 // We might not be STARTING if the stop sequence was entered (STOPPING) or | 839 // We might not be STARTING if the stop sequence was entered (STOPPING) or |
| 839 // ended up being detached (STOPPED). | 840 // ended up being detached (STOPPED). |
| 840 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); | 841 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); |
| 841 if (!version || version->running_status() != ServiceWorkerVersion::STARTING) | 842 if (!version || version->running_status() != EmbeddedWorkerStatus::STARTING) |
| 842 return; | 843 return; |
| 843 | 844 |
| 844 if (!provider_host->SetHostedVersion(version)) { | 845 if (!provider_host->SetHostedVersion(version)) { |
| 845 bad_message::ReceivedBadMessage(this, bad_message::SWDH_SET_HOSTED_VERSION); | 846 bad_message::ReceivedBadMessage(this, bad_message::SWDH_SET_HOSTED_VERSION); |
| 846 return; | 847 return; |
| 847 } | 848 } |
| 848 | 849 |
| 849 // Retrieve the registration associated with |version|. The registration | 850 // Retrieve the registration associated with |version|. The registration |
| 850 // must be alive because the version keeps it during starting worker. | 851 // must be alive because the version keeps it during starting worker. |
| 851 ServiceWorkerRegistration* registration = | 852 ServiceWorkerRegistration* registration = |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 if (!handle) { | 1414 if (!handle) { |
| 1414 bad_message::ReceivedBadMessage(this, | 1415 bad_message::ReceivedBadMessage(this, |
| 1415 bad_message::SWDH_TERMINATE_BAD_HANDLE); | 1416 bad_message::SWDH_TERMINATE_BAD_HANDLE); |
| 1416 return; | 1417 return; |
| 1417 } | 1418 } |
| 1418 handle->version()->StopWorker( | 1419 handle->version()->StopWorker( |
| 1419 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 1420 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 1420 } | 1421 } |
| 1421 | 1422 |
| 1422 } // namespace content | 1423 } // namespace content |
| OLD | NEW |