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 19 matching lines...) Expand all Loading... |
30 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 30 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
31 #include "content/child/thread_safe_sender.h" | 31 #include "content/child/thread_safe_sender.h" |
32 #include "content/child/web_data_consumer_handle_impl.h" | 32 #include "content/child/web_data_consumer_handle_impl.h" |
33 #include "content/child/web_url_loader_impl.h" | 33 #include "content/child/web_url_loader_impl.h" |
34 #include "content/child/webmessageportchannel_impl.h" | 34 #include "content/child/webmessageportchannel_impl.h" |
35 #include "content/common/devtools_messages.h" | 35 #include "content/common/devtools_messages.h" |
36 #include "content/common/service_worker/embedded_worker_messages.h" | 36 #include "content/common/service_worker/embedded_worker_messages.h" |
37 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" | 37 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" |
38 #include "content/common/service_worker/service_worker_messages.h" | 38 #include "content/common/service_worker/service_worker_messages.h" |
39 #include "content/common/service_worker/service_worker_status_code.h" | 39 #include "content/common/service_worker/service_worker_status_code.h" |
40 #include "content/common/service_worker/service_worker_utils.h" | |
41 #include "content/public/common/push_event_payload.h" | 40 #include "content/public/common/push_event_payload.h" |
42 #include "content/public/common/referrer.h" | 41 #include "content/public/common/referrer.h" |
43 #include "content/public/renderer/content_renderer_client.h" | 42 #include "content/public/renderer/content_renderer_client.h" |
44 #include "content/public/renderer/document_state.h" | 43 #include "content/public/renderer/document_state.h" |
45 #include "content/renderer/devtools/devtools_agent.h" | 44 #include "content/renderer/devtools/devtools_agent.h" |
46 #include "content/renderer/render_thread_impl.h" | 45 #include "content/renderer/render_thread_impl.h" |
47 #include "content/renderer/service_worker/embedded_worker_devtools_agent.h" | 46 #include "content/renderer/service_worker/embedded_worker_devtools_agent.h" |
48 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | |
49 #include "content/renderer/service_worker/embedded_worker_instance_client_impl.h
" | 47 #include "content/renderer/service_worker/embedded_worker_instance_client_impl.h
" |
50 #include "content/renderer/service_worker/service_worker_type_converters.h" | 48 #include "content/renderer/service_worker/service_worker_type_converters.h" |
51 #include "content/renderer/service_worker/service_worker_type_util.h" | 49 #include "content/renderer/service_worker/service_worker_type_util.h" |
52 #include "ipc/ipc_message.h" | 50 #include "ipc/ipc_message.h" |
53 #include "ipc/ipc_message_macros.h" | 51 #include "ipc/ipc_message_macros.h" |
54 #include "net/http/http_response_headers.h" | 52 #include "net/http/http_response_headers.h" |
55 #include "third_party/WebKit/public/platform/URLConversion.h" | 53 #include "third_party/WebKit/public/platform/URLConversion.h" |
56 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 54 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
57 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 55 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
58 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 56 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
(...skipping 12 matching lines...) Expand all Loading... |
71 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" | 69 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" |
72 | 70 |
73 namespace content { | 71 namespace content { |
74 | 72 |
75 namespace { | 73 namespace { |
76 | 74 |
77 // For now client must be a per-thread instance. | 75 // For now client must be a per-thread instance. |
78 base::LazyInstance<base::ThreadLocalPointer<ServiceWorkerContextClient>>:: | 76 base::LazyInstance<base::ThreadLocalPointer<ServiceWorkerContextClient>>:: |
79 Leaky g_worker_client_tls = LAZY_INSTANCE_INITIALIZER; | 77 Leaky g_worker_client_tls = LAZY_INSTANCE_INITIALIZER; |
80 | 78 |
81 void CallWorkerContextDestroyedOnMainThread(int embedded_worker_id) { | |
82 if (!RenderThreadImpl::current() || | |
83 !RenderThreadImpl::current()->embedded_worker_dispatcher()) | |
84 return; | |
85 RenderThreadImpl::current()->embedded_worker_dispatcher()-> | |
86 WorkerContextDestroyed(embedded_worker_id); | |
87 } | |
88 | |
89 // Called on the main thread only and blink owns it. | 79 // Called on the main thread only and blink owns it. |
90 class WebServiceWorkerNetworkProviderImpl | 80 class WebServiceWorkerNetworkProviderImpl |
91 : public blink::WebServiceWorkerNetworkProvider { | 81 : public blink::WebServiceWorkerNetworkProvider { |
92 public: | 82 public: |
93 explicit WebServiceWorkerNetworkProviderImpl( | 83 explicit WebServiceWorkerNetworkProviderImpl( |
94 std::unique_ptr<ServiceWorkerNetworkProvider> provider) | 84 std::unique_ptr<ServiceWorkerNetworkProvider> provider) |
95 : provider_(std::move(provider)) {} | 85 : provider_(std::move(provider)) {} |
96 | 86 |
97 // Blink calls this method for each request starting with the main script, | 87 // Blink calls this method for each request starting with the main script, |
98 // we tag them with the provider id. | 88 // we tag them with the provider id. |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 ServiceWorkerContextClient::ThreadSpecificInstance() { | 473 ServiceWorkerContextClient::ThreadSpecificInstance() { |
484 return g_worker_client_tls.Pointer()->Get(); | 474 return g_worker_client_tls.Pointer()->Get(); |
485 } | 475 } |
486 | 476 |
487 ServiceWorkerContextClient::ServiceWorkerContextClient( | 477 ServiceWorkerContextClient::ServiceWorkerContextClient( |
488 int embedded_worker_id, | 478 int embedded_worker_id, |
489 int64_t service_worker_version_id, | 479 int64_t service_worker_version_id, |
490 const GURL& service_worker_scope, | 480 const GURL& service_worker_scope, |
491 const GURL& script_url, | 481 const GURL& script_url, |
492 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, | 482 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, |
| 483 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host, |
493 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client) | 484 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client) |
494 : embedded_worker_id_(embedded_worker_id), | 485 : embedded_worker_id_(embedded_worker_id), |
495 service_worker_version_id_(service_worker_version_id), | 486 service_worker_version_id_(service_worker_version_id), |
496 service_worker_scope_(service_worker_scope), | 487 service_worker_scope_(service_worker_scope), |
497 script_url_(script_url), | 488 script_url_(script_url), |
498 sender_(ChildThreadImpl::current()->thread_safe_sender()), | 489 sender_(ChildThreadImpl::current()->thread_safe_sender()), |
499 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 490 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
500 proxy_(nullptr), | 491 proxy_(nullptr), |
501 pending_dispatcher_request_(std::move(dispatcher_request)), | 492 pending_dispatcher_request_(std::move(dispatcher_request)), |
502 embedded_worker_client_(std::move(embedded_worker_client)) { | 493 embedded_worker_client_(std::move(embedded_worker_client)) { |
| 494 instance_host_ = |
| 495 mojom::ThreadSafeEmbeddedWorkerInstanceHostAssociatedPtr::Create( |
| 496 std::move(instance_host), main_thread_task_runner_); |
503 TRACE_EVENT_ASYNC_BEGIN0("ServiceWorker", | 497 TRACE_EVENT_ASYNC_BEGIN0("ServiceWorker", |
504 "ServiceWorkerContextClient::StartingWorkerContext", | 498 "ServiceWorkerContextClient::StartingWorkerContext", |
505 this); | 499 this); |
506 TRACE_EVENT_ASYNC_STEP_INTO0( | 500 TRACE_EVENT_ASYNC_STEP_INTO0( |
507 "ServiceWorker", | 501 "ServiceWorker", |
508 "ServiceWorkerContextClient::StartingWorkerContext", | 502 "ServiceWorkerContextClient::StartingWorkerContext", |
509 this, | 503 this, |
510 "PrepareWorker"); | 504 "PrepareWorker"); |
511 } | 505 } |
512 | 506 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 size_t size) { | 573 size_t size) { |
580 std::vector<char> copy(data, data + size); | 574 std::vector<char> copy(data, data + size); |
581 Send(new ServiceWorkerHostMsg_SetCachedMetadata(GetRoutingID(), url, copy)); | 575 Send(new ServiceWorkerHostMsg_SetCachedMetadata(GetRoutingID(), url, copy)); |
582 } | 576 } |
583 | 577 |
584 void ServiceWorkerContextClient::ClearCachedMetadata(const blink::WebURL& url) { | 578 void ServiceWorkerContextClient::ClearCachedMetadata(const blink::WebURL& url) { |
585 Send(new ServiceWorkerHostMsg_ClearCachedMetadata(GetRoutingID(), url)); | 579 Send(new ServiceWorkerHostMsg_ClearCachedMetadata(GetRoutingID(), url)); |
586 } | 580 } |
587 | 581 |
588 void ServiceWorkerContextClient::WorkerReadyForInspection() { | 582 void ServiceWorkerContextClient::WorkerReadyForInspection() { |
589 Send(new EmbeddedWorkerHostMsg_WorkerReadyForInspection(embedded_worker_id_)); | 583 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
| 584 (*instance_host_)->OnReadyForInspection(); |
590 } | 585 } |
591 | 586 |
592 void ServiceWorkerContextClient::WorkerContextFailedToStart() { | 587 void ServiceWorkerContextClient::WorkerContextFailedToStart() { |
593 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 588 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
594 DCHECK(!proxy_); | 589 DCHECK(!proxy_); |
595 | 590 |
596 Send(new EmbeddedWorkerHostMsg_WorkerScriptLoadFailed(embedded_worker_id_)); | 591 (*instance_host_)->OnScriptLoadFailed(); |
| 592 (*instance_host_)->OnStopped(); |
597 | 593 |
598 RenderThreadImpl::current()->embedded_worker_dispatcher()-> | 594 DCHECK(embedded_worker_client_); |
599 WorkerContextDestroyed(embedded_worker_id_); | 595 embedded_worker_client_->WorkerContextDestroyed(); |
600 } | 596 } |
601 | 597 |
602 void ServiceWorkerContextClient::WorkerScriptLoaded() { | 598 void ServiceWorkerContextClient::WorkerScriptLoaded() { |
603 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); | 599 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); |
604 DCHECK(!proxy_); | 600 DCHECK(!proxy_); |
605 | 601 |
606 Send(new EmbeddedWorkerHostMsg_WorkerScriptLoaded(embedded_worker_id_)); | 602 (*instance_host_)->OnScriptLoaded(); |
607 } | 603 } |
608 | 604 |
609 bool ServiceWorkerContextClient::HasAssociatedRegistration() { | 605 bool ServiceWorkerContextClient::HasAssociatedRegistration() { |
610 return provider_context_ && provider_context_->HasAssociatedRegistration(); | 606 return provider_context_ && provider_context_->HasAssociatedRegistration(); |
611 } | 607 } |
612 | 608 |
613 void ServiceWorkerContextClient::WorkerContextStarted( | 609 void ServiceWorkerContextClient::WorkerContextStarted( |
614 blink::WebServiceWorkerContextProxy* proxy) { | 610 blink::WebServiceWorkerContextProxy* proxy) { |
615 DCHECK(!worker_task_runner_.get()); | 611 DCHECK(!worker_task_runner_.get()); |
616 DCHECK_NE(0, WorkerThread::GetCurrentId()); | 612 DCHECK_NE(0, WorkerThread::GetCurrentId()); |
(...skipping 17 matching lines...) Expand all Loading... |
634 DCHECK_NE(registration_info.registration_id, | 630 DCHECK_NE(registration_info.registration_id, |
635 kInvalidServiceWorkerRegistrationId); | 631 kInvalidServiceWorkerRegistrationId); |
636 | 632 |
637 DCHECK(pending_dispatcher_request_.is_pending()); | 633 DCHECK(pending_dispatcher_request_.is_pending()); |
638 DCHECK(!context_->event_dispatcher_binding.is_bound()); | 634 DCHECK(!context_->event_dispatcher_binding.is_bound()); |
639 context_->event_dispatcher_binding.Bind( | 635 context_->event_dispatcher_binding.Bind( |
640 std::move(pending_dispatcher_request_)); | 636 std::move(pending_dispatcher_request_)); |
641 | 637 |
642 SetRegistrationInServiceWorkerGlobalScope(registration_info, version_attrs); | 638 SetRegistrationInServiceWorkerGlobalScope(registration_info, version_attrs); |
643 | 639 |
644 Send(new EmbeddedWorkerHostMsg_WorkerThreadStarted( | 640 (*instance_host_) |
645 embedded_worker_id_, WorkerThread::GetCurrentId(), | 641 ->OnThreadStarted(WorkerThread::GetCurrentId(), |
646 provider_context_->provider_id())); | 642 provider_context_->provider_id()); |
647 | 643 |
648 TRACE_EVENT_ASYNC_STEP_INTO0( | 644 TRACE_EVENT_ASYNC_STEP_INTO0( |
649 "ServiceWorker", | 645 "ServiceWorker", |
650 "ServiceWorkerContextClient::StartingWorkerContext", | 646 "ServiceWorkerContextClient::StartingWorkerContext", |
651 this, | 647 this, |
652 "ExecuteScript"); | 648 "ExecuteScript"); |
653 } | 649 } |
654 | 650 |
655 void ServiceWorkerContextClient::DidEvaluateWorkerScript(bool success) { | 651 void ServiceWorkerContextClient::DidEvaluateWorkerScript(bool success) { |
656 Send(new EmbeddedWorkerHostMsg_WorkerScriptEvaluated( | 652 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
657 embedded_worker_id_, success)); | 653 (*instance_host_)->OnScriptEvaluated(success); |
658 | 654 |
659 // Schedule a task to send back WorkerStarted asynchronously, | 655 // Schedule a task to send back WorkerStarted asynchronously, |
660 // so that at the time we send it we can be sure that the | 656 // so that at the time we send it we can be sure that the |
661 // worker run loop has been started. | 657 // worker run loop has been started. |
662 worker_task_runner_->PostTask( | 658 worker_task_runner_->PostTask( |
663 FROM_HERE, base::Bind(&ServiceWorkerContextClient::SendWorkerStarted, | 659 FROM_HERE, base::Bind(&ServiceWorkerContextClient::SendWorkerStarted, |
664 GetWeakPtr())); | 660 GetWeakPtr())); |
665 } | 661 } |
666 | 662 |
667 void ServiceWorkerContextClient::DidInitializeWorkerContext( | 663 void ServiceWorkerContextClient::DidInitializeWorkerContext( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // this client. | 696 // this client. |
701 g_worker_client_tls.Pointer()->Set(NULL); | 697 g_worker_client_tls.Pointer()->Set(NULL); |
702 | 698 |
703 GetContentClient()->renderer()->WillDestroyServiceWorkerContextOnWorkerThread( | 699 GetContentClient()->renderer()->WillDestroyServiceWorkerContextOnWorkerThread( |
704 context, service_worker_version_id_, script_url_); | 700 context, service_worker_version_id_, script_url_); |
705 } | 701 } |
706 | 702 |
707 void ServiceWorkerContextClient::WorkerContextDestroyed() { | 703 void ServiceWorkerContextClient::WorkerContextDestroyed() { |
708 DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); | 704 DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); |
709 | 705 |
710 // Check if mojo is enabled | 706 // TODO(shimazu): The signals to the browser should be in the order: |
711 if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) { | 707 // (1) WorkerStopped (via mojo call EmbeddedWorkerInstanceHost.OnStopped()) |
712 DCHECK(embedded_worker_client_); | 708 // (2) ProviderDestroyed (via mojo call |
713 main_thread_task_runner_->PostTask( | 709 // ServiceWorkerDispatcherHost.OnProviderDestroyed()), this is triggered by |
714 FROM_HERE, | 710 // the following EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed(), |
715 base::Bind(&EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted, | 711 // which will eventually lead to destruction of the service worker provider. |
716 base::Passed(&embedded_worker_client_))); | 712 // But currently EmbeddedWorkerInstanceHost interface is associated with |
717 return; | 713 // EmbeddedWorkerInstanceClient interface, and ServiceWorkerDispatcherHost |
718 } | 714 // interface is associated with the IPC channel, since they are using |
| 715 // different mojo message pipes, the FIFO ordering can not be guaranteed now. |
| 716 // This will be solved once ServiceWorkerProvider{Host,Client} are mojoified |
| 717 // and they are also associated with EmbeddedWorkerInstanceClient in other CLs |
| 718 // (https://crrev.com/2653493009 and https://crrev.com/2779763004). |
| 719 (*instance_host_)->OnStopped(); |
719 | 720 |
720 // Now we should be able to free the WebEmbeddedWorker container on the | 721 DCHECK(embedded_worker_client_); |
721 // main thread. | |
722 main_thread_task_runner_->PostTask( | 722 main_thread_task_runner_->PostTask( |
723 FROM_HERE, | 723 FROM_HERE, |
724 base::Bind(&CallWorkerContextDestroyedOnMainThread, | 724 base::Bind(&EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed, |
725 embedded_worker_id_)); | 725 base::Passed(&embedded_worker_client_))); |
| 726 return; |
726 } | 727 } |
727 | 728 |
728 void ServiceWorkerContextClient::CountFeature(uint32_t feature) { | 729 void ServiceWorkerContextClient::CountFeature(uint32_t feature) { |
729 Send(new EmbeddedWorkerHostMsg_CountFeature(service_worker_version_id_, | 730 Send(new EmbeddedWorkerHostMsg_CountFeature(service_worker_version_id_, |
730 feature)); | 731 feature)); |
731 } | 732 } |
732 | 733 |
733 void ServiceWorkerContextClient::ReportException( | 734 void ServiceWorkerContextClient::ReportException( |
734 const blink::WebString& error_message, | 735 const blink::WebString& error_message, |
735 int line_number, | 736 int line_number, |
736 int column_number, | 737 int column_number, |
737 const blink::WebString& source_url) { | 738 const blink::WebString& source_url) { |
738 Send(new EmbeddedWorkerHostMsg_ReportException( | 739 (*instance_host_) |
739 embedded_worker_id_, error_message.Utf16(), line_number, column_number, | 740 ->OnReportException(error_message.Utf16(), line_number, column_number, |
740 blink::WebStringToGURL(source_url))); | 741 blink::WebStringToGURL(source_url)); |
741 } | 742 } |
742 | 743 |
743 void ServiceWorkerContextClient::ReportConsoleMessage( | 744 void ServiceWorkerContextClient::ReportConsoleMessage( |
744 int source, | 745 int source, |
745 int level, | 746 int level, |
746 const blink::WebString& message, | 747 const blink::WebString& message, |
747 int line_number, | 748 int line_number, |
748 const blink::WebString& source_url) { | 749 const blink::WebString& source_url) { |
749 EmbeddedWorkerHostMsg_ReportConsoleMessage_Params params; | 750 (*instance_host_) |
750 params.source_identifier = source; | 751 ->OnReportConsoleMessage(source, level, message.Utf16(), line_number, |
751 params.message_level = level; | 752 blink::WebStringToGURL(source_url)); |
752 params.message = message.Utf16(); | |
753 params.line_number = line_number; | |
754 params.source_url = blink::WebStringToGURL(source_url); | |
755 | |
756 Send(new EmbeddedWorkerHostMsg_ReportConsoleMessage( | |
757 embedded_worker_id_, params)); | |
758 } | 753 } |
759 | 754 |
760 void ServiceWorkerContextClient::SendDevToolsMessage( | 755 void ServiceWorkerContextClient::SendDevToolsMessage( |
761 int session_id, | 756 int session_id, |
762 int call_id, | 757 int call_id, |
763 const blink::WebString& message, | 758 const blink::WebString& message, |
764 const blink::WebString& state_cookie) { | 759 const blink::WebString& state_cookie) { |
765 // Return if this context has been stopped. | 760 // Return if this context has been stopped. |
766 if (!embedded_worker_client_) | 761 if (!embedded_worker_client_) |
767 return; | 762 return; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 | 1078 |
1084 void ServiceWorkerContextClient::Send(IPC::Message* message) { | 1079 void ServiceWorkerContextClient::Send(IPC::Message* message) { |
1085 sender_->Send(message); | 1080 sender_->Send(message); |
1086 } | 1081 } |
1087 | 1082 |
1088 void ServiceWorkerContextClient::SendWorkerStarted() { | 1083 void ServiceWorkerContextClient::SendWorkerStarted() { |
1089 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1084 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1090 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 1085 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
1091 "ServiceWorkerContextClient::StartingWorkerContext", | 1086 "ServiceWorkerContextClient::StartingWorkerContext", |
1092 this); | 1087 this); |
1093 Send(new EmbeddedWorkerHostMsg_WorkerStarted(embedded_worker_id_)); | 1088 (*instance_host_)->OnStarted(); |
1094 } | 1089 } |
1095 | 1090 |
1096 void ServiceWorkerContextClient::SetRegistrationInServiceWorkerGlobalScope( | 1091 void ServiceWorkerContextClient::SetRegistrationInServiceWorkerGlobalScope( |
1097 const ServiceWorkerRegistrationObjectInfo& info, | 1092 const ServiceWorkerRegistrationObjectInfo& info, |
1098 const ServiceWorkerVersionAttributes& attrs) { | 1093 const ServiceWorkerVersionAttributes& attrs) { |
1099 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1094 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1100 ServiceWorkerDispatcher* dispatcher = | 1095 ServiceWorkerDispatcher* dispatcher = |
1101 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 1096 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
1102 sender_.get(), main_thread_task_runner_.get()); | 1097 sender_.get(), main_thread_task_runner_.get()); |
1103 | 1098 |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 } | 1516 } |
1522 | 1517 |
1523 base::WeakPtr<ServiceWorkerContextClient> | 1518 base::WeakPtr<ServiceWorkerContextClient> |
1524 ServiceWorkerContextClient::GetWeakPtr() { | 1519 ServiceWorkerContextClient::GetWeakPtr() { |
1525 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1520 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
1526 DCHECK(context_); | 1521 DCHECK(context_); |
1527 return context_->weak_factory.GetWeakPtr(); | 1522 return context_->weak_factory.GetWeakPtr(); |
1528 } | 1523 } |
1529 | 1524 |
1530 } // namespace content | 1525 } // namespace content |
OLD | NEW |