| 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(falken): The signals to the browser should be in the order: |
| 711 if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) { | 707 // (1) WorkerStopped (via OnStopped()) |
| 712 DCHECK(embedded_worker_client_); | 708 // (2) ProviderDestroyed (via following |
| 713 main_thread_task_runner_->PostTask( | 709 // EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted) But this ordering is |
| 714 FROM_HERE, | 710 // currently not guaranteed since the Mojo pipes are different. |
| 715 base::Bind(&EmbeddedWorkerInstanceClientImpl::StopWorkerCompleted, | 711 // https://crbug.com/676526 |
| 716 base::Passed(&embedded_worker_client_))); | 712 (*instance_host_)->OnStopped(); |
| 717 return; | |
| 718 } | |
| 719 | 713 |
| 720 // Now we should be able to free the WebEmbeddedWorker container on the | 714 DCHECK(embedded_worker_client_); |
| 721 // main thread. | |
| 722 main_thread_task_runner_->PostTask( | 715 main_thread_task_runner_->PostTask( |
| 723 FROM_HERE, | 716 FROM_HERE, |
| 724 base::Bind(&CallWorkerContextDestroyedOnMainThread, | 717 base::Bind(&EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed, |
| 725 embedded_worker_id_)); | 718 base::Passed(&embedded_worker_client_))); |
| 719 return; |
| 726 } | 720 } |
| 727 | 721 |
| 728 void ServiceWorkerContextClient::CountFeature(uint32_t feature) { | 722 void ServiceWorkerContextClient::CountFeature(uint32_t feature) { |
| 729 Send(new EmbeddedWorkerHostMsg_CountFeature(service_worker_version_id_, | 723 Send(new EmbeddedWorkerHostMsg_CountFeature(service_worker_version_id_, |
| 730 feature)); | 724 feature)); |
| 731 } | 725 } |
| 732 | 726 |
| 733 void ServiceWorkerContextClient::ReportException( | 727 void ServiceWorkerContextClient::ReportException( |
| 734 const blink::WebString& error_message, | 728 const blink::WebString& error_message, |
| 735 int line_number, | 729 int line_number, |
| 736 int column_number, | 730 int column_number, |
| 737 const blink::WebString& source_url) { | 731 const blink::WebString& source_url) { |
| 738 Send(new EmbeddedWorkerHostMsg_ReportException( | 732 (*instance_host_) |
| 739 embedded_worker_id_, error_message.Utf16(), line_number, column_number, | 733 ->OnReportException(error_message.Utf16(), line_number, column_number, |
| 740 blink::WebStringToGURL(source_url))); | 734 blink::WebStringToGURL(source_url)); |
| 741 } | 735 } |
| 742 | 736 |
| 743 void ServiceWorkerContextClient::ReportConsoleMessage( | 737 void ServiceWorkerContextClient::ReportConsoleMessage( |
| 744 int source, | 738 int source, |
| 745 int level, | 739 int level, |
| 746 const blink::WebString& message, | 740 const blink::WebString& message, |
| 747 int line_number, | 741 int line_number, |
| 748 const blink::WebString& source_url) { | 742 const blink::WebString& source_url) { |
| 749 EmbeddedWorkerHostMsg_ReportConsoleMessage_Params params; | 743 (*instance_host_) |
| 750 params.source_identifier = source; | 744 ->OnReportConsoleMessage(source, level, message.Utf16(), line_number, |
| 751 params.message_level = level; | 745 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 } | 746 } |
| 759 | 747 |
| 760 void ServiceWorkerContextClient::SendDevToolsMessage( | 748 void ServiceWorkerContextClient::SendDevToolsMessage( |
| 761 int session_id, | 749 int session_id, |
| 762 int call_id, | 750 int call_id, |
| 763 const blink::WebString& message, | 751 const blink::WebString& message, |
| 764 const blink::WebString& state_cookie) { | 752 const blink::WebString& state_cookie) { |
| 765 // Return if this context has been stopped. | 753 // Return if this context has been stopped. |
| 766 if (!embedded_worker_client_) | 754 if (!embedded_worker_client_) |
| 767 return; | 755 return; |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 | 1071 |
| 1084 void ServiceWorkerContextClient::Send(IPC::Message* message) { | 1072 void ServiceWorkerContextClient::Send(IPC::Message* message) { |
| 1085 sender_->Send(message); | 1073 sender_->Send(message); |
| 1086 } | 1074 } |
| 1087 | 1075 |
| 1088 void ServiceWorkerContextClient::SendWorkerStarted() { | 1076 void ServiceWorkerContextClient::SendWorkerStarted() { |
| 1089 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1077 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1090 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 1078 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
| 1091 "ServiceWorkerContextClient::StartingWorkerContext", | 1079 "ServiceWorkerContextClient::StartingWorkerContext", |
| 1092 this); | 1080 this); |
| 1093 Send(new EmbeddedWorkerHostMsg_WorkerStarted(embedded_worker_id_)); | 1081 (*instance_host_)->OnStarted(); |
| 1094 } | 1082 } |
| 1095 | 1083 |
| 1096 void ServiceWorkerContextClient::SetRegistrationInServiceWorkerGlobalScope( | 1084 void ServiceWorkerContextClient::SetRegistrationInServiceWorkerGlobalScope( |
| 1097 const ServiceWorkerRegistrationObjectInfo& info, | 1085 const ServiceWorkerRegistrationObjectInfo& info, |
| 1098 const ServiceWorkerVersionAttributes& attrs) { | 1086 const ServiceWorkerVersionAttributes& attrs) { |
| 1099 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1087 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1100 ServiceWorkerDispatcher* dispatcher = | 1088 ServiceWorkerDispatcher* dispatcher = |
| 1101 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( | 1089 ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( |
| 1102 sender_.get(), main_thread_task_runner_.get()); | 1090 sender_.get(), main_thread_task_runner_.get()); |
| 1103 | 1091 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 } | 1509 } |
| 1522 | 1510 |
| 1523 base::WeakPtr<ServiceWorkerContextClient> | 1511 base::WeakPtr<ServiceWorkerContextClient> |
| 1524 ServiceWorkerContextClient::GetWeakPtr() { | 1512 ServiceWorkerContextClient::GetWeakPtr() { |
| 1525 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1513 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1526 DCHECK(context_); | 1514 DCHECK(context_); |
| 1527 return context_->weak_factory.GetWeakPtr(); | 1515 return context_->weak_factory.GetWeakPtr(); |
| 1528 } | 1516 } |
| 1529 | 1517 |
| 1530 } // namespace content | 1518 } // namespace content |
| OLD | NEW |