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(
std::move(receiver));
}
void ServiceWorkerContextClient::FailedToLoadClassicScript() {
void ServiceWorkerContextClient::FailedToFetchClassicScript() {
DCHECK(worker_task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT_NESTABLE_ASYNC_END1("ServiceWorker", "LOAD_SCRIPT", this,
"Status", "FailedToLoadClassicScript");
"Status", "FailedToFetchClassicScript");
// The caller is responsible for terminating the thread which
// eventually destroys |this|.
}
......
......@@ -125,7 +125,7 @@ class CONTENT_EXPORT ServiceWorkerContextClient
void WorkerReadyForInspectionOnInitiatorThread(
mojo::ScopedMessagePipeHandle devtools_agent_ptr_info,
mojo::ScopedMessagePipeHandle devtools_agent_host_request) override;
void FailedToLoadClassicScript() override;
void FailedToFetchClassicScript() override;
void FailedToFetchModuleScript() override;
void WorkerScriptLoadedOnWorkerThread() override;
void WorkerContextStarted(
......
......@@ -81,13 +81,12 @@ class WebServiceWorkerContextClient {
mojo::ScopedMessagePipeHandle devtools_agent_ptr_info,
mojo::ScopedMessagePipeHandle devtools_agent_host_request) {}
// The worker started but it could not execute because loading the classic
// script failed on the worker thread. This is called only for installed
// scripts fetch or off-the-main-thread classic worker script fetch.
virtual void FailedToLoadClassicScript() {}
// The worker started but it could not execute because fetching the classic
// script failed on the worker thread.
virtual void FailedToFetchClassicScript() {}
// The worker started but it could not execute because fetching module script
// failed.
// failed on the worker thread.
virtual void FailedToFetchModuleScript() {}
// The worker script was successfully loaded on the worker thread.
......
......@@ -74,17 +74,13 @@ class CORE_EXPORT WorkerReportingProxy {
// via ResourceLoader. Called before WillEvaluateClassicScript().
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
// network. This is not called when the script is loaded from
// InstalledScriptsManager.
virtual void DidFetchScript() {}
// Invoked on failure to fetch the worker's classic script from network. This
// is not called when the script is loaded from InstalledScriptsManager.
// Invoked on failure to fetch the worker's classic script (either from
// network or InstalledScriptsManager).
virtual void DidFailToFetchClassicScript() {}
// Invoked on failure to fetch the worker's module script (either from network
......
......@@ -304,7 +304,7 @@ void ServiceWorkerGlobalScope::RunInstalledClassicScript(
std::unique_ptr<InstalledScriptsManager::ScriptData> script_data =
installed_scripts_manager_->GetScriptData(script_url);
if (!script_data) {
ReportingProxy().DidFailToLoadClassicScript();
ReportingProxy().DidFailToFetchClassicScript();
// This will eventually initiate worker thread termination. See
// ServiceWorkerGlobalScopeProxy::DidCloseWorkerGlobalScope() for details.
close();
......
......@@ -165,14 +165,6 @@ void ServiceWorkerGlobalScopeProxy::DidLoadClassicScript() {
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() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
Client().WorkerScriptLoadedOnWorkerThread();
......@@ -180,7 +172,7 @@ void ServiceWorkerGlobalScopeProxy::DidFetchScript() {
void ServiceWorkerGlobalScopeProxy::DidFailToFetchClassicScript() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
Client().FailedToLoadClassicScript();
Client().FailedToFetchClassicScript();
}
void ServiceWorkerGlobalScopeProxy::DidFailToFetchModuleScript() {
......
......@@ -107,7 +107,6 @@ class ServiceWorkerGlobalScopeProxy final : public WebServiceWorkerContextProxy,
void WillInitializeWorkerContext() override;
void DidCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override;
void DidLoadClassicScript() override;
void DidFailToLoadClassicScript() override;
void DidFetchScript() override;
void DidFailToFetchClassicScript() override;
void DidFailToFetchModuleScript() override;
......
......@@ -160,10 +160,7 @@ class MockServiceWorkerContextClient final
registration_object_host_receiver.PassHandle());
}
void FailedToLoadClassicScript() override {
// off-main-script fetch:
// In production code, calling FailedToLoadClassicScript results in
// terminating the worker.
void FailedToFetchClassicScript() override {
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