Commit fbc0a229 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Remove FailedToLoadClassicScript()

It existed for on-the-main-thread script fetch. We can replace it
with FailedToFetchClassicScript(). It's consistent with module
script fetch callback (FailedToFetchModuleScript).

Bug: N/A
Change-Id: I6cf5ccba53ea73d48bfbecef42864b88484da341
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826059
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700084}
parent a34c18e9
...@@ -199,10 +199,10 @@ void ServiceWorkerContextClient::WorkerReadyForInspectionOnInitiatorThread( ...@@ -199,10 +199,10 @@ void ServiceWorkerContextClient::WorkerReadyForInspectionOnInitiatorThread(
std::move(receiver)); std::move(receiver));
} }
void ServiceWorkerContextClient::FailedToLoadClassicScript() { void ServiceWorkerContextClient::FailedToFetchClassicScript() {
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this, TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this,
"Status", "FailedToLoadClassicScript"); "Status", "FailedToFetchClassicScript");
// The caller is responsible for terminating the thread which // The caller is responsible for terminating the thread which
// eventually destroys |this|. // eventually destroys |this|.
} }
......
...@@ -125,7 +125,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient ...@@ -125,7 +125,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
void WorkerReadyForInspectionOnInitiatorThread( void WorkerReadyForInspectionOnInitiatorThread(
mojo::ScopedMessagePipeHandle devtools_agent_ptr_info, mojo::ScopedMessagePipeHandle devtools_agent_ptr_info,
mojo::ScopedMessagePipeHandle devtools_agent_host_request) override; mojo::ScopedMessagePipeHandle devtools_agent_host_request) override;
void FailedToLoadClassicScript() override; void FailedToFetchClassicScript() override;
void FailedToFetchModuleScript() override; void FailedToFetchModuleScript() override;
void WorkerScriptLoadedOnWorkerThread() override; void WorkerScriptLoadedOnWorkerThread() override;
void WorkerContextStarted( void WorkerContextStarted(
......
...@@ -81,13 +81,12 @@ class WebServiceWorkerContextClient { ...@@ -81,13 +81,12 @@ class WebServiceWorkerContextClient {
mojo::ScopedMessagePipeHandle devtools_agent_ptr_info, mojo::ScopedMessagePipeHandle devtools_agent_ptr_info,
mojo::ScopedMessagePipeHandle devtools_agent_host_request) {} mojo::ScopedMessagePipeHandle devtools_agent_host_request) {}
// The worker started but it could not execute because loading the classic // The worker started but it could not execute because fetching the classic
// script failed on the worker thread. This is called only for installed // script failed on the worker thread.
// scripts fetch or off-the-main-thread classic worker script fetch. virtual void FailedToFetchClassicScript() {}
virtual void FailedToLoadClassicScript() {}
// The worker started but it could not execute because fetching module script // The worker started but it could not execute because fetching module script
// failed. // failed on the worker thread.
virtual void FailedToFetchModuleScript() {} virtual void FailedToFetchModuleScript() {}
// The worker script was successfully loaded on the worker thread. // The worker script was successfully loaded on the worker thread.
......
...@@ -74,17 +74,13 @@ class CORE_EXPORT WorkerReportingProxy { ...@@ -74,17 +74,13 @@ class CORE_EXPORT WorkerReportingProxy {
// via ResourceLoader. Called before WillEvaluateClassicScript(). // via ResourceLoader. Called before WillEvaluateClassicScript().
virtual void DidLoadClassicScript() {} virtual void DidLoadClassicScript() {}
// Invoked when it's failed to load the worker's main script on the worker
// thread.
virtual void DidFailToLoadClassicScript() {}
// Invoked on success to fetch the worker's main classic/module script from // Invoked on success to fetch the worker's main classic/module script from
// network. This is not called when the script is loaded from // network. This is not called when the script is loaded from
// InstalledScriptsManager. // InstalledScriptsManager.
virtual void DidFetchScript() {} virtual void DidFetchScript() {}
// Invoked on failure to fetch the worker's classic script from network. This // Invoked on failure to fetch the worker's classic script (either from
// is not called when the script is loaded from InstalledScriptsManager. // network or InstalledScriptsManager).
virtual void DidFailToFetchClassicScript() {} virtual void DidFailToFetchClassicScript() {}
// Invoked on failure to fetch the worker's module script (either from network // Invoked on failure to fetch the worker's module script (either from network
......
...@@ -304,7 +304,7 @@ void ServiceWorkerGlobalScope::RunInstalledClassicScript( ...@@ -304,7 +304,7 @@ void ServiceWorkerGlobalScope::RunInstalledClassicScript(
std::unique_ptr<InstalledScriptsManager::ScriptData> script_data = std::unique_ptr<InstalledScriptsManager::ScriptData> script_data =
installed_scripts_manager_->GetScriptData(script_url); installed_scripts_manager_->GetScriptData(script_url);
if (!script_data) { if (!script_data) {
ReportingProxy().DidFailToLoadClassicScript(); ReportingProxy().DidFailToFetchClassicScript();
// This will eventually initiate worker thread termination. See // This will eventually initiate worker thread termination. See
// ServiceWorkerGlobalScopeProxy::DidCloseWorkerGlobalScope() for details. // ServiceWorkerGlobalScopeProxy::DidCloseWorkerGlobalScope() for details.
close(); close();
......
...@@ -165,14 +165,6 @@ void ServiceWorkerGlobalScopeProxy::DidLoadClassicScript() { ...@@ -165,14 +165,6 @@ void ServiceWorkerGlobalScopeProxy::DidLoadClassicScript() {
Client().WorkerScriptLoadedOnWorkerThread(); Client().WorkerScriptLoadedOnWorkerThread();
} }
void ServiceWorkerGlobalScopeProxy::DidFailToLoadClassicScript() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
// Tell ServiceWorkerContextClient about the failure. The generic
// WorkerContextFailedToStart() wouldn't make sense because
// WorkerContextStarted() was already called.
Client().FailedToLoadClassicScript();
}
void ServiceWorkerGlobalScopeProxy::DidFetchScript() { void ServiceWorkerGlobalScopeProxy::DidFetchScript() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
Client().WorkerScriptLoadedOnWorkerThread(); Client().WorkerScriptLoadedOnWorkerThread();
...@@ -180,7 +172,7 @@ void ServiceWorkerGlobalScopeProxy::DidFetchScript() { ...@@ -180,7 +172,7 @@ void ServiceWorkerGlobalScopeProxy::DidFetchScript() {
void ServiceWorkerGlobalScopeProxy::DidFailToFetchClassicScript() { void ServiceWorkerGlobalScopeProxy::DidFailToFetchClassicScript() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
Client().FailedToLoadClassicScript(); Client().FailedToFetchClassicScript();
} }
void ServiceWorkerGlobalScopeProxy::DidFailToFetchModuleScript() { void ServiceWorkerGlobalScopeProxy::DidFailToFetchModuleScript() {
......
...@@ -107,7 +107,6 @@ class ServiceWorkerGlobalScopeProxy final : public WebServiceWorkerContextProxy, ...@@ -107,7 +107,6 @@ class ServiceWorkerGlobalScopeProxy final : public WebServiceWorkerContextProxy,
void WillInitializeWorkerContext() override; void WillInitializeWorkerContext() override;
void DidCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override; void DidCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override;
void DidLoadClassicScript() override; void DidLoadClassicScript() override;
void DidFailToLoadClassicScript() override;
void DidFetchScript() override; void DidFetchScript() override;
void DidFailToFetchClassicScript() override; void DidFailToFetchClassicScript() override;
void DidFailToFetchModuleScript() override; void DidFailToFetchModuleScript() override;
......
...@@ -160,10 +160,7 @@ class MockServiceWorkerContextClient final ...@@ -160,10 +160,7 @@ class MockServiceWorkerContextClient final
registration_object_host_receiver.PassHandle()); registration_object_host_receiver.PassHandle());
} }
void FailedToLoadClassicScript() override { void FailedToFetchClassicScript() override {
// off-main-script fetch:
// In production code, calling FailedToLoadClassicScript results in
// terminating the worker.
classic_script_load_failure_event_.Signal(); classic_script_load_failure_event_.Signal();
} }
......
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