Commit 99efbf62 authored by Leon Han's avatar Leon Han Committed by Commit Bot

[ServiceWorker] Remove ServiceWorkerGlobalScopeClient

This CL lets ServiceWorkerGlobalScope rely on
ServiceWorkerGlobalScopeProxy rather than ServiceWorkerGlobalScopeClient
to call WebServiceWorkerContextClient functions, then we remove
ServiceWorkerGlobalScopeClient completely.

BUG=931142,920854

Change-Id: I9f952b95af1e7d00c1cc9dead1d7c45322a20964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643047
Commit-Queue: Leon Han <leon.han@intel.com>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666595}
parent c4b459e8
...@@ -128,6 +128,11 @@ class CORE_EXPORT WorkerReportingProxy { ...@@ -128,6 +128,11 @@ class CORE_EXPORT WorkerReportingProxy {
// Invoked when the thread is stopped and WorkerGlobalScope is being // Invoked when the thread is stopped and WorkerGlobalScope is being
// destructed. This is the last method that is called on this interface. // destructed. This is the last method that is called on this interface.
virtual void DidTerminateWorkerThread() {} virtual void DidTerminateWorkerThread() {}
// This is a quick fix for service worker onion-soup. Don't add a similar
// function like IsDedicatedWorkerGlobalScopeProxy().
// TODO(leonhsl): Remove this after this becomes unnecessary.
virtual bool IsServiceWorkerGlobalScopeProxy() const { return false; }
}; };
} // namespace blink } // namespace blink
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include "third_party/blink/renderer/core/workers/worker_content_settings_client.h" #include "third_party/blink/renderer/core/workers/worker_content_settings_client.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/modules/indexeddb/indexed_db_client.h" #include "third_party/blink/renderer/modules/indexeddb/indexed_db_client.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_thread.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_thread.h"
...@@ -381,9 +380,6 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() { ...@@ -381,9 +380,6 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() {
ProvideContentSettingsClientToWorker(worker_clients, ProvideContentSettingsClientToWorker(worker_clients,
std::move(content_settings_client_)); std::move(content_settings_client_));
ProvideServiceWorkerGlobalScopeClientToWorker(
worker_clients, MakeGarbageCollected<ServiceWorkerGlobalScopeClient>(
*worker_context_client_));
// |web_worker_fetch_context| is null in some unit tests. // |web_worker_fetch_context| is null in some unit tests.
scoped_refptr<WebWorkerFetchContext> web_worker_fetch_context = scoped_refptr<WebWorkerFetchContext> web_worker_fetch_context =
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/core/workers/worker_location.h" #include "third_party/blink/renderer/core/workers/worker_location.h"
#include "third_party/blink/renderer/modules/service_worker/respond_with_observer.h" #include "third_party/blink/renderer/modules/service_worker/respond_with_observer.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "third_party/blink/renderer/core/workers/worker_location.h" #include "third_party/blink/renderer/core/workers/worker_location.h"
#include "third_party/blink/renderer/modules/payments/payments_validators.h" #include "third_party/blink/renderer/modules/payments/payments_validators.h"
#include "third_party/blink/renderer/modules/service_worker/respond_with_observer.h" #include "third_party/blink/renderer/modules/service_worker/respond_with_observer.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
......
...@@ -38,8 +38,6 @@ blink_modules_sources("service_worker") { ...@@ -38,8 +38,6 @@ blink_modules_sources("service_worker") {
"service_worker_error.h", "service_worker_error.h",
"service_worker_global_scope.cc", "service_worker_global_scope.cc",
"service_worker_global_scope.h", "service_worker_global_scope.h",
"service_worker_global_scope_client.cc",
"service_worker_global_scope_client.h",
"service_worker_global_scope_proxy.cc", "service_worker_global_scope_proxy.cc",
"service_worker_global_scope_proxy.h", "service_worker_global_scope_proxy.h",
"service_worker_installed_scripts_manager.cc", "service_worker_installed_scripts_manager.cc",
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "third_party/blink/public/platform/web_security_origin.h" #include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h"
namespace blink { namespace blink {
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
#include "third_party/blink/renderer/modules/service_worker/service_worker.h" #include "third_party/blink/renderer/modules/service_worker/service_worker.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_client.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_client.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_clients.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_clients.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_module_tree_client.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_module_tree_client.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h" #include "third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h"
...@@ -1256,10 +1256,10 @@ void ServiceWorkerGlobalScope::OnIdleTimeout() { ...@@ -1256,10 +1256,10 @@ void ServiceWorkerGlobalScope::OnIdleTimeout() {
// RequestedTermination() returns true if ServiceWorkerTimeoutTimer agrees // RequestedTermination() returns true if ServiceWorkerTimeoutTimer agrees
// we should request the host to terminate this worker now. // we should request the host to terminate this worker now.
DCHECK(RequestedTermination()); DCHECK(RequestedTermination());
// We use CrossThreadBindOnce() here because the callback may be // We use CrossThreadBindOnce() here because the callback may be destroyed on
// destroyed on the main thread if the worker thread has already terminated. // the main thread if the worker thread has already terminated.
ServiceWorkerGlobalScopeClient::From(GetExecutionContext()) To<ServiceWorkerGlobalScopeProxy>(ReportingProxy())
->RequestTermination(ConvertToBaseOnceCallback( .RequestTermination(ConvertToBaseOnceCallback(
CrossThreadBindOnce(&ServiceWorkerGlobalScope::OnRequestedTermination, CrossThreadBindOnce(&ServiceWorkerGlobalScope::OnRequestedTermination,
WrapCrossThreadWeakPersistent(this)))); WrapCrossThreadWeakPersistent(this))));
} }
...@@ -1339,9 +1339,9 @@ void ServiceWorkerGlobalScope::DispatchFetchEventInternal( ...@@ -1339,9 +1339,9 @@ void ServiceWorkerGlobalScope::DispatchFetchEventInternal(
// Set up for navigation preload (FetchEvent#preloadResponse) if needed. // Set up for navigation preload (FetchEvent#preloadResponse) if needed.
const bool navigation_preload_sent = !!params->preload_handle; const bool navigation_preload_sent = !!params->preload_handle;
if (navigation_preload_sent) { if (navigation_preload_sent) {
ServiceWorkerGlobalScopeClient::From(GetExecutionContext()) To<ServiceWorkerGlobalScopeProxy>(ReportingProxy())
->SetupNavigationPreload(event_id, params->request->url, .SetupNavigationPreload(event_id, params->request->url,
std::move(params->preload_handle)); std::move(params->preload_handle));
} }
mojom::blink::FetchAPIRequest& fetch_request = *params->request; mojom::blink::FetchAPIRequest& fetch_request = *params->request;
......
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h"
#include <memory>
#include <utility>
#include "third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
namespace blink {
namespace {
} // namespace
ServiceWorkerGlobalScopeClient::ServiceWorkerGlobalScopeClient(
WebServiceWorkerContextClient& client)
: client_(client) {}
void ServiceWorkerGlobalScopeClient::SetupNavigationPreload(
int fetch_event_id,
const KURL& url,
mojom::blink::FetchEventPreloadHandlePtr preload_handle) {
auto web_preload_handle = std::make_unique<WebFetchEventPreloadHandle>();
web_preload_handle->url_loader = preload_handle->url_loader.PassHandle();
web_preload_handle->url_loader_client_request =
preload_handle->url_loader_client_request.PassMessagePipe();
client_.SetupNavigationPreload(fetch_event_id, url,
std::move(web_preload_handle));
}
void ServiceWorkerGlobalScopeClient::RequestTermination(
base::OnceCallback<void(bool)> callback) {
client_.RequestTermination(std::move(callback));
}
const char ServiceWorkerGlobalScopeClient::kSupplementName[] =
"ServiceWorkerGlobalScopeClient";
ServiceWorkerGlobalScopeClient* ServiceWorkerGlobalScopeClient::From(
ExecutionContext* context) {
// TODO(crbug.com/920854): Replace CHECK() with DCHECK() after crashes are
// gone.
CHECK(context);
WorkerClients* worker_clients = To<WorkerGlobalScope>(context)->Clients();
CHECK(worker_clients);
ServiceWorkerGlobalScopeClient* client =
Supplement<WorkerClients>::From<ServiceWorkerGlobalScopeClient>(
worker_clients);
CHECK(client);
return client;
}
void ServiceWorkerGlobalScopeClient::Trace(blink::Visitor* visitor) {
Supplement<WorkerClients>::Trace(visitor);
}
void ProvideServiceWorkerGlobalScopeClientToWorker(
WorkerClients* clients,
ServiceWorkerGlobalScopeClient* client) {
clients->ProvideSupplement(client);
}
} // namespace blink
/*
* Copyright (C) 2014 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_SERVICE_WORKER_SERVICE_WORKER_GLOBAL_SCOPE_CLIENT_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_SERVICE_WORKER_SERVICE_WORKER_GLOBAL_SCOPE_CLIENT_H_
#include <memory>
#include "base/macros.h"
#include "third_party/blink/public/mojom/service_worker/dispatch_fetch_event_params.mojom-blink.h"
#include "third_party/blink/renderer/core/workers/worker_clients.h"
#include "third_party/blink/renderer/modules/modules_export.h"
namespace blink {
class ExecutionContext;
class KURL;
class WebServiceWorkerContextClient;
class MODULES_EXPORT ServiceWorkerGlobalScopeClient final
: public GarbageCollectedFinalized<ServiceWorkerGlobalScopeClient>,
public Supplement<WorkerClients> {
USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerGlobalScopeClient);
public:
static const char kSupplementName[];
explicit ServiceWorkerGlobalScopeClient(WebServiceWorkerContextClient&);
// Called from ServiceWorkerGlobalScope.
void SetupNavigationPreload(
int fetch_event_id,
const KURL& url,
mojom::blink::FetchEventPreloadHandlePtr preload_handle);
void RequestTermination(base::OnceCallback<void(bool)> callback);
static ServiceWorkerGlobalScopeClient* From(ExecutionContext*);
void Trace(blink::Visitor*) override;
private:
WebServiceWorkerContextClient& client_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerGlobalScopeClient);
};
MODULES_EXPORT void ProvideServiceWorkerGlobalScopeClientToWorker(
WorkerClients*,
ServiceWorkerGlobalScopeClient*);
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_SERVICE_WORKER_SERVICE_WORKER_GLOBAL_SCOPE_CLIENT_H_
...@@ -288,6 +288,29 @@ void ServiceWorkerGlobalScopeProxy::DidTerminateWorkerThread() { ...@@ -288,6 +288,29 @@ void ServiceWorkerGlobalScopeProxy::DidTerminateWorkerThread() {
Client().WorkerContextDestroyed(); Client().WorkerContextDestroyed();
} }
bool ServiceWorkerGlobalScopeProxy::IsServiceWorkerGlobalScopeProxy() const {
return true;
}
void ServiceWorkerGlobalScopeProxy::SetupNavigationPreload(
int fetch_event_id,
const KURL& url,
mojom::blink::FetchEventPreloadHandlePtr preload_handle) {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
auto web_preload_handle = std::make_unique<WebFetchEventPreloadHandle>();
web_preload_handle->url_loader = preload_handle->url_loader.PassHandle();
web_preload_handle->url_loader_client_request =
preload_handle->url_loader_client_request.PassMessagePipe();
Client().SetupNavigationPreload(fetch_event_id, url,
std::move(web_preload_handle));
}
void ServiceWorkerGlobalScopeProxy::RequestTermination(
base::OnceCallback<void(bool)> callback) {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
Client().RequestTermination(std::move(callback));
}
ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy( ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(
WebEmbeddedWorkerImpl& embedded_worker, WebEmbeddedWorkerImpl& embedded_worker,
WebServiceWorkerContextClient& client) WebServiceWorkerContextClient& client)
......
...@@ -35,12 +35,14 @@ ...@@ -35,12 +35,14 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "third_party/blink/public/mojom/service_worker/dispatch_fetch_event_params.mojom-blink.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h" #include "third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h"
#include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h" #include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/blink/renderer/platform/wtf/time.h"
...@@ -120,6 +122,14 @@ class ServiceWorkerGlobalScopeProxy final ...@@ -120,6 +122,14 @@ class ServiceWorkerGlobalScopeProxy final
void DidCloseWorkerGlobalScope() override; void DidCloseWorkerGlobalScope() override;
void WillDestroyWorkerGlobalScope() override; void WillDestroyWorkerGlobalScope() override;
void DidTerminateWorkerThread() override; void DidTerminateWorkerThread() override;
bool IsServiceWorkerGlobalScopeProxy() const override;
// Called from ServiceWorkerGlobalScope.
void SetupNavigationPreload(
int fetch_event_id,
const KURL& url,
mojom::blink::FetchEventPreloadHandlePtr preload_handle);
void RequestTermination(base::OnceCallback<void(bool)> callback);
void Trace(blink::Visitor*); void Trace(blink::Visitor*);
...@@ -152,6 +162,16 @@ class ServiceWorkerGlobalScopeProxy final ...@@ -152,6 +162,16 @@ class ServiceWorkerGlobalScopeProxy final
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerGlobalScopeProxy); DISALLOW_COPY_AND_ASSIGN(ServiceWorkerGlobalScopeProxy);
}; };
// TODO(leonhsl): This is only used by ServiceWorkerGlobalScope for calling
// WebServiceWorkerContextClient::{SetupNavigationPreload,RequestTermination}(),
// which will be Onion Soupped eventually, at that time we'd remove this.
template <>
struct DowncastTraits<ServiceWorkerGlobalScopeProxy> {
static bool AllowFrom(const WorkerReportingProxy& proxy) {
return proxy.IsServiceWorkerGlobalScopeProxy();
}
};
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_SERVICE_WORKER_SERVICE_WORKER_GLOBAL_SCOPE_PROXY_H_ #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_SERVICE_WORKER_SERVICE_WORKER_GLOBAL_SCOPE_PROXY_H_
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h"
#include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h"
#include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/timer.h"
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
...@@ -57,11 +56,11 @@ class MODULES_EXPORT WaitUntilObserver final ...@@ -57,11 +56,11 @@ class MODULES_EXPORT WaitUntilObserver final
void WillDispatchEvent(); void WillDispatchEvent();
// Must be called after dispatching the event. If |event_dispatch_failed| is // Must be called after dispatching the event. If |event_dispatch_failed| is
// true, then DidDispatchEvent() immediately reports to // true, then DidDispatchEvent() immediately reports to
// ServiceWorkerGlobalScopeClient that the event finished, without waiting for // ServiceWorkerGlobalScope that the event finished, without waiting for
// all waitUntil promises to settle. // all waitUntil promises to settle.
void DidDispatchEvent(bool event_dispatch_failed); void DidDispatchEvent(bool event_dispatch_failed);
// Observes the promise and delays reporting to ServiceWorkerGlobalScopeClient // Observes the promise and delays reporting to ServiceWorkerGlobalScope
// that the event completed until the promise is resolved or rejected. // that the event completed until the promise is resolved or rejected.
// //
// WaitUntil may be called multiple times. The event is extended until all // WaitUntil may be called multiple times. The event is extended until all
...@@ -103,7 +102,7 @@ class MODULES_EXPORT WaitUntilObserver final ...@@ -103,7 +102,7 @@ class MODULES_EXPORT WaitUntilObserver final
// Event dispatch has started but not yet finished. // Event dispatch has started but not yet finished.
kDispatching, kDispatching,
// Event dispatch completed. There may still be outstanding waitUntil // Event dispatch completed. There may still be outstanding waitUntil
// promises that must settle before notifying ServiceWorkerGlobalScopeClient // promises that must settle before notifying ServiceWorkerGlobalScope
// that the event finished. // that the event finished.
kDispatched, kDispatched,
// Event dispatch failed. Any outstanding waitUntil promises are ignored. // Event dispatch failed. Any outstanding waitUntil promises are ignored.
......
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