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 <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 using SimpleEventCallback = | 265 using SimpleEventCallback = |
266 base::Callback<void(ServiceWorkerStatusCode, base::Time)>; | 266 base::Callback<void(ServiceWorkerStatusCode, base::Time)>; |
267 using ClientsCallbacksMap = | 267 using ClientsCallbacksMap = |
268 IDMap<std::unique_ptr<blink::WebServiceWorkerClientsCallbacks>>; | 268 IDMap<std::unique_ptr<blink::WebServiceWorkerClientsCallbacks>>; |
269 using ClaimClientsCallbacksMap = | 269 using ClaimClientsCallbacksMap = |
270 IDMap<std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks>>; | 270 IDMap<std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks>>; |
271 using ClientCallbacksMap = | 271 using ClientCallbacksMap = |
272 IDMap<std::unique_ptr<blink::WebServiceWorkerClientCallbacks>>; | 272 IDMap<std::unique_ptr<blink::WebServiceWorkerClientCallbacks>>; |
273 using SkipWaitingCallbacksMap = | 273 using SkipWaitingCallbacksMap = |
274 IDMap<std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks>>; | 274 IDMap<std::unique_ptr<blink::WebServiceWorkerSkipWaitingCallbacks>>; |
| 275 using InstallEventCallbacksMap = |
| 276 IDMap<std::unique_ptr<const DispatchInstallEventCallback>>; |
275 using ActivateEventCallbacksMap = | 277 using ActivateEventCallbacksMap = |
276 IDMap<std::unique_ptr<const DispatchActivateEventCallback>>; | 278 IDMap<std::unique_ptr<const DispatchActivateEventCallback>>; |
277 using BackgroundFetchAbortEventCallbacksMap = | 279 using BackgroundFetchAbortEventCallbacksMap = |
278 IDMap<std::unique_ptr<const DispatchBackgroundFetchAbortEventCallback>>; | 280 IDMap<std::unique_ptr<const DispatchBackgroundFetchAbortEventCallback>>; |
279 using BackgroundFetchClickEventCallbacksMap = | 281 using BackgroundFetchClickEventCallbacksMap = |
280 IDMap<std::unique_ptr<const DispatchBackgroundFetchClickEventCallback>>; | 282 IDMap<std::unique_ptr<const DispatchBackgroundFetchClickEventCallback>>; |
281 using BackgroundFetchFailEventCallbacksMap = | 283 using BackgroundFetchFailEventCallbacksMap = |
282 IDMap<std::unique_ptr<const DispatchBackgroundFetchFailEventCallback>>; | 284 IDMap<std::unique_ptr<const DispatchBackgroundFetchFailEventCallback>>; |
283 using BackgroundFetchedEventCallbacksMap = | 285 using BackgroundFetchedEventCallbacksMap = |
284 IDMap<std::unique_ptr<const DispatchBackgroundFetchedEventCallback>>; | 286 IDMap<std::unique_ptr<const DispatchBackgroundFetchedEventCallback>>; |
(...skipping 25 matching lines...) Expand all Loading... |
310 | 312 |
311 // Pending callbacks for OpenWindow() and FocusClient(). | 313 // Pending callbacks for OpenWindow() and FocusClient(). |
312 ClientCallbacksMap client_callbacks; | 314 ClientCallbacksMap client_callbacks; |
313 | 315 |
314 // Pending callbacks for SkipWaiting(). | 316 // Pending callbacks for SkipWaiting(). |
315 SkipWaitingCallbacksMap skip_waiting_callbacks; | 317 SkipWaitingCallbacksMap skip_waiting_callbacks; |
316 | 318 |
317 // Pending callbacks for ClaimClients(). | 319 // Pending callbacks for ClaimClients(). |
318 ClaimClientsCallbacksMap claim_clients_callbacks; | 320 ClaimClientsCallbacksMap claim_clients_callbacks; |
319 | 321 |
| 322 // Pending callbacks for Install Events. |
| 323 InstallEventCallbacksMap install_event_callbacks; |
| 324 |
320 // Pending callbacks for Activate Events. | 325 // Pending callbacks for Activate Events. |
321 ActivateEventCallbacksMap activate_event_callbacks; | 326 ActivateEventCallbacksMap activate_event_callbacks; |
322 | 327 |
323 // Pending callbacks for Background Fetch Abort Events. | 328 // Pending callbacks for Background Fetch Abort Events. |
324 BackgroundFetchAbortEventCallbacksMap background_fetch_abort_event_callbacks; | 329 BackgroundFetchAbortEventCallbacksMap background_fetch_abort_event_callbacks; |
325 | 330 |
326 // Pending callbacks for Background Fetch Click Events. | 331 // Pending callbacks for Background Fetch Click Events. |
327 BackgroundFetchClickEventCallbacksMap background_fetch_click_event_callbacks; | 332 BackgroundFetchClickEventCallbacksMap background_fetch_click_event_callbacks; |
328 | 333 |
329 // Pending callbacks for Background Fetch Fail Events. | 334 // Pending callbacks for Background Fetch Fail Events. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 std::map<int /* fetch_event_id */, | 366 std::map<int /* fetch_event_id */, |
362 mojom::ServiceWorkerFetchResponseCallbackPtr> | 367 mojom::ServiceWorkerFetchResponseCallbackPtr> |
363 fetch_response_callbacks; | 368 fetch_response_callbacks; |
364 | 369 |
365 // Pending callbacks for Extendable Message Events. | 370 // Pending callbacks for Extendable Message Events. |
366 ExtendableMessageEventCallbacksMap message_event_callbacks; | 371 ExtendableMessageEventCallbacksMap message_event_callbacks; |
367 | 372 |
368 // Pending navigation preload requests. | 373 // Pending navigation preload requests. |
369 NavigationPreloadRequestsMap preload_requests; | 374 NavigationPreloadRequestsMap preload_requests; |
370 | 375 |
| 376 // Maps every install event id with its corresponding |
| 377 // mojom::ServiceWorkerInstallEventMethodsAssociatedPt. |
| 378 InstallEventMethodsMap install_methods_map; |
| 379 |
371 base::ThreadChecker thread_checker; | 380 base::ThreadChecker thread_checker; |
372 base::WeakPtrFactory<ServiceWorkerContextClient> weak_factory; | 381 base::WeakPtrFactory<ServiceWorkerContextClient> weak_factory; |
373 base::WeakPtrFactory<blink::WebServiceWorkerContextProxy> proxy_weak_factory; | 382 base::WeakPtrFactory<blink::WebServiceWorkerContextProxy> proxy_weak_factory; |
374 }; | 383 }; |
375 | 384 |
376 class ServiceWorkerContextClient::NavigationPreloadRequest final | 385 class ServiceWorkerContextClient::NavigationPreloadRequest final |
377 : public mojom::URLLoaderClient { | 386 : public mojom::URLLoaderClient { |
378 public: | 387 public: |
379 NavigationPreloadRequest(int fetch_event_id, | 388 NavigationPreloadRequest(int fetch_event_id, |
380 const GURL& url, | 389 const GURL& url, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 565 |
557 ServiceWorkerContextClient::~ServiceWorkerContextClient() {} | 566 ServiceWorkerContextClient::~ServiceWorkerContextClient() {} |
558 | 567 |
559 void ServiceWorkerContextClient::OnMessageReceived( | 568 void ServiceWorkerContextClient::OnMessageReceived( |
560 int thread_id, | 569 int thread_id, |
561 int embedded_worker_id, | 570 int embedded_worker_id, |
562 const IPC::Message& message) { | 571 const IPC::Message& message) { |
563 CHECK_EQ(embedded_worker_id_, embedded_worker_id); | 572 CHECK_EQ(embedded_worker_id_, embedded_worker_id); |
564 bool handled = true; | 573 bool handled = true; |
565 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerContextClient, message) | 574 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerContextClient, message) |
566 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_InstallEvent, OnInstallEvent) | |
567 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidGetClient, OnDidGetClient) | 575 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidGetClient, OnDidGetClient) |
568 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidGetClients, OnDidGetClients) | 576 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidGetClients, OnDidGetClients) |
569 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowResponse, | 577 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowResponse, |
570 OnOpenWindowResponse) | 578 OnOpenWindowResponse) |
571 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowError, | 579 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowError, |
572 OnOpenWindowError) | 580 OnOpenWindowError) |
573 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse, | 581 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse, |
574 OnFocusClientResponse) | 582 OnFocusClientResponse) |
575 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_NavigateClientResponse, | 583 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_NavigateClientResponse, |
576 OnNavigateClientResponse) | 584 OnNavigateClientResponse) |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 context, service_worker_version_id_, script_url_); | 726 context, service_worker_version_id_, script_url_); |
719 } | 727 } |
720 | 728 |
721 void ServiceWorkerContextClient::WillDestroyWorkerContext( | 729 void ServiceWorkerContextClient::WillDestroyWorkerContext( |
722 v8::Local<v8::Context> context) { | 730 v8::Local<v8::Context> context) { |
723 // At this point WillStopCurrentWorkerThread is already called, so | 731 // At this point WillStopCurrentWorkerThread is already called, so |
724 // worker_task_runner_->RunsTasksOnCurrentThread() returns false | 732 // worker_task_runner_->RunsTasksOnCurrentThread() returns false |
725 // (while we're still on the worker thread). | 733 // (while we're still on the worker thread). |
726 proxy_ = NULL; | 734 proxy_ = NULL; |
727 | 735 |
728 // Aborts all the pending events callbacks. | 736 // Aborts the all pending install event callbacks which has three |
| 737 // parameters so that here can't use AbortPendingEventCallbacks. |
| 738 for (WorkerContextData::InstallEventCallbacksMap::iterator it( |
| 739 &context_->install_event_callbacks); |
| 740 !it.IsAtEnd(); it.Advance()) { |
| 741 it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, false, |
| 742 base::Time::Now()); |
| 743 } |
| 744 // Aborts all other pending events callbacks. |
729 AbortPendingEventCallbacks(context_->activate_event_callbacks); | 745 AbortPendingEventCallbacks(context_->activate_event_callbacks); |
730 AbortPendingEventCallbacks(context_->background_fetch_abort_event_callbacks); | 746 AbortPendingEventCallbacks(context_->background_fetch_abort_event_callbacks); |
731 AbortPendingEventCallbacks(context_->background_fetch_click_event_callbacks); | 747 AbortPendingEventCallbacks(context_->background_fetch_click_event_callbacks); |
732 AbortPendingEventCallbacks(context_->background_fetch_fail_event_callbacks); | 748 AbortPendingEventCallbacks(context_->background_fetch_fail_event_callbacks); |
733 AbortPendingEventCallbacks(context_->background_fetched_event_callbacks); | 749 AbortPendingEventCallbacks(context_->background_fetched_event_callbacks); |
734 AbortPendingEventCallbacks(context_->sync_event_callbacks); | 750 AbortPendingEventCallbacks(context_->sync_event_callbacks); |
735 AbortPendingEventCallbacks(context_->notification_click_event_callbacks); | 751 AbortPendingEventCallbacks(context_->notification_click_event_callbacks); |
736 AbortPendingEventCallbacks(context_->notification_close_event_callbacks); | 752 AbortPendingEventCallbacks(context_->notification_close_event_callbacks); |
737 AbortPendingEventCallbacks(context_->push_event_callbacks); | 753 AbortPendingEventCallbacks(context_->push_event_callbacks); |
738 AbortPendingEventCallbacks(context_->fetch_event_callbacks); | 754 AbortPendingEventCallbacks(context_->fetch_event_callbacks); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 DCHECK(callback); | 904 DCHECK(callback); |
889 callback->Run(EventResultToStatus(result), | 905 callback->Run(EventResultToStatus(result), |
890 base::Time::FromDoubleT(event_dispatch_time)); | 906 base::Time::FromDoubleT(event_dispatch_time)); |
891 context_->message_event_callbacks.Remove(request_id); | 907 context_->message_event_callbacks.Remove(request_id); |
892 } | 908 } |
893 | 909 |
894 void ServiceWorkerContextClient::DidHandleInstallEvent( | 910 void ServiceWorkerContextClient::DidHandleInstallEvent( |
895 int request_id, | 911 int request_id, |
896 blink::WebServiceWorkerEventResult result, | 912 blink::WebServiceWorkerEventResult result, |
897 double event_dispatch_time) { | 913 double event_dispatch_time) { |
898 Send(new ServiceWorkerHostMsg_InstallEventFinished( | 914 const DispatchInstallEventCallback* callback = |
899 GetRoutingID(), request_id, result, proxy_->HasFetchEventHandler(), | 915 context_->install_event_callbacks.Lookup(request_id); |
900 base::Time::FromDoubleT(event_dispatch_time))); | 916 DCHECK(callback); |
| 917 callback->Run(EventResultToStatus(result), proxy_->HasFetchEventHandler(), |
| 918 base::Time::FromDoubleT(event_dispatch_time)); |
| 919 context_->install_event_callbacks.Remove(request_id); |
| 920 context_->install_methods_map.erase(request_id); |
901 } | 921 } |
902 | 922 |
903 void ServiceWorkerContextClient::RespondToFetchEventWithNoResponse( | 923 void ServiceWorkerContextClient::RespondToFetchEventWithNoResponse( |
904 int fetch_event_id, | 924 int fetch_event_id, |
905 double event_dispatch_time) { | 925 double event_dispatch_time) { |
906 const mojom::ServiceWorkerFetchResponseCallbackPtr& response_callback = | 926 const mojom::ServiceWorkerFetchResponseCallbackPtr& response_callback = |
907 context_->fetch_response_callbacks[fetch_event_id]; | 927 context_->fetch_response_callbacks[fetch_event_id]; |
908 DCHECK(response_callback.is_bound()); | 928 DCHECK(response_callback.is_bound()); |
909 response_callback->OnFallback(base::Time::FromDoubleT(event_dispatch_time)); | 929 response_callback->OnFallback(base::Time::FromDoubleT(event_dispatch_time)); |
910 context_->fetch_response_callbacks.erase(fetch_event_id); | 930 context_->fetch_response_callbacks.erase(fetch_event_id); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 } | 1132 } |
1113 | 1133 |
1114 void ServiceWorkerContextClient::Claim( | 1134 void ServiceWorkerContextClient::Claim( |
1115 std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks> callbacks) { | 1135 std::unique_ptr<blink::WebServiceWorkerClientsClaimCallbacks> callbacks) { |
1116 DCHECK(callbacks); | 1136 DCHECK(callbacks); |
1117 int request_id = context_->claim_clients_callbacks.Add(std::move(callbacks)); | 1137 int request_id = context_->claim_clients_callbacks.Add(std::move(callbacks)); |
1118 Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id)); | 1138 Send(new ServiceWorkerHostMsg_ClaimClients(GetRoutingID(), request_id)); |
1119 } | 1139 } |
1120 | 1140 |
1121 void ServiceWorkerContextClient::RegisterForeignFetchScopes( | 1141 void ServiceWorkerContextClient::RegisterForeignFetchScopes( |
| 1142 int event_id, |
1122 const blink::WebVector<blink::WebURL>& sub_scopes, | 1143 const blink::WebVector<blink::WebURL>& sub_scopes, |
1123 const blink::WebVector<blink::WebSecurityOrigin>& origins) { | 1144 const blink::WebVector<blink::WebSecurityOrigin>& origins) { |
1124 Send(new ServiceWorkerHostMsg_RegisterForeignFetchScopes( | 1145 DCHECK(context_->install_methods_map[event_id].is_bound()); |
1125 GetRoutingID(), std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()), | 1146 context_->install_methods_map[event_id]->RegisterForeignFetchScopes( |
1126 std::vector<url::Origin>(origins.begin(), origins.end()))); | 1147 std::vector<GURL>(sub_scopes.begin(), sub_scopes.end()), |
| 1148 std::vector<url::Origin>(origins.begin(), origins.end())); |
1127 } | 1149 } |
1128 | 1150 |
1129 void ServiceWorkerContextClient::DispatchSyncEvent( | 1151 void ServiceWorkerContextClient::DispatchSyncEvent( |
1130 const std::string& tag, | 1152 const std::string& tag, |
1131 blink::mojom::BackgroundSyncEventLastChance last_chance, | 1153 blink::mojom::BackgroundSyncEventLastChance last_chance, |
1132 const DispatchSyncEventCallback& callback) { | 1154 const DispatchSyncEventCallback& callback) { |
1133 TRACE_EVENT0("ServiceWorker", | 1155 TRACE_EVENT0("ServiceWorker", |
1134 "ServiceWorkerContextClient::DispatchSyncEvent"); | 1156 "ServiceWorkerContextClient::DispatchSyncEvent"); |
1135 int request_id = context_->sync_event_callbacks.Add( | 1157 int request_id = context_->sync_event_callbacks.Add( |
1136 base::MakeUnique<SyncCallback>(callback)); | 1158 base::MakeUnique<SyncCallback>(callback)); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 fetches.size()); | 1286 fetches.size()); |
1265 for (size_t i = 0; i < fetches.size(); ++i) { | 1287 for (size_t i = 0; i < fetches.size(); ++i) { |
1266 ToWebServiceWorkerRequest(fetches[i].request, &web_fetches[i].request); | 1288 ToWebServiceWorkerRequest(fetches[i].request, &web_fetches[i].request); |
1267 ToWebServiceWorkerResponse(fetches[i].response, &web_fetches[i].response); | 1289 ToWebServiceWorkerResponse(fetches[i].response, &web_fetches[i].response); |
1268 } | 1290 } |
1269 | 1291 |
1270 proxy_->DispatchBackgroundFetchedEvent( | 1292 proxy_->DispatchBackgroundFetchedEvent( |
1271 request_id, blink::WebString::FromUTF8(tag), web_fetches); | 1293 request_id, blink::WebString::FromUTF8(tag), web_fetches); |
1272 } | 1294 } |
1273 | 1295 |
| 1296 void ServiceWorkerContextClient::DispatchInstallEvent( |
| 1297 mojom::ServiceWorkerInstallEventMethodsAssociatedPtrInfo client, |
| 1298 const DispatchInstallEventCallback& callback) { |
| 1299 TRACE_EVENT0("ServiceWorker", |
| 1300 "ServiceWorkerContextClient::DispatchInstallEvent"); |
| 1301 |
| 1302 int event_id = context_->install_event_callbacks.Add( |
| 1303 base::MakeUnique<DispatchInstallEventCallback>(callback)); |
| 1304 |
| 1305 DCHECK(!context_->install_methods_map.count(event_id)); |
| 1306 mojom::ServiceWorkerInstallEventMethodsAssociatedPtr install_methods; |
| 1307 install_methods.Bind(std::move(client)); |
| 1308 context_->install_methods_map[event_id] = std::move(install_methods); |
| 1309 |
| 1310 proxy_->DispatchInstallEvent(event_id); |
| 1311 } |
| 1312 |
1274 void ServiceWorkerContextClient::DispatchExtendableMessageEvent( | 1313 void ServiceWorkerContextClient::DispatchExtendableMessageEvent( |
1275 mojom::ExtendableMessageEventPtr event, | 1314 mojom::ExtendableMessageEventPtr event, |
1276 const DispatchExtendableMessageEventCallback& callback) { | 1315 const DispatchExtendableMessageEventCallback& callback) { |
1277 TRACE_EVENT0("ServiceWorker", | 1316 TRACE_EVENT0("ServiceWorker", |
1278 "ServiceWorkerContextClient::DispatchExtendableMessageEvent"); | 1317 "ServiceWorkerContextClient::DispatchExtendableMessageEvent"); |
1279 int request_id = context_->message_event_callbacks.Add( | 1318 int request_id = context_->message_event_callbacks.Add( |
1280 base::MakeUnique<DispatchExtendableMessageEventCallback>(callback)); | 1319 base::MakeUnique<DispatchExtendableMessageEventCallback>(callback)); |
1281 | 1320 |
1282 blink::WebMessagePortChannelArray ports = | 1321 blink::WebMessagePortChannelArray ports = |
1283 WebMessagePortChannelImpl::CreateFromMessagePipeHandles( | 1322 WebMessagePortChannelImpl::CreateFromMessagePipeHandles( |
(...skipping 15 matching lines...) Expand all Loading... |
1299 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 1338 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
1300 sender_.get(), main_thread_task_runner_.get()); | 1339 sender_.get(), main_thread_task_runner_.get()); |
1301 scoped_refptr<WebServiceWorkerImpl> worker = | 1340 scoped_refptr<WebServiceWorkerImpl> worker = |
1302 dispatcher->GetOrCreateServiceWorker(std::move(handle)); | 1341 dispatcher->GetOrCreateServiceWorker(std::move(handle)); |
1303 proxy_->DispatchExtendableMessageEvent( | 1342 proxy_->DispatchExtendableMessageEvent( |
1304 request_id, blink::WebString::FromUTF16(event->message), | 1343 request_id, blink::WebString::FromUTF16(event->message), |
1305 event->source_origin, std::move(ports), | 1344 event->source_origin, std::move(ports), |
1306 WebServiceWorkerImpl::CreateHandle(worker)); | 1345 WebServiceWorkerImpl::CreateHandle(worker)); |
1307 } | 1346 } |
1308 | 1347 |
1309 void ServiceWorkerContextClient::OnInstallEvent(int request_id) { | |
1310 TRACE_EVENT0("ServiceWorker", | |
1311 "ServiceWorkerContextClient::OnInstallEvent"); | |
1312 proxy_->DispatchInstallEvent(request_id); | |
1313 } | |
1314 | |
1315 void ServiceWorkerContextClient::DispatchFetchEvent( | 1348 void ServiceWorkerContextClient::DispatchFetchEvent( |
1316 int fetch_event_id, | 1349 int fetch_event_id, |
1317 const ServiceWorkerFetchRequest& request, | 1350 const ServiceWorkerFetchRequest& request, |
1318 mojom::FetchEventPreloadHandlePtr preload_handle, | 1351 mojom::FetchEventPreloadHandlePtr preload_handle, |
1319 mojom::ServiceWorkerFetchResponseCallbackPtr response_callback, | 1352 mojom::ServiceWorkerFetchResponseCallbackPtr response_callback, |
1320 const DispatchFetchEventCallback& callback) { | 1353 const DispatchFetchEventCallback& callback) { |
1321 std::unique_ptr<NavigationPreloadRequest> preload_request = | 1354 std::unique_ptr<NavigationPreloadRequest> preload_request = |
1322 preload_handle | 1355 preload_handle |
1323 ? base::MakeUnique<NavigationPreloadRequest>( | 1356 ? base::MakeUnique<NavigationPreloadRequest>( |
1324 fetch_event_id, request.url, std::move(preload_handle)) | 1357 fetch_event_id, request.url, std::move(preload_handle)) |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 } | 1639 } |
1607 | 1640 |
1608 base::WeakPtr<ServiceWorkerContextClient> | 1641 base::WeakPtr<ServiceWorkerContextClient> |
1609 ServiceWorkerContextClient::GetWeakPtr() { | 1642 ServiceWorkerContextClient::GetWeakPtr() { |
1610 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1643 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1611 DCHECK(context_); | 1644 DCHECK(context_); |
1612 return context_->weak_factory.GetWeakPtr(); | 1645 return context_->weak_factory.GetWeakPtr(); |
1613 } | 1646 } |
1614 | 1647 |
1615 } // namespace content | 1648 } // namespace content |
OLD | NEW |