| 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/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "content/browser/service_worker/service_worker_registration_handle.h" | 29 #include "content/browser/service_worker/service_worker_registration_handle.h" |
| 30 #include "content/common/service_worker/embedded_worker_messages.h" | 30 #include "content/common/service_worker/embedded_worker_messages.h" |
| 31 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" | 31 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" |
| 32 #include "content/common/service_worker/service_worker_messages.h" | 32 #include "content/common/service_worker/service_worker_messages.h" |
| 33 #include "content/common/service_worker/service_worker_types.h" | 33 #include "content/common/service_worker/service_worker_types.h" |
| 34 #include "content/common/service_worker/service_worker_utils.h" | 34 #include "content/common/service_worker/service_worker_utils.h" |
| 35 #include "content/public/browser/content_browser_client.h" | 35 #include "content/public/browser/content_browser_client.h" |
| 36 #include "content/public/browser/render_frame_host.h" | 36 #include "content/public/browser/render_frame_host.h" |
| 37 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 38 #include "content/public/common/browser_side_navigation_policy.h" | 38 #include "content/public/common/browser_side_navigation_policy.h" |
| 39 #include "content/public/common/child_process_host.h" |
| 39 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
| 40 #include "content/public/common/origin_util.h" | 41 #include "content/public/common/origin_util.h" |
| 41 #include "ipc/ipc_message_macros.h" | 42 #include "ipc/ipc_message_macros.h" |
| 42 #include "net/http/http_util.h" | 43 #include "net/http/http_util.h" |
| 43 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerError.h" | 44 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerError.h" |
| 44 #include "url/gurl.h" | 45 #include "url/gurl.h" |
| 45 | 46 |
| 46 using blink::WebServiceWorkerError; | 47 using blink::WebServiceWorkerError; |
| 47 | 48 |
| 48 namespace content { | 49 namespace content { |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 | 1081 |
| 1081 // A process for the worker must be equal to a process for the provider host. | 1082 // A process for the worker must be equal to a process for the provider host. |
| 1082 if (version->embedded_worker()->process_id() != provider_host->process_id()) { | 1083 if (version->embedded_worker()->process_id() != provider_host->process_id()) { |
| 1083 // Temporary debugging for https://crbug.com/668633 | 1084 // Temporary debugging for https://crbug.com/668633 |
| 1084 base::debug::ScopedCrashKey scope_worker_pid( | 1085 base::debug::ScopedCrashKey scope_worker_pid( |
| 1085 "swdh_set_hosted_version_worker_pid", | 1086 "swdh_set_hosted_version_worker_pid", |
| 1086 base::IntToString(version->embedded_worker()->process_id())); | 1087 base::IntToString(version->embedded_worker()->process_id())); |
| 1087 base::debug::ScopedCrashKey scope_provider_host_pid( | 1088 base::debug::ScopedCrashKey scope_provider_host_pid( |
| 1088 "swdh_set_hosted_version_host_pid", | 1089 "swdh_set_hosted_version_host_pid", |
| 1089 base::IntToString(provider_host->process_id())); | 1090 base::IntToString(provider_host->process_id())); |
| 1091 if (version->embedded_worker()->process_id() != |
| 1092 ChildProcessHost::kInvalidUniqueID) { |
| 1093 base::debug::ScopedCrashKey scope_is_new_process( |
| 1094 "swdh_set_hosted_version_is_new_process", |
| 1095 version->embedded_worker()->is_new_process() ? "true" : "false"); |
| 1096 } |
| 1097 base::debug::ScopedCrashKey scope_worker_restart_count( |
| 1098 "swdh_set_hosted_version_restart_count", |
| 1099 base::IntToString(version->embedded_worker()->restart_count())); |
| 1090 bad_message::ReceivedBadMessage( | 1100 bad_message::ReceivedBadMessage( |
| 1091 this, bad_message::SWDH_SET_HOSTED_VERSION_PROCESS_MISMATCH); | 1101 this, bad_message::SWDH_SET_HOSTED_VERSION_PROCESS_MISMATCH); |
| 1092 return; | 1102 return; |
| 1093 } | 1103 } |
| 1094 | 1104 |
| 1095 provider_host->SetHostedVersion(version); | 1105 provider_host->SetHostedVersion(version); |
| 1096 | 1106 |
| 1097 // Retrieve the registration associated with |version|. The registration | 1107 // Retrieve the registration associated with |version|. The registration |
| 1098 // must be alive because the version keeps it during starting worker. | 1108 // must be alive because the version keeps it during starting worker. |
| 1099 ServiceWorkerRegistration* registration = | 1109 ServiceWorkerRegistration* registration = |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 if (!handle) { | 1764 if (!handle) { |
| 1755 bad_message::ReceivedBadMessage(this, | 1765 bad_message::ReceivedBadMessage(this, |
| 1756 bad_message::SWDH_TERMINATE_BAD_HANDLE); | 1766 bad_message::SWDH_TERMINATE_BAD_HANDLE); |
| 1757 return; | 1767 return; |
| 1758 } | 1768 } |
| 1759 handle->version()->StopWorker( | 1769 handle->version()->StopWorker( |
| 1760 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 1770 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 1761 } | 1771 } |
| 1762 | 1772 |
| 1763 } // namespace content | 1773 } // namespace content |
| OLD | NEW |