OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/service_worker/service_worker_script_context.h" | 5 #include "content/renderer/service_worker/service_worker_script_context.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "content/child/notifications/notification_data_conversions.h" | 11 #include "content/child/notifications/notification_data_conversions.h" |
12 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 12 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
13 #include "content/child/thread_safe_sender.h" | 13 #include "content/child/thread_safe_sender.h" |
14 #include "content/child/webmessageportchannel_impl.h" | 14 #include "content/child/webmessageportchannel_impl.h" |
15 #include "content/common/message_port_messages.h" | 15 #include "content/common/message_port_messages.h" |
16 #include "content/common/service_worker/service_worker_messages.h" | 16 #include "content/common/service_worker/service_worker_messages.h" |
17 #include "content/public/common/referrer.h" | 17 #include "content/public/common/referrer.h" |
18 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 18 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
19 #include "content/renderer/service_worker/webserviceworkercachestorage_impl.h" | |
20 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
21 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 20 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
22 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 21 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
23 #include "third_party/WebKit/public/platform/WebServiceWorkerClientQueryOptions.
h" | 22 #include "third_party/WebKit/public/platform/WebServiceWorkerClientQueryOptions.
h" |
24 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" | 23 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" |
25 #include "third_party/WebKit/public/platform/WebString.h" | 24 #include "third_party/WebKit/public/platform/WebString.h" |
26 #include "third_party/WebKit/public/platform/WebURL.h" | 25 #include "third_party/WebKit/public/platform/WebURL.h" |
27 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 26 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
28 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 27 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
29 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 28 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 91 |
93 return web_client_info; | 92 return web_client_info; |
94 } | 93 } |
95 | 94 |
96 } // namespace | 95 } // namespace |
97 | 96 |
98 ServiceWorkerScriptContext::ServiceWorkerScriptContext( | 97 ServiceWorkerScriptContext::ServiceWorkerScriptContext( |
99 EmbeddedWorkerContextClient* embedded_context, | 98 EmbeddedWorkerContextClient* embedded_context, |
100 blink::WebServiceWorkerContextProxy* proxy) | 99 blink::WebServiceWorkerContextProxy* proxy) |
101 : embedded_context_(embedded_context), | 100 : embedded_context_(embedded_context), |
102 cache_storage_(new WebServiceWorkerCacheStorageImpl( | |
103 embedded_context->thread_safe_sender(), | |
104 embedded_context->origin())), | |
105 proxy_(proxy) { | 101 proxy_(proxy) { |
106 } | 102 } |
107 | 103 |
108 ServiceWorkerScriptContext::~ServiceWorkerScriptContext() {} | 104 ServiceWorkerScriptContext::~ServiceWorkerScriptContext() {} |
109 | 105 |
110 void ServiceWorkerScriptContext::OnMessageReceived( | 106 void ServiceWorkerScriptContext::OnMessageReceived( |
111 const IPC::Message& message) { | 107 const IPC::Message& message) { |
112 bool handled = true; | 108 bool handled = true; |
113 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) | 109 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) |
114 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ActivateEvent, OnActivateEvent) | 110 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ActivateEvent, OnActivateEvent) |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 new blink::WebServiceWorkerError(error_type, message)); | 578 new blink::WebServiceWorkerError(error_type, message)); |
583 callbacks->onError(error.release()); | 579 callbacks->onError(error.release()); |
584 pending_claim_clients_callbacks_.Remove(request_id); | 580 pending_claim_clients_callbacks_.Remove(request_id); |
585 } | 581 } |
586 | 582 |
587 void ServiceWorkerScriptContext::OnPing() { | 583 void ServiceWorkerScriptContext::OnPing() { |
588 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID())); | 584 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID())); |
589 } | 585 } |
590 | 586 |
591 } // namespace content | 587 } // namespace content |
OLD | NEW |