OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "content/renderer/service_worker/service_worker_type_util.h" | 37 #include "content/renderer/service_worker/service_worker_type_util.h" |
38 #include "ipc/ipc_message.h" | 38 #include "ipc/ipc_message.h" |
39 #include "ipc/ipc_message_macros.h" | 39 #include "ipc/ipc_message_macros.h" |
40 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 40 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
41 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 41 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
42 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 42 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
43 #include "third_party/WebKit/public/platform/WebServiceWorkerClientQueryOptions.
h" | 43 #include "third_party/WebKit/public/platform/WebServiceWorkerClientQueryOptions.
h" |
44 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" | 44 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" |
45 #include "third_party/WebKit/public/platform/WebServiceWorkerResponse.h" | 45 #include "third_party/WebKit/public/platform/WebServiceWorkerResponse.h" |
46 #include "third_party/WebKit/public/platform/WebString.h" | 46 #include "third_party/WebKit/public/platform/WebString.h" |
| 47 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" |
47 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 48 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
48 #include "third_party/WebKit/public/web/WebDataSource.h" | 49 #include "third_party/WebKit/public/web/WebDataSource.h" |
49 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 50 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
50 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 51 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
51 #include "third_party/WebKit/public/web/WebServiceWorkerNetworkProvider.h" | 52 #include "third_party/WebKit/public/web/WebServiceWorkerNetworkProvider.h" |
52 | 53 |
53 namespace content { | 54 namespace content { |
54 | 55 |
55 namespace { | 56 namespace { |
56 | 57 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 static_cast<WebMessagePortChannelImpl*>(channel); | 625 static_cast<WebMessagePortChannelImpl*>(channel); |
625 main_thread_task_runner_->PostTask( | 626 main_thread_task_runner_->PostTask( |
626 FROM_HERE, | 627 FROM_HERE, |
627 base::Bind(&StashMessagePortOnMainThread, | 628 base::Bind(&StashMessagePortOnMainThread, |
628 sender_, GetRoutingID(), | 629 sender_, GetRoutingID(), |
629 base::Unretained(channel_impl), | 630 base::Unretained(channel_impl), |
630 static_cast<base::string16>(name))); | 631 static_cast<base::string16>(name))); |
631 } | 632 } |
632 | 633 |
633 void ServiceWorkerContextClient::DispatchSyncEvent( | 634 void ServiceWorkerContextClient::DispatchSyncEvent( |
| 635 const blink::WebSyncRegistration& registration, |
634 const SyncCallback& callback) { | 636 const SyncCallback& callback) { |
635 TRACE_EVENT0("ServiceWorker", | 637 TRACE_EVENT0("ServiceWorker", |
636 "ServiceWorkerScriptContext::DispatchSyncEvent"); | 638 "ServiceWorkerScriptContext::DispatchSyncEvent"); |
637 int request_id = | 639 int request_id = |
638 context_->sync_event_callbacks.Add(new SyncCallback(callback)); | 640 context_->sync_event_callbacks.Add(new SyncCallback(callback)); |
639 proxy_->dispatchSyncEvent(request_id); | 641 proxy_->dispatchSyncEvent(request_id, registration); |
640 } | 642 } |
641 | 643 |
642 void ServiceWorkerContextClient::Send(IPC::Message* message) { | 644 void ServiceWorkerContextClient::Send(IPC::Message* message) { |
643 sender_->Send(message); | 645 sender_->Send(message); |
644 } | 646 } |
645 | 647 |
646 void ServiceWorkerContextClient::SendWorkerStarted() { | 648 void ServiceWorkerContextClient::SendWorkerStarted() { |
647 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 649 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
648 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 650 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
649 "ServiceWorkerContextClient::StartingWorkerContext", | 651 "ServiceWorkerContextClient::StartingWorkerContext", |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 } | 958 } |
957 | 959 |
958 base::WeakPtr<ServiceWorkerContextClient> | 960 base::WeakPtr<ServiceWorkerContextClient> |
959 ServiceWorkerContextClient::GetWeakPtr() { | 961 ServiceWorkerContextClient::GetWeakPtr() { |
960 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 962 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
961 DCHECK(context_); | 963 DCHECK(context_); |
962 return context_->weak_factory.GetWeakPtr(); | 964 return context_->weak_factory.GetWeakPtr(); |
963 } | 965 } |
964 | 966 |
965 } // namespace content | 967 } // namespace content |
OLD | NEW |