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 28 matching lines...) Expand all Loading... |
39 #include "content/renderer/service_worker/service_worker_type_util.h" | 39 #include "content/renderer/service_worker/service_worker_type_util.h" |
40 #include "ipc/ipc_message.h" | 40 #include "ipc/ipc_message.h" |
41 #include "ipc/ipc_message_macros.h" | 41 #include "ipc/ipc_message_macros.h" |
42 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 42 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
43 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 43 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
44 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 44 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
45 #include "third_party/WebKit/public/platform/WebServiceWorkerClientQueryOptions.
h" | 45 #include "third_party/WebKit/public/platform/WebServiceWorkerClientQueryOptions.
h" |
46 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" | 46 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" |
47 #include "third_party/WebKit/public/platform/WebServiceWorkerResponse.h" | 47 #include "third_party/WebKit/public/platform/WebServiceWorkerResponse.h" |
48 #include "third_party/WebKit/public/platform/WebString.h" | 48 #include "third_party/WebKit/public/platform/WebString.h" |
| 49 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" |
49 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 50 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
50 #include "third_party/WebKit/public/web/WebDataSource.h" | 51 #include "third_party/WebKit/public/web/WebDataSource.h" |
51 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 52 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
52 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 53 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
53 #include "third_party/WebKit/public/web/WebServiceWorkerNetworkProvider.h" | 54 #include "third_party/WebKit/public/web/WebServiceWorkerNetworkProvider.h" |
54 | 55 |
55 namespace content { | 56 namespace content { |
56 | 57 |
57 namespace { | 58 namespace { |
58 | 59 |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 static_cast<WebMessagePortChannelImpl*>(channel); | 624 static_cast<WebMessagePortChannelImpl*>(channel); |
624 main_thread_task_runner_->PostTask( | 625 main_thread_task_runner_->PostTask( |
625 FROM_HERE, | 626 FROM_HERE, |
626 base::Bind(&StashMessagePortOnMainThread, | 627 base::Bind(&StashMessagePortOnMainThread, |
627 sender_, GetRoutingID(), | 628 sender_, GetRoutingID(), |
628 base::Unretained(channel_impl), | 629 base::Unretained(channel_impl), |
629 static_cast<base::string16>(name))); | 630 static_cast<base::string16>(name))); |
630 } | 631 } |
631 | 632 |
632 void ServiceWorkerContextClient::DispatchSyncEvent( | 633 void ServiceWorkerContextClient::DispatchSyncEvent( |
| 634 const blink::WebSyncRegistration& registration, |
633 const SyncCallback& callback) { | 635 const SyncCallback& callback) { |
634 TRACE_EVENT0("ServiceWorker", | 636 TRACE_EVENT0("ServiceWorker", |
635 "ServiceWorkerScriptContext::DispatchSyncEvent"); | 637 "ServiceWorkerScriptContext::DispatchSyncEvent"); |
636 int request_id = | 638 int request_id = |
637 context_->sync_event_callbacks.Add(new SyncCallback(callback)); | 639 context_->sync_event_callbacks.Add(new SyncCallback(callback)); |
638 proxy_->dispatchSyncEvent(request_id); | 640 proxy_->dispatchSyncEvent(request_id, registration); |
639 } | 641 } |
640 | 642 |
641 void ServiceWorkerContextClient::Send(IPC::Message* message) { | 643 void ServiceWorkerContextClient::Send(IPC::Message* message) { |
642 sender_->Send(message); | 644 sender_->Send(message); |
643 } | 645 } |
644 | 646 |
645 void ServiceWorkerContextClient::SendWorkerStarted() { | 647 void ServiceWorkerContextClient::SendWorkerStarted() { |
646 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 648 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
647 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 649 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
648 "ServiceWorkerContextClient::StartingWorkerContext", | 650 "ServiceWorkerContextClient::StartingWorkerContext", |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 } | 945 } |
944 | 946 |
945 base::WeakPtr<ServiceWorkerContextClient> | 947 base::WeakPtr<ServiceWorkerContextClient> |
946 ServiceWorkerContextClient::GetWeakPtr() { | 948 ServiceWorkerContextClient::GetWeakPtr() { |
947 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 949 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
948 DCHECK(context_); | 950 DCHECK(context_); |
949 return context_->weak_factory.GetWeakPtr(); | 951 return context_->weak_factory.GetWeakPtr(); |
950 } | 952 } |
951 | 953 |
952 } // namespace content | 954 } // namespace content |
OLD | NEW |