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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 TRACE_EVENT_ASYNC_END1("ServiceWorker", | 1209 TRACE_EVENT_ASYNC_END1("ServiceWorker", |
1212 "ServiceWorkerVersion::OnClearCachedMetadata", | 1210 "ServiceWorkerVersion::OnClearCachedMetadata", |
1213 callback_id, "result", result); | 1211 callback_id, "result", result); |
1214 for (auto& observer : listeners_) | 1212 for (auto& observer : listeners_) |
1215 observer.OnCachedMetadataUpdated(this); | 1213 observer.OnCachedMetadataUpdated(this); |
1216 } | 1214 } |
1217 | 1215 |
1218 void ServiceWorkerVersion::OnPostMessageToClient( | 1216 void ServiceWorkerVersion::OnPostMessageToClient( |
1219 const std::string& client_uuid, | 1217 const std::string& client_uuid, |
1220 const base::string16& message, | 1218 const base::string16& message, |
1221 const std::vector<int>& sent_message_ports) { | 1219 const std::vector<MessagePort>& sent_message_ports) { |
1222 if (!context_) | 1220 if (!context_) |
1223 return; | 1221 return; |
1224 TRACE_EVENT1("ServiceWorker", | 1222 TRACE_EVENT1("ServiceWorker", |
1225 "ServiceWorkerVersion::OnPostMessageToDocument", | 1223 "ServiceWorkerVersion::OnPostMessageToDocument", |
1226 "Client id", client_uuid); | 1224 "Client id", client_uuid); |
1227 ServiceWorkerProviderHost* provider_host = | 1225 ServiceWorkerProviderHost* provider_host = |
1228 context_->GetProviderHostByClientID(client_uuid); | 1226 context_->GetProviderHostByClientID(client_uuid); |
1229 if (!provider_host) { | 1227 if (!provider_host) { |
1230 // The client may already have been closed, just ignore. | 1228 // The client may already have been closed, just ignore. |
1231 return; | 1229 return; |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 | 1899 |
1902 void ServiceWorkerVersion::CleanUpExternalRequest( | 1900 void ServiceWorkerVersion::CleanUpExternalRequest( |
1903 const std::string& request_uuid, | 1901 const std::string& request_uuid, |
1904 ServiceWorkerStatusCode status) { | 1902 ServiceWorkerStatusCode status) { |
1905 if (status == SERVICE_WORKER_OK) | 1903 if (status == SERVICE_WORKER_OK) |
1906 return; | 1904 return; |
1907 external_request_uuid_to_request_id_.erase(request_uuid); | 1905 external_request_uuid_to_request_id_.erase(request_uuid); |
1908 } | 1906 } |
1909 | 1907 |
1910 } // namespace content | 1908 } // namespace content |
OLD | NEW |