| 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_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
| 15 #include "base/feature_list.h" | 15 #include "base/feature_list.h" |
| 16 #include "base/guid.h" | 16 #include "base/guid.h" |
| 17 #include "base/location.h" | 17 #include "base/location.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
| 22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "base/time/default_tick_clock.h" | 26 #include "base/time/default_tick_clock.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "content/browser/bad_message.h" | 28 #include "content/browser/bad_message.h" |
| 29 #include "content/browser/child_process_security_policy_impl.h" | 29 #include "content/browser/child_process_security_policy_impl.h" |
| 30 #include "content/browser/message_port_message_filter.h" | |
| 31 #include "content/browser/message_port_service.h" | |
| 32 #include "content/browser/service_worker/embedded_worker_instance.h" | 30 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 33 #include "content/browser/service_worker/embedded_worker_registry.h" | 31 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 34 #include "content/browser/service_worker/embedded_worker_status.h" | 32 #include "content/browser/service_worker/embedded_worker_status.h" |
| 35 #include "content/browser/service_worker/service_worker_client_utils.h" | 33 #include "content/browser/service_worker/service_worker_client_utils.h" |
| 36 #include "content/browser/service_worker/service_worker_context_core.h" | 34 #include "content/browser/service_worker/service_worker_context_core.h" |
| 37 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 35 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 38 #include "content/browser/service_worker/service_worker_metrics.h" | 36 #include "content/browser/service_worker/service_worker_metrics.h" |
| 39 #include "content/browser/service_worker/service_worker_registration.h" | 37 #include "content/browser/service_worker/service_worker_registration.h" |
| 40 #include "content/common/origin_trials/trial_token_validator.h" | 38 #include "content/common/origin_trials/trial_token_validator.h" |
| 41 #include "content/common/service_worker/embedded_worker_messages.h" | 39 #include "content/common/service_worker/embedded_worker_messages.h" |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 TRACE_EVENT_ASYNC_END1("ServiceWorker", | 1195 TRACE_EVENT_ASYNC_END1("ServiceWorker", |
| 1198 "ServiceWorkerVersion::OnClearCachedMetadata", | 1196 "ServiceWorkerVersion::OnClearCachedMetadata", |
| 1199 callback_id, "result", result); | 1197 callback_id, "result", result); |
| 1200 for (auto& observer : listeners_) | 1198 for (auto& observer : listeners_) |
| 1201 observer.OnCachedMetadataUpdated(this); | 1199 observer.OnCachedMetadataUpdated(this); |
| 1202 } | 1200 } |
| 1203 | 1201 |
| 1204 void ServiceWorkerVersion::OnPostMessageToClient( | 1202 void ServiceWorkerVersion::OnPostMessageToClient( |
| 1205 const std::string& client_uuid, | 1203 const std::string& client_uuid, |
| 1206 const base::string16& message, | 1204 const base::string16& message, |
| 1207 const std::vector<int>& sent_message_ports) { | 1205 const std::vector<MessagePort>& sent_message_ports) { |
| 1208 if (!context_) | 1206 if (!context_) |
| 1209 return; | 1207 return; |
| 1210 TRACE_EVENT1("ServiceWorker", | 1208 TRACE_EVENT1("ServiceWorker", |
| 1211 "ServiceWorkerVersion::OnPostMessageToDocument", | 1209 "ServiceWorkerVersion::OnPostMessageToDocument", |
| 1212 "Client id", client_uuid); | 1210 "Client id", client_uuid); |
| 1213 ServiceWorkerProviderHost* provider_host = | 1211 ServiceWorkerProviderHost* provider_host = |
| 1214 context_->GetProviderHostByClientID(client_uuid); | 1212 context_->GetProviderHostByClientID(client_uuid); |
| 1215 if (!provider_host) { | 1213 if (!provider_host) { |
| 1216 // The client may already have been closed, just ignore. | 1214 // The client may already have been closed, just ignore. |
| 1217 return; | 1215 return; |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 | 1885 |
| 1888 void ServiceWorkerVersion::CleanUpExternalRequest( | 1886 void ServiceWorkerVersion::CleanUpExternalRequest( |
| 1889 const std::string& request_uuid, | 1887 const std::string& request_uuid, |
| 1890 ServiceWorkerStatusCode status) { | 1888 ServiceWorkerStatusCode status) { |
| 1891 if (status == SERVICE_WORKER_OK) | 1889 if (status == SERVICE_WORKER_OK) |
| 1892 return; | 1890 return; |
| 1893 external_request_uuid_to_request_id_.erase(request_uuid); | 1891 external_request_uuid_to_request_id_.erase(request_uuid); |
| 1894 } | 1892 } |
| 1895 | 1893 |
| 1896 } // namespace content | 1894 } // namespace content |
| OLD | NEW |