| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "content/common/message_port_messages.h" | 33 #include "content/common/message_port_messages.h" |
| 34 #include "content/common/service_worker/embedded_worker_messages.h" | 34 #include "content/common/service_worker/embedded_worker_messages.h" |
| 35 #include "content/common/service_worker/fetch_event_dispatcher.mojom.h" | 35 #include "content/common/service_worker/fetch_event_dispatcher.mojom.h" |
| 36 #include "content/common/service_worker/service_worker_messages.h" | 36 #include "content/common/service_worker/service_worker_messages.h" |
| 37 #include "content/common/service_worker/service_worker_status_code.h" | 37 #include "content/common/service_worker/service_worker_status_code.h" |
| 38 #include "content/common/service_worker/service_worker_utils.h" | 38 #include "content/common/service_worker/service_worker_utils.h" |
| 39 #include "content/public/common/push_event_payload.h" | 39 #include "content/public/common/push_event_payload.h" |
| 40 #include "content/public/common/referrer.h" | 40 #include "content/public/common/referrer.h" |
| 41 #include "content/public/renderer/content_renderer_client.h" | 41 #include "content/public/renderer/content_renderer_client.h" |
| 42 #include "content/public/renderer/document_state.h" | 42 #include "content/public/renderer/document_state.h" |
| 43 #include "content/renderer/background_sync/background_sync_client_impl.h" | |
| 44 #include "content/renderer/devtools/devtools_agent.h" | 43 #include "content/renderer/devtools/devtools_agent.h" |
| 45 #include "content/renderer/render_thread_impl.h" | 44 #include "content/renderer/render_thread_impl.h" |
| 46 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 45 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
| 47 #include "content/renderer/service_worker/embedded_worker_instance_client_impl.h
" | 46 #include "content/renderer/service_worker/embedded_worker_instance_client_impl.h
" |
| 48 #include "content/renderer/service_worker/service_worker_type_util.h" | 47 #include "content/renderer/service_worker/service_worker_type_util.h" |
| 49 #include "ipc/ipc_message.h" | 48 #include "ipc/ipc_message.h" |
| 50 #include "ipc/ipc_message_macros.h" | 49 #include "ipc/ipc_message_macros.h" |
| 51 #include "mojo/public/cpp/bindings/interface_request.h" | 50 #include "mojo/public/cpp/bindings/interface_request.h" |
| 52 #include "mojo/public/cpp/bindings/strong_binding.h" | 51 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 53 #include "services/service_manager/public/cpp/interface_provider.h" | 52 #include "services/service_manager/public/cpp/interface_provider.h" |
| 54 #include "services/service_manager/public/cpp/interface_registry.h" | 53 #include "services/service_manager/public/cpp/interface_registry.h" |
| 54 #include "third_party/WebKit/public/platform/InterfaceRegistry.h" |
| 55 #include "third_party/WebKit/public/platform/URLConversion.h" | 55 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 56 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 56 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
| 57 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 57 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 58 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 58 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 59 #include "third_party/WebKit/public/platform/WebString.h" | 59 #include "third_party/WebKit/public/platform/WebString.h" |
| 60 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 60 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
| 61 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" | 61 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" |
| 62 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerError.h" | 62 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerError.h" |
| 63 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" | 63 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" |
| 64 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" | 64 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // worker thread. | 175 // worker thread. |
| 176 struct ServiceWorkerContextClient::WorkerContextData { | 176 struct ServiceWorkerContextClient::WorkerContextData { |
| 177 using ClientsCallbacksMap = | 177 using ClientsCallbacksMap = |
| 178 IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer>; | 178 IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer>; |
| 179 using ClaimClientsCallbacksMap = | 179 using ClaimClientsCallbacksMap = |
| 180 IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer>; | 180 IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer>; |
| 181 using ClientCallbacksMap = | 181 using ClientCallbacksMap = |
| 182 IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer>; | 182 IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer>; |
| 183 using SkipWaitingCallbacksMap = | 183 using SkipWaitingCallbacksMap = |
| 184 IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>; | 184 IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>; |
| 185 using SyncEventCallbacksMap = | |
| 186 IDMap<const base::Callback<void(blink::mojom::ServiceWorkerEventStatus, | |
| 187 base::Time /* dispatch_event_time */)>, | |
| 188 IDMapOwnPointer>; | |
| 189 using FetchEventCallbacksMap = | 185 using FetchEventCallbacksMap = |
| 190 IDMap<const base::Callback<void(ServiceWorkerStatusCode, | 186 IDMap<const base::Callback<void(ServiceWorkerStatusCode, |
| 191 base::Time /* dispatch_event_time */)>, | 187 base::Time /* dispatch_event_time */)>, |
| 192 IDMapOwnPointer>; | 188 IDMapOwnPointer>; |
| 193 using NavigationPreloadRequestsMap = | 189 using NavigationPreloadRequestsMap = |
| 194 IDMap<ServiceWorkerContextClient::NavigationPreloadRequest, | 190 IDMap<ServiceWorkerContextClient::NavigationPreloadRequest, |
| 195 IDMapOwnPointer>; | 191 IDMapOwnPointer>; |
| 196 | 192 |
| 197 explicit WorkerContextData(ServiceWorkerContextClient* owner) | 193 explicit WorkerContextData(ServiceWorkerContextClient* owner) |
| 198 : interface_registry(std::string()), | 194 : interface_registry(std::string()), |
| 199 weak_factory(owner), | 195 weak_factory(owner), |
| 200 proxy_weak_factory(owner->proxy_) {} | 196 proxy_weak_factory(owner->proxy_) { |
| 197 blink_interface_registry.reset( |
| 198 new BlinkInterfaceRegistryImpl(interface_registry.GetWeakPtr())); |
| 199 } |
| 201 | 200 |
| 202 ~WorkerContextData() { | 201 ~WorkerContextData() { |
| 203 DCHECK(thread_checker.CalledOnValidThread()); | 202 DCHECK(thread_checker.CalledOnValidThread()); |
| 204 } | 203 } |
| 205 | 204 |
| 206 // Pending callbacks for GetClientDocuments(). | 205 // Pending callbacks for GetClientDocuments(). |
| 207 ClientsCallbacksMap clients_callbacks; | 206 ClientsCallbacksMap clients_callbacks; |
| 208 | 207 |
| 209 // Pending callbacks for OpenWindow() and FocusClient(). | 208 // Pending callbacks for OpenWindow() and FocusClient(). |
| 210 ClientCallbacksMap client_callbacks; | 209 ClientCallbacksMap client_callbacks; |
| 211 | 210 |
| 212 // Pending callbacks for SkipWaiting(). | 211 // Pending callbacks for SkipWaiting(). |
| 213 SkipWaitingCallbacksMap skip_waiting_callbacks; | 212 SkipWaitingCallbacksMap skip_waiting_callbacks; |
| 214 | 213 |
| 215 // Pending callbacks for ClaimClients(). | 214 // Pending callbacks for ClaimClients(). |
| 216 ClaimClientsCallbacksMap claim_clients_callbacks; | 215 ClaimClientsCallbacksMap claim_clients_callbacks; |
| 217 | 216 |
| 218 // Pending callbacks for Background Sync Events. | |
| 219 SyncEventCallbacksMap sync_event_callbacks; | |
| 220 | |
| 221 // Pending callbacks for Fetch Events. | 217 // Pending callbacks for Fetch Events. |
| 222 FetchEventCallbacksMap fetch_event_callbacks; | 218 FetchEventCallbacksMap fetch_event_callbacks; |
| 223 | 219 |
| 224 // Pending navigation preload requests. | 220 // Pending navigation preload requests. |
| 225 NavigationPreloadRequestsMap preload_requests; | 221 NavigationPreloadRequestsMap preload_requests; |
| 226 | 222 |
| 227 service_manager::InterfaceRegistry interface_registry; | 223 service_manager::InterfaceRegistry interface_registry; |
| 228 // This is not used when mojo for the service workers is enabled. At that | 224 // This is not used when mojo for the service workers is enabled. At that |
| 229 // time, remote interfaces are stored in EmbeddedWorkerInstanceClientImpl. | 225 // time, remote interfaces are stored in EmbeddedWorkerInstanceClientImpl. |
| 230 service_manager::InterfaceProvider remote_interfaces; | 226 service_manager::InterfaceProvider remote_interfaces; |
| 231 | 227 |
| 228 std::unique_ptr<blink::InterfaceRegistry> blink_interface_registry; |
| 229 |
| 232 base::ThreadChecker thread_checker; | 230 base::ThreadChecker thread_checker; |
| 233 base::WeakPtrFactory<ServiceWorkerContextClient> weak_factory; | 231 base::WeakPtrFactory<ServiceWorkerContextClient> weak_factory; |
| 234 base::WeakPtrFactory<blink::WebServiceWorkerContextProxy> proxy_weak_factory; | 232 base::WeakPtrFactory<blink::WebServiceWorkerContextProxy> proxy_weak_factory; |
| 235 }; | 233 }; |
| 236 | 234 |
| 237 class ServiceWorkerContextClient::NavigationPreloadRequest final | 235 class ServiceWorkerContextClient::NavigationPreloadRequest final |
| 238 : public mojom::URLLoaderClient { | 236 : public mojom::URLLoaderClient { |
| 239 public: | 237 public: |
| 240 NavigationPreloadRequest(int fetch_event_id, | 238 NavigationPreloadRequest(int fetch_event_id, |
| 241 const GURL& url, | 239 const GURL& url, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 int worker_devtools_agent_route_id, | 395 int worker_devtools_agent_route_id, |
| 398 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client) | 396 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client) |
| 399 : embedded_worker_id_(embedded_worker_id), | 397 : embedded_worker_id_(embedded_worker_id), |
| 400 service_worker_version_id_(service_worker_version_id), | 398 service_worker_version_id_(service_worker_version_id), |
| 401 service_worker_scope_(service_worker_scope), | 399 service_worker_scope_(service_worker_scope), |
| 402 script_url_(script_url), | 400 script_url_(script_url), |
| 403 worker_devtools_agent_route_id_(worker_devtools_agent_route_id), | 401 worker_devtools_agent_route_id_(worker_devtools_agent_route_id), |
| 404 sender_(ChildThreadImpl::current()->thread_safe_sender()), | 402 sender_(ChildThreadImpl::current()->thread_safe_sender()), |
| 405 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 403 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 406 proxy_(nullptr), | 404 proxy_(nullptr), |
| 407 embedded_worker_client_(std::move(embedded_worker_client)) { | 405 embedded_worker_client_(std::move(embedded_worker_client)), |
| 406 blink_interface_registry_(nullptr) { |
| 408 TRACE_EVENT_ASYNC_BEGIN0("ServiceWorker", | 407 TRACE_EVENT_ASYNC_BEGIN0("ServiceWorker", |
| 409 "ServiceWorkerContextClient::StartingWorkerContext", | 408 "ServiceWorkerContextClient::StartingWorkerContext", |
| 410 this); | 409 this); |
| 411 TRACE_EVENT_ASYNC_STEP_INTO0( | 410 TRACE_EVENT_ASYNC_STEP_INTO0( |
| 412 "ServiceWorker", | 411 "ServiceWorker", |
| 413 "ServiceWorkerContextClient::StartingWorkerContext", | 412 "ServiceWorkerContextClient::StartingWorkerContext", |
| 414 this, | 413 this, |
| 415 "PrepareWorker"); | 414 "PrepareWorker"); |
| 416 } | 415 } |
| 417 | 416 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 553 |
| 555 ServiceWorkerRegistrationObjectInfo registration_info; | 554 ServiceWorkerRegistrationObjectInfo registration_info; |
| 556 ServiceWorkerVersionAttributes version_attrs; | 555 ServiceWorkerVersionAttributes version_attrs; |
| 557 provider_context_->GetAssociatedRegistration(®istration_info, | 556 provider_context_->GetAssociatedRegistration(®istration_info, |
| 558 &version_attrs); | 557 &version_attrs); |
| 559 DCHECK_NE(registration_info.registration_id, | 558 DCHECK_NE(registration_info.registration_id, |
| 560 kInvalidServiceWorkerRegistrationId); | 559 kInvalidServiceWorkerRegistrationId); |
| 561 | 560 |
| 562 // Register Mojo interfaces. | 561 // Register Mojo interfaces. |
| 563 context_->interface_registry.AddInterface( | 562 context_->interface_registry.AddInterface( |
| 564 base::Bind(&BackgroundSyncClientImpl::Create)); | |
| 565 context_->interface_registry.AddInterface( | |
| 566 base::Bind(&FetchEventDispatcherImpl::Create)); | 563 base::Bind(&FetchEventDispatcherImpl::Create)); |
| 567 | 564 |
| 568 if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) { | 565 if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) { |
| 569 DCHECK(embedded_worker_client_); | 566 DCHECK(embedded_worker_client_); |
| 570 embedded_worker_client_->ExposeInterfacesToBrowser( | 567 embedded_worker_client_->ExposeInterfacesToBrowser( |
| 571 &context_->interface_registry); | 568 &context_->interface_registry); |
| 572 } | 569 } |
| 573 | 570 |
| 574 SetRegistrationInServiceWorkerGlobalScope(registration_info, version_attrs); | 571 SetRegistrationInServiceWorkerGlobalScope(registration_info, version_attrs); |
| 575 | 572 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 604 context, service_worker_version_id_, script_url_); | 601 context, service_worker_version_id_, script_url_); |
| 605 } | 602 } |
| 606 | 603 |
| 607 void ServiceWorkerContextClient::willDestroyWorkerContext( | 604 void ServiceWorkerContextClient::willDestroyWorkerContext( |
| 608 v8::Local<v8::Context> context) { | 605 v8::Local<v8::Context> context) { |
| 609 // At this point WillStopCurrentWorkerThread is already called, so | 606 // At this point WillStopCurrentWorkerThread is already called, so |
| 610 // worker_task_runner_->RunsTasksOnCurrentThread() returns false | 607 // worker_task_runner_->RunsTasksOnCurrentThread() returns false |
| 611 // (while we're still on the worker thread). | 608 // (while we're still on the worker thread). |
| 612 proxy_ = NULL; | 609 proxy_ = NULL; |
| 613 | 610 |
| 614 // Aborts the all pending sync event callbacks. | |
| 615 for (WorkerContextData::SyncEventCallbacksMap::iterator it( | |
| 616 &context_->sync_event_callbacks); | |
| 617 !it.IsAtEnd(); it.Advance()) { | |
| 618 it.GetCurrentValue()->Run(blink::mojom::ServiceWorkerEventStatus::ABORTED, | |
| 619 base::Time::Now()); | |
| 620 } | |
| 621 // Aborts the all pending fetch event callbacks. | 611 // Aborts the all pending fetch event callbacks. |
| 622 for (WorkerContextData::FetchEventCallbacksMap::iterator it( | 612 for (WorkerContextData::FetchEventCallbacksMap::iterator it( |
| 623 &context_->fetch_event_callbacks); | 613 &context_->fetch_event_callbacks); |
| 624 !it.IsAtEnd(); it.Advance()) { | 614 !it.IsAtEnd(); it.Advance()) { |
| 625 it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now()); | 615 it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now()); |
| 626 } | 616 } |
| 627 | 617 |
| 628 // We have to clear callbacks now, as they need to be freed on the | 618 // We have to clear callbacks now, as they need to be freed on the |
| 629 // same thread. | 619 // same thread. |
| 630 context_.reset(); | 620 context_.reset(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 | 791 |
| 802 void ServiceWorkerContextClient::didHandlePushEvent( | 792 void ServiceWorkerContextClient::didHandlePushEvent( |
| 803 int request_id, | 793 int request_id, |
| 804 blink::WebServiceWorkerEventResult result, | 794 blink::WebServiceWorkerEventResult result, |
| 805 double event_dispatch_time) { | 795 double event_dispatch_time) { |
| 806 Send(new ServiceWorkerHostMsg_PushEventFinished( | 796 Send(new ServiceWorkerHostMsg_PushEventFinished( |
| 807 GetRoutingID(), request_id, result, | 797 GetRoutingID(), request_id, result, |
| 808 base::Time::FromDoubleT(event_dispatch_time))); | 798 base::Time::FromDoubleT(event_dispatch_time))); |
| 809 } | 799 } |
| 810 | 800 |
| 811 void ServiceWorkerContextClient::didHandleSyncEvent( | |
| 812 int request_id, | |
| 813 blink::WebServiceWorkerEventResult result, | |
| 814 double event_dispatch_time) { | |
| 815 const SyncCallback* callback = | |
| 816 context_->sync_event_callbacks.Lookup(request_id); | |
| 817 if (!callback) | |
| 818 return; | |
| 819 if (result == blink::WebServiceWorkerEventResultCompleted) { | |
| 820 callback->Run(blink::mojom::ServiceWorkerEventStatus::COMPLETED, | |
| 821 base::Time::FromDoubleT(event_dispatch_time)); | |
| 822 } else { | |
| 823 callback->Run(blink::mojom::ServiceWorkerEventStatus::REJECTED, | |
| 824 base::Time::FromDoubleT(event_dispatch_time)); | |
| 825 } | |
| 826 context_->sync_event_callbacks.Remove(request_id); | |
| 827 } | |
| 828 | |
| 829 blink::WebServiceWorkerNetworkProvider* | 801 blink::WebServiceWorkerNetworkProvider* |
| 830 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( | 802 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( |
| 831 blink::WebDataSource* data_source) { | 803 blink::WebDataSource* data_source) { |
| 832 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 804 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
| 833 | 805 |
| 834 // Create a content::ServiceWorkerNetworkProvider for this data source so | 806 // Create a content::ServiceWorkerNetworkProvider for this data source so |
| 835 // we can observe its requests. | 807 // we can observe its requests. |
| 836 std::unique_ptr<ServiceWorkerNetworkProvider> provider = | 808 std::unique_ptr<ServiceWorkerNetworkProvider> provider = |
| 837 base::MakeUnique<ServiceWorkerNetworkProvider>( | 809 base::MakeUnique<ServiceWorkerNetworkProvider>( |
| 838 MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | 810 MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 896 } |
| 925 | 897 |
| 926 void ServiceWorkerContextClient::registerForeignFetchScopes( | 898 void ServiceWorkerContextClient::registerForeignFetchScopes( |
| 927 const blink::WebVector<blink::WebURL>& sub_scopes, | 899 const blink::WebVector<blink::WebURL>& sub_scopes, |
| 928 const blink::WebVector<blink::WebSecurityOrigin>& origins) { | 900 const blink::WebVector<blink::WebSecurityOrigin>& origins) { |
| 929 Send(new ServiceWorkerHostMsg_RegisterForeignFetchScopes( | 901 Send(new ServiceWorkerHostMsg_RegisterForeignFetchScopes( |
| 930 GetRoutingID(), std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()), | 902 GetRoutingID(), std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()), |
| 931 std::vector<url::Origin>(origins.begin(), origins.end()))); | 903 std::vector<url::Origin>(origins.begin(), origins.end()))); |
| 932 } | 904 } |
| 933 | 905 |
| 934 void ServiceWorkerContextClient::DispatchSyncEvent( | 906 blink::InterfaceRegistry* ServiceWorkerContextClient::interfaceRegistry() { |
| 935 const std::string& tag, | 907 return context_->blink_interface_registry.get(); |
| 936 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, | |
| 937 const SyncCallback& callback) { | |
| 938 TRACE_EVENT0("ServiceWorker", | |
| 939 "ServiceWorkerContextClient::DispatchSyncEvent"); | |
| 940 int request_id = | |
| 941 context_->sync_event_callbacks.Add(new SyncCallback(callback)); | |
| 942 | |
| 943 // TODO(jkarlin): Make this blink::WebString::FromUTF8Lenient once | |
| 944 // https://crrev.com/1768063002/ lands. | |
| 945 proxy_->dispatchSyncEvent(request_id, blink::WebString::fromUTF8(tag), | |
| 946 last_chance); | |
| 947 } | 908 } |
| 948 | 909 |
| 949 void ServiceWorkerContextClient::Send(IPC::Message* message) { | 910 void ServiceWorkerContextClient::Send(IPC::Message* message) { |
| 950 sender_->Send(message); | 911 sender_->Send(message); |
| 951 } | 912 } |
| 952 | 913 |
| 953 void ServiceWorkerContextClient::SendWorkerStarted() { | 914 void ServiceWorkerContextClient::SendWorkerStarted() { |
| 954 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 915 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 955 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 916 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
| 956 "ServiceWorkerContextClient::StartingWorkerContext", | 917 "ServiceWorkerContextClient::StartingWorkerContext", |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 } | 1266 } |
| 1306 | 1267 |
| 1307 base::WeakPtr<ServiceWorkerContextClient> | 1268 base::WeakPtr<ServiceWorkerContextClient> |
| 1308 ServiceWorkerContextClient::GetWeakPtr() { | 1269 ServiceWorkerContextClient::GetWeakPtr() { |
| 1309 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1270 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1310 DCHECK(context_); | 1271 DCHECK(context_); |
| 1311 return context_->weak_factory.GetWeakPtr(); | 1272 return context_->weak_factory.GetWeakPtr(); |
| 1312 } | 1273 } |
| 1313 | 1274 |
| 1314 } // namespace content | 1275 } // namespace content |
| OLD | NEW |