| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 Send(new ServiceWorkerHostMsg_SkipWaiting(GetRoutingID(), request_id)); | 642 Send(new ServiceWorkerHostMsg_SkipWaiting(GetRoutingID(), request_id)); |
| 643 } | 643 } |
| 644 | 644 |
| 645 void ServiceWorkerContextClient::claim( | 645 void ServiceWorkerContextClient::claim( |
| 646 blink::WebServiceWorkerClientsClaimCallbacks* callbacks) { | 646 blink::WebServiceWorkerClientsClaimCallbacks* callbacks) { |
| 647 DCHECK(callbacks); | 647 DCHECK(callbacks); |
| 648 int request_id = context_->claim_clients_callbacks.Add(callbacks); | 648 int request_id = context_->claim_clients_callbacks.Add(callbacks); |
| 649 Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id)); | 649 Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id)); |
| 650 } | 650 } |
| 651 | 651 |
| 652 void ServiceWorkerContextClient::registerForeignFetchScopes( |
| 653 const blink::WebVector<blink::WebURL>& sub_scopes) { |
| 654 Send(new ServiceWorkerHostMsg_RegisterForeignFetchScopes( |
| 655 GetRoutingID(), std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()))); |
| 656 } |
| 657 |
| 652 void ServiceWorkerContextClient::DispatchSyncEvent( | 658 void ServiceWorkerContextClient::DispatchSyncEvent( |
| 653 const blink::WebSyncRegistration& registration, | 659 const blink::WebSyncRegistration& registration, |
| 654 const SyncCallback& callback) { | 660 const SyncCallback& callback) { |
| 655 TRACE_EVENT0("ServiceWorker", | 661 TRACE_EVENT0("ServiceWorker", |
| 656 "ServiceWorkerContextClient::DispatchSyncEvent"); | 662 "ServiceWorkerContextClient::DispatchSyncEvent"); |
| 657 int request_id = | 663 int request_id = |
| 658 context_->sync_event_callbacks.Add(new SyncCallback(callback)); | 664 context_->sync_event_callbacks.Add(new SyncCallback(callback)); |
| 659 proxy_->dispatchSyncEvent(request_id, registration); | 665 proxy_->dispatchSyncEvent(request_id, registration); |
| 660 } | 666 } |
| 661 | 667 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 } | 978 } |
| 973 | 979 |
| 974 base::WeakPtr<ServiceWorkerContextClient> | 980 base::WeakPtr<ServiceWorkerContextClient> |
| 975 ServiceWorkerContextClient::GetWeakPtr() { | 981 ServiceWorkerContextClient::GetWeakPtr() { |
| 976 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 982 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 977 DCHECK(context_); | 983 DCHECK(context_); |
| 978 return context_->weak_factory.GetWeakPtr(); | 984 return context_->weak_factory.GetWeakPtr(); |
| 979 } | 985 } |
| 980 | 986 |
| 981 } // namespace content | 987 } // namespace content |
| OLD | NEW |