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