| 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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 TRACE_EVENT_ASYNC_END1("ServiceWorker", | 1265 TRACE_EVENT_ASYNC_END1("ServiceWorker", |
| 1268 "ServiceWorkerVersion::OnClearCachedMetadata", | 1266 "ServiceWorkerVersion::OnClearCachedMetadata", |
| 1269 callback_id, "result", result); | 1267 callback_id, "result", result); |
| 1270 for (auto& observer : listeners_) | 1268 for (auto& observer : listeners_) |
| 1271 observer.OnCachedMetadataUpdated(this); | 1269 observer.OnCachedMetadataUpdated(this); |
| 1272 } | 1270 } |
| 1273 | 1271 |
| 1274 void ServiceWorkerVersion::OnPostMessageToClient( | 1272 void ServiceWorkerVersion::OnPostMessageToClient( |
| 1275 const std::string& client_uuid, | 1273 const std::string& client_uuid, |
| 1276 const base::string16& message, | 1274 const base::string16& message, |
| 1277 const std::vector<int>& sent_message_ports) { | 1275 const std::vector<MessagePort>& sent_message_ports) { |
| 1278 if (!context_) | 1276 if (!context_) |
| 1279 return; | 1277 return; |
| 1280 TRACE_EVENT1("ServiceWorker", | 1278 TRACE_EVENT1("ServiceWorker", |
| 1281 "ServiceWorkerVersion::OnPostMessageToDocument", | 1279 "ServiceWorkerVersion::OnPostMessageToDocument", |
| 1282 "Client id", client_uuid); | 1280 "Client id", client_uuid); |
| 1283 ServiceWorkerProviderHost* provider_host = | 1281 ServiceWorkerProviderHost* provider_host = |
| 1284 context_->GetProviderHostByClientID(client_uuid); | 1282 context_->GetProviderHostByClientID(client_uuid); |
| 1285 if (!provider_host) { | 1283 if (!provider_host) { |
| 1286 // The client may already have been closed, just ignore. | 1284 // The client may already have been closed, just ignore. |
| 1287 return; | 1285 return; |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 | 1951 |
| 1954 void ServiceWorkerVersion::CleanUpExternalRequest( | 1952 void ServiceWorkerVersion::CleanUpExternalRequest( |
| 1955 const std::string& request_uuid, | 1953 const std::string& request_uuid, |
| 1956 ServiceWorkerStatusCode status) { | 1954 ServiceWorkerStatusCode status) { |
| 1957 if (status == SERVICE_WORKER_OK) | 1955 if (status == SERVICE_WORKER_OK) |
| 1958 return; | 1956 return; |
| 1959 external_request_uuid_to_request_id_.erase(request_uuid); | 1957 external_request_uuid_to_request_id_.erase(request_uuid); |
| 1960 } | 1958 } |
| 1961 | 1959 |
| 1962 } // namespace content | 1960 } // namespace content |
| OLD | NEW |