Commit 312a5fae authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Replace OnMainThread suffix with OnInitiatorThread

This is a follow-up CL of https://crrev.com/c/1743227. We plan to
start service worker threads on the IO thread so use main thread
orthogonal suffix. We use "the initiator thread" instead of "the
main thread."

Bug: 692909
Change-Id: I624df28773807677c830cd385c82b8b78440e26b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1745685
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686400}
parent a88626f1
......@@ -28,18 +28,18 @@ namespace content {
// static
void EmbeddedWorkerInstanceClientImpl::Create(
blink::mojom::EmbeddedWorkerInstanceClientRequest request,
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner) {
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner) {
// This won't be leaked because the lifetime will be managed internally.
// See the class documentation for detail.
// We can't use MakeStrongBinding because must give the worker thread
// a chance to stop by calling TerminateWorkerContext() and waiting
// before destructing.
new EmbeddedWorkerInstanceClientImpl(std::move(request),
std::move(starter_thread_task_runner));
std::move(initiator_thread_task_runner));
}
void EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed() {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
TRACE_EVENT0("ServiceWorker",
"EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed");
delete this;
......@@ -47,7 +47,7 @@ void EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed() {
void EmbeddedWorkerInstanceClientImpl::StartWorker(
blink::mojom::EmbeddedWorkerStartParamsPtr params) {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
DCHECK(!service_worker_context_client_);
TRACE_EVENT0("ServiceWorker",
"EmbeddedWorkerInstanceClientImpl::StartWorker");
......@@ -73,7 +73,7 @@ void EmbeddedWorkerInstanceClientImpl::StartWorker(
std::move(params->preference_watcher_request),
std::move(params->subresource_loader_factories),
std::move(params->subresource_loader_updater),
starter_thread_task_runner_);
initiator_thread_task_runner_);
// Record UMA to indicate StartWorker is received on renderer.
StartWorkerHistogramEnum metric =
params->is_installed ? StartWorkerHistogramEnum::RECEIVED_ON_INSTALLED
......@@ -105,12 +105,12 @@ void EmbeddedWorkerInstanceClientImpl::StartWorker(
std::move(installed_scripts_manager_params),
params->content_settings_proxy.PassHandle(), cache_storage.PassHandle(),
interface_provider.PassHandle());
service_worker_context_client_->StartWorkerContextOnStarterThread(
service_worker_context_client_->StartWorkerContextOnInitiatorThread(
std::move(worker), start_data);
}
void EmbeddedWorkerInstanceClientImpl::StopWorker() {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker");
// StopWorker must be called after StartWorker is called.
service_worker_context_client_->worker().TerminateWorkerContext();
......@@ -118,34 +118,34 @@ void EmbeddedWorkerInstanceClientImpl::StopWorker() {
}
void EmbeddedWorkerInstanceClientImpl::ResumeAfterDownload() {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
service_worker_context_client_->worker().ResumeAfterDownload();
}
void EmbeddedWorkerInstanceClientImpl::AddMessageToConsole(
blink::mojom::ConsoleMessageLevel level,
const std::string& message) {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
service_worker_context_client_->worker().AddMessageToConsole(
blink::WebConsoleMessage(level, blink::WebString::FromUTF8(message)));
}
EmbeddedWorkerInstanceClientImpl::EmbeddedWorkerInstanceClientImpl(
blink::mojom::EmbeddedWorkerInstanceClientRequest request,
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner)
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner)
: binding_(this, std::move(request)),
starter_thread_task_runner_(std::move(starter_thread_task_runner)) {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
initiator_thread_task_runner_(std::move(initiator_thread_task_runner)) {
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
binding_.set_connection_error_handler(base::BindOnce(
&EmbeddedWorkerInstanceClientImpl::OnError, base::Unretained(this)));
}
EmbeddedWorkerInstanceClientImpl::~EmbeddedWorkerInstanceClientImpl() {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
}
void EmbeddedWorkerInstanceClientImpl::OnError() {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
// The connection to the browser process broke.
if (service_worker_context_client_) {
// The worker is running, so tell it to stop. We continue in
......@@ -161,7 +161,7 @@ void EmbeddedWorkerInstanceClientImpl::OnError() {
blink::WebEmbeddedWorkerStartData
EmbeddedWorkerInstanceClientImpl::BuildStartData(
const blink::mojom::EmbeddedWorkerStartParams& params) {
DCHECK(starter_thread_task_runner_->BelongsToCurrentThread());
DCHECK(initiator_thread_task_runner_->BelongsToCurrentThread());
blink::WebEmbeddedWorkerStartData start_data;
start_data.script_url = params.script_url;
start_data.user_agent = blink::WebString::FromUTF8(params.user_agent);
......
......@@ -46,7 +46,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstanceClientImpl
// instead of just creating an instance of EmbeddedWorkerInstanceClient.
static void Create(
blink::mojom::EmbeddedWorkerInstanceClientRequest request,
scoped_refptr<base::SingleThreadTaskRunner> starter_task_runner);
scoped_refptr<base::SingleThreadTaskRunner> initiator_task_runner);
~EmbeddedWorkerInstanceClientImpl() override;
......@@ -62,7 +62,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstanceClientImpl
EmbeddedWorkerInstanceClientImpl(
blink::mojom::EmbeddedWorkerInstanceClientRequest request,
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner);
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner);
// blink::mojom::EmbeddedWorkerInstanceClient implementation
void StartWorker(blink::mojom::EmbeddedWorkerStartParamsPtr params) override;
......@@ -80,7 +80,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstanceClientImpl
// A copy of this runner is also passed to ServiceWorkerContextClient in
// StartWorker().
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner_;
// nullptr means worker is not running.
std::unique_ptr<ServiceWorkerContextClient> service_worker_context_client_;
......
......@@ -107,14 +107,14 @@ ServiceWorkerContextClient::ServiceWorkerContextClient(
std::unique_ptr<blink::URLLoaderFactoryBundleInfo> subresource_loaders,
mojo::PendingReceiver<blink::mojom::ServiceWorkerSubresourceLoaderUpdater>
subresource_loader_updater,
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner)
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner)
: service_worker_version_id_(service_worker_version_id),
service_worker_scope_(service_worker_scope),
script_url_(script_url),
is_starting_installed_worker_(is_starting_installed_worker),
renderer_preferences_(std::move(renderer_preferences)),
preference_watcher_request_(std::move(preference_watcher_request)),
starter_thread_task_runner_(std::move(starter_thread_task_runner)),
initiator_thread_task_runner_(std::move(initiator_thread_task_runner)),
proxy_(nullptr),
pending_service_worker_request_(std::move(service_worker_request)),
controller_receiver_(std::move(controller_receiver)),
......@@ -122,12 +122,12 @@ ServiceWorkerContextClient::ServiceWorkerContextClient(
std::move(subresource_loader_updater)),
owner_(owner),
start_timing_(std::move(start_timing)) {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(owner_);
DCHECK(subresource_loaders);
instance_host_ =
blink::mojom::ThreadSafeEmbeddedWorkerInstanceHostAssociatedPtr::Create(
std::move(instance_host), starter_thread_task_runner_);
std::move(instance_host), initiator_thread_task_runner_);
if (IsOutOfProcessNetworkService()) {
// If the network service crashes, this worker self-terminates, so it can
......@@ -142,7 +142,7 @@ ServiceWorkerContextClient::ServiceWorkerContextClient(
.InitWithNewPipeAndPassReceiver());
network_service_connection_error_handler_holder_
.set_connection_error_handler(base::BindOnce(
&ServiceWorkerContextClient::StopWorkerOnStarterThread,
&ServiceWorkerContextClient::StopWorkerOnInitiatorThread,
base::Unretained(this)));
}
......@@ -162,26 +162,26 @@ ServiceWorkerContextClient::ServiceWorkerContextClient(
}
ServiceWorkerContextClient::~ServiceWorkerContextClient() {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
}
void ServiceWorkerContextClient::StartWorkerContextOnStarterThread(
void ServiceWorkerContextClient::StartWorkerContextOnInitiatorThread(
std::unique_ptr<blink::WebEmbeddedWorker> worker,
const blink::WebEmbeddedWorkerStartData& start_data) {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
worker_ = std::move(worker);
worker_->StartWorkerContext(start_data);
}
blink::WebEmbeddedWorker& ServiceWorkerContextClient::worker() {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
return *worker_;
}
void ServiceWorkerContextClient::WorkerReadyForInspectionOnMainThread(
void ServiceWorkerContextClient::WorkerReadyForInspectionOnInitiatorThread(
mojo::ScopedMessagePipeHandle devtools_agent_remote,
mojo::ScopedMessagePipeHandle devtools_agent_host_receiver) {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
mojo::PendingRemote<blink::mojom::DevToolsAgent> agent_remote(
std::move(devtools_agent_remote), blink::mojom::DevToolsAgent::Version_);
mojo::PendingReceiver<blink::mojom::DevToolsAgentHost> receiver(
......@@ -190,15 +190,15 @@ void ServiceWorkerContextClient::WorkerReadyForInspectionOnMainThread(
->OnReadyForInspection(std::move(agent_remote), std::move(receiver));
}
void ServiceWorkerContextClient::WorkerContextFailedToStartOnMainThread() {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
void ServiceWorkerContextClient::WorkerContextFailedToStartOnInitiatorThread() {
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(!proxy_);
(*instance_host_)->OnStopped();
TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "ServiceWorkerContextClient",
this, "Status",
"WorkerContextFailedToStartOnMainThread");
TRACE_EVENT_NESTABLE_ASYNC_END1(
"ServiceWorker", "ServiceWorkerContextClient", this, "Status",
"WorkerContextFailedToStartOnInitiatorThread");
owner_->WorkerContextDestroyed();
}
......@@ -229,8 +229,8 @@ void ServiceWorkerContextClient::FailedToFetchModuleScript() {
// eventually destroys |this|.
}
void ServiceWorkerContextClient::WorkerScriptLoadedOnMainThread() {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
void ServiceWorkerContextClient::WorkerScriptLoadedOnInitiatorThread() {
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(!is_starting_installed_worker_);
(*instance_host_)->OnScriptLoaded();
TRACE_EVENT_NESTABLE_ASYNC_END0("ServiceWorker", "LOAD_SCRIPT", this);
......@@ -245,8 +245,8 @@ void ServiceWorkerContextClient::WorkerScriptLoadedOnWorkerThread() {
void ServiceWorkerContextClient::WorkerContextStarted(
blink::WebServiceWorkerContextProxy* proxy,
scoped_refptr<base::SequencedTaskRunner> worker_task_runner) {
DCHECK(!starter_thread_task_runner_->RunsTasksInCurrentSequence())
<< "service worker started on the starter thread instead of a worker "
DCHECK(!initiator_thread_task_runner_->RunsTasksInCurrentSequence())
<< "service worker started on the initiator thread instead of a worker "
"thread";
DCHECK(worker_task_runner->RunsTasksInCurrentSequence());
DCHECK(!worker_task_runner_);
......@@ -350,7 +350,7 @@ void ServiceWorkerContextClient::WorkerContextDestroyed() {
// base::Unretained is safe because |owner_| does not destroy itself until
// WorkerContextDestroyed is called.
starter_thread_task_runner_->PostTask(
initiator_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed,
base::Unretained(owner_)));
......@@ -383,8 +383,8 @@ void ServiceWorkerContextClient::ReportConsoleMessage(
}
scoped_refptr<blink::WebWorkerFetchContext>
ServiceWorkerContextClient::CreateWorkerFetchContextOnMainThread() {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
ServiceWorkerContextClient::CreateWorkerFetchContextOnInitiatorThread() {
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(preference_watcher_request_.is_pending());
// TODO(bashi): Consider changing ServiceWorkerFetchContextImpl to take
......@@ -514,8 +514,8 @@ void ServiceWorkerContextClient::RequestTermination(
(*instance_host_)->RequestTermination(std::move(callback));
}
void ServiceWorkerContextClient::StopWorkerOnStarterThread() {
DCHECK(starter_thread_task_runner_->RunsTasksInCurrentSequence());
void ServiceWorkerContextClient::StopWorkerOnInitiatorThread() {
DCHECK(initiator_thread_task_runner_->RunsTasksInCurrentSequence());
owner_->StopWorker();
}
......
......@@ -61,7 +61,7 @@ class WebWorkerFetchContext;
// starting up, and destroyed when the service worker stops. It is owned by
// WebEmbeddedWorkerImpl (which is owned by EmbeddedWorkerInstanceClientImpl).
//
// This class is created and destroyed on the "starter" thread. The starter
// This class is created and destroyed on the "initiator" thread. The initiator
// thread is the thread that constructs this class. Currently it's the main
// thread but could be the IO thread in the future. https://crbug.com/692909
//
......@@ -70,7 +70,7 @@ class WebWorkerFetchContext;
class CONTENT_EXPORT ServiceWorkerContextClient
: public blink::WebServiceWorkerContextClient {
public:
// Called on the starter thread.
// Called on the initiator thread.
// - |is_starting_installed_worker| is true if the script is already installed
// and will be streamed from the browser process.
// - |owner| must outlive this new instance.
......@@ -97,26 +97,25 @@ class CONTENT_EXPORT ServiceWorkerContextClient
std::unique_ptr<blink::URLLoaderFactoryBundleInfo> subresource_loaders,
mojo::PendingReceiver<blink::mojom::ServiceWorkerSubresourceLoaderUpdater>
subresource_loader_updater,
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner);
// Called on the starter thread.
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner);
// Called on the initiator thread.
~ServiceWorkerContextClient() override;
// Called on the starter thread.
void StartWorkerContextOnStarterThread(
// Called on the initiator thread.
void StartWorkerContextOnInitiatorThread(
std::unique_ptr<blink::WebEmbeddedWorker> worker,
const blink::WebEmbeddedWorkerStartData& start_data);
// Called on the starter thread.
// Called on the initiator thread.
blink::WebEmbeddedWorker& worker();
// WebServiceWorkerContextClient overrides.
// TODO(bashi): Rename OnMainThread() methods.
void WorkerReadyForInspectionOnMainThread(
mojo::ScopedMessagePipeHandle devtools_agent_remote,
mojo::ScopedMessagePipeHandle devtools_agent_host_receiver) override;
void WorkerContextFailedToStartOnMainThread() override;
void WorkerReadyForInspectionOnInitiatorThread(
mojo::ScopedMessagePipeHandle devtools_agent_ptr_info,
mojo::ScopedMessagePipeHandle devtools_agent_host_request) override;
void WorkerContextFailedToStartOnInitiatorThread() override;
void FailedToLoadClassicScript() override;
void FailedToFetchModuleScript() override;
void WorkerScriptLoadedOnMainThread() override;
void WorkerScriptLoadedOnInitiatorThread() override;
void WorkerScriptLoadedOnWorkerThread() override;
void WorkerContextStarted(
blink::WebServiceWorkerContextProxy* proxy,
......@@ -145,7 +144,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
preload_handle) override;
void RequestTermination(RequestTerminationCallback callback) override;
scoped_refptr<blink::WebWorkerFetchContext>
CreateWorkerFetchContextOnMainThread() override;
CreateWorkerFetchContextOnInitiatorThread() override;
/////////////////////////////////////////////////////////////////////////////
// The following are for use by NavigationPreloadRequest.
......@@ -188,8 +187,8 @@ class CONTENT_EXPORT ServiceWorkerContextClient
void SendWorkerStarted(blink::mojom::ServiceWorkerStartStatus status);
// Stops the worker context. Called on the starter thread.
void StopWorkerOnStarterThread();
// Stops the worker context. Called on the initiator thread.
void StopWorkerOnInitiatorThread();
base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr();
......@@ -204,7 +203,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
// Passed on creation of ServiceWorkerFetchContext.
blink::mojom::RendererPreferenceWatcherRequest preference_watcher_request_;
scoped_refptr<base::SingleThreadTaskRunner> starter_thread_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> initiator_thread_task_runner_;
scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
// Not owned; |this| is destroyed when |proxy_| becomes invalid.
......@@ -217,7 +216,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
mojo::PendingReceiver<blink::mojom::ServiceWorkerSubresourceLoaderUpdater>
pending_subresource_loader_updater_;
// This is bound on the starter thread.
// This is bound on the initiator thread.
scoped_refptr<blink::mojom::ThreadSafeEmbeddedWorkerInstanceHostAssociatedPtr>
instance_host_;
......@@ -229,7 +228,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
blink::mojom::ServiceWorkerProviderInfoForStartWorkerPtr
service_worker_provider_info_;
// Must be accessed on the starter thread only.
// Must be accessed on the initiator thread only.
EmbeddedWorkerInstanceClientImpl* owner_;
blink::mojom::BlobRegistryPtr blob_registry_;
......
......@@ -64,8 +64,8 @@ struct WebFetchEventPreloadHandle {
// WebServiceWorkerContextClient is a "client" of a service worker execution
// context. This interface is implemented by the embedder and allows the
// embedder to communicate with the service worker execution context. It is
// created on the main thread and then passed on to the worker thread by a newly
// created ServiceWorkerGlobalScope.
// created on the initiator thread (the main thread or the IO thread) and then
// passed on to the worker thread by a newly created ServiceWorkerGlobalScope.
//
// Unless otherwise noted, all methods of this class are called on the worker
// thread.
......@@ -76,15 +76,15 @@ class WebServiceWorkerContextClient {
virtual ~WebServiceWorkerContextClient() = default;
// ServiceWorker has prepared everything for script loading and is now ready
// for DevTools inspection. Called on the main thread.
virtual void WorkerReadyForInspectionOnMainThread(
// for DevTools inspection. Called on the initiator thread.
virtual void WorkerReadyForInspectionOnInitiatorThread(
mojo::ScopedMessagePipeHandle devtools_agent_ptr_info,
mojo::ScopedMessagePipeHandle devtools_agent_host_request) {}
// Starting the worker failed. This could happen when loading the worker
// script failed, or the worker was asked to terminate before startup
// completed. Called on the main thread.
virtual void WorkerContextFailedToStartOnMainThread() {}
// completed. Called on the initiator thread.
virtual void WorkerContextFailedToStartOnInitiatorThread() {}
// The worker started but it could not execute because loading the classic
// script failed on the worker thread. This is called only for installed
......@@ -96,11 +96,11 @@ class WebServiceWorkerContextClient {
virtual void FailedToFetchModuleScript() {}
// The worker script was successfully loaded by ResourceLoader. Called on the
// main thread.
// initiator thread.
//
// This is called before WorkerContextStarted(). Script evaluation does not
// start until WillEvaluateScript().
virtual void WorkerScriptLoadedOnMainThread() {}
virtual void WorkerScriptLoadedOnInitiatorThread() {}
// The worker script was successfully loaded on the worker thread.
// When off-the-main-thread script fetch is on, this is called for both
......@@ -125,7 +125,7 @@ class WebServiceWorkerContextClient {
// WorkerScriptLoadedOnWorkerThread().
//
// For installed workers, this is called before
// WorkerScriptLoadedOnMainThread().
// WorkerScriptLoadedOnInitiatorThread().
//
// Script evaluation does not start until WillEvaluateScript().
virtual void WorkerContextStarted(
......@@ -199,9 +199,9 @@ class WebServiceWorkerContextClient {
// Off-main-thread start up:
// Creates a WebWorkerFetchContext for subresource fetches on a service
// worker. This is called on the main thread.
// worker. This is called on the initiator thread.
virtual scoped_refptr<blink::WebWorkerFetchContext>
CreateWorkerFetchContextOnMainThread() = 0;
CreateWorkerFetchContextOnInitiatorThread() = 0;
};
} // namespace blink
......
......@@ -190,7 +190,7 @@ void WebEmbeddedWorkerImpl::TerminateWorkerContext() {
asked_to_terminate_ = true;
if (!shadow_page_->WasInitialized()) {
// This deletes 'this'.
worker_context_client_->WorkerContextFailedToStartOnMainThread();
worker_context_client_->WorkerContextFailedToStartOnInitiatorThread();
return;
}
if (!worker_thread_) {
......@@ -200,7 +200,7 @@ void WebEmbeddedWorkerImpl::TerminateWorkerContext() {
WebEmbeddedWorkerStartData::kWaitForDebugger ||
pause_after_download_state_ == kIsPausedAfterDownload);
// This deletes 'this'.
worker_context_client_->WorkerContextFailedToStartOnMainThread();
worker_context_client_->WorkerContextFailedToStartOnInitiatorThread();
return;
}
worker_thread_->Terminate();
......@@ -252,7 +252,7 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() {
CalculateHttpsState(starter_origin.get());
scoped_refptr<WebWorkerFetchContext> web_worker_fetch_context =
worker_context_client_->CreateWorkerFetchContextOnMainThread();
worker_context_client_->CreateWorkerFetchContextOnInitiatorThread();
// Create WorkerSettings. Currently we block all mixed-content requests from
// a ServiceWorker.
......@@ -368,7 +368,7 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() {
}
}
// We are now ready to inspect worker thread.
worker_context_client_->WorkerReadyForInspectionOnMainThread(
worker_context_client_->WorkerReadyForInspectionOnInitiatorThread(
devtools_agent_remote.PassPipe(),
devtools_agent_host_receiver.PassPipe());
}
......
......@@ -152,11 +152,11 @@ class MockServiceWorkerContextClient final
MockServiceWorkerContextClient() = default;
~MockServiceWorkerContextClient() override = default;
MOCK_METHOD2(WorkerReadyForInspectionOnMainThread,
MOCK_METHOD2(WorkerReadyForInspectionOnInitiatorThread,
void(mojo::ScopedMessagePipeHandle,
mojo::ScopedMessagePipeHandle));
MOCK_METHOD0(WorkerContextFailedToStartOnMainThread, void());
MOCK_METHOD0(WorkerScriptLoadedOnMainThread, void());
MOCK_METHOD0(WorkerContextFailedToStartOnInitiatorThread, void());
MOCK_METHOD0(WorkerScriptLoadedOnInitiatorThread, void());
void WorkerContextStarted(WebServiceWorkerContextProxy* proxy,
scoped_refptr<base::SequencedTaskRunner>) override {
......@@ -202,8 +202,8 @@ class MockServiceWorkerContextClient final
script_evaluated_event_.Signal();
}
scoped_refptr<WebWorkerFetchContext> CreateWorkerFetchContextOnMainThread()
override {
scoped_refptr<WebWorkerFetchContext>
CreateWorkerFetchContextOnInitiatorThread() override {
return base::MakeRefCounted<FakeWebWorkerFetchContext>();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment