Commit a3bb605f authored by Makoto Shimazu's avatar Makoto Shimazu Committed by Chromium LUCI CQ

Remove RunOrPostTaskOnCoreThread for EWI::CreateFactoryBundles

This is a clean up task after ServiceWorkerOnUI.
EmbeddedWorkerInstance::CreateFactoryBundles() now returns the parameters
without callbacks.

Bug: 1138155
Change-Id: Ifc896fb6c1c3e8d897f7d9ca1abed6fa5ddd9c41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576962
Commit-Queue: Makoto Shimazu <shimazu@chromium.org>
Reviewed-by: default avatarAsami Doi <asamidoi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835092}
parent 6437726c
...@@ -244,10 +244,15 @@ class CONTENT_EXPORT EmbeddedWorkerInstance ...@@ -244,10 +244,15 @@ class CONTENT_EXPORT EmbeddedWorkerInstance
// Creates a set of factory bundles for scripts and subresources. This must be // Creates a set of factory bundles for scripts and subresources. This must be
// called after the COEP value for the worker script is known. // called after the COEP value for the worker script is known.
using CreateFactoryBundlesCallback = base::OnceCallback<void( struct CreateFactoryBundlesResult {
std::unique_ptr<blink::PendingURLLoaderFactoryBundle> script_bundle, CreateFactoryBundlesResult();
std::unique_ptr<blink::PendingURLLoaderFactoryBundle> subresouce_bundle)>; ~CreateFactoryBundlesResult();
void CreateFactoryBundles(CreateFactoryBundlesCallback callback); CreateFactoryBundlesResult(CreateFactoryBundlesResult&& other);
std::unique_ptr<blink::PendingURLLoaderFactoryBundle> script_bundle;
std::unique_ptr<blink::PendingURLLoaderFactoryBundle> subresource_bundle;
};
CreateFactoryBundlesResult CreateFactoryBundles();
// Returns the unique token that has been generated to identify this worker // Returns the unique token that has been generated to identify this worker
// instance, and its corresponding GlobalScope in the renderer process. If the // instance, and its corresponding GlobalScope in the renderer process. If the
...@@ -330,15 +335,6 @@ class CONTENT_EXPORT EmbeddedWorkerInstance ...@@ -330,15 +335,6 @@ class CONTENT_EXPORT EmbeddedWorkerInstance
void BindCacheStorageInternal(); void BindCacheStorageInternal();
void OnCreatedFactoryBundles(
CreateFactoryBundlesCallback callback,
std::unique_ptr<blink::PendingURLLoaderFactoryBundle> script_bundle,
std::unique_ptr<blink::PendingURLLoaderFactoryBundle> subresouce_bundle,
mojo::PendingRemote<network::mojom::CrossOriginEmbedderPolicyReporter>
coep_reporter,
mojo::PendingReceiver<blink::mojom::ReportingObserver>
reporting_observer_receiver);
base::WeakPtr<ServiceWorkerContextCore> context_; base::WeakPtr<ServiceWorkerContextCore> context_;
ServiceWorkerVersion* owner_version_; ServiceWorkerVersion* owner_version_;
......
...@@ -1009,9 +1009,10 @@ void ServiceWorkerVersion::OnMainScriptLoaded() { ...@@ -1009,9 +1009,10 @@ void ServiceWorkerVersion::OnMainScriptLoaded() {
// TODO(https://crbug.com/1039613): Update the loader factories passed to the // TODO(https://crbug.com/1039613): Update the loader factories passed to the
// script loader factory too. // script loader factory too.
DCHECK_EQ(NEW, status()); DCHECK_EQ(NEW, status());
embedded_worker_->CreateFactoryBundles( EmbeddedWorkerInstance::CreateFactoryBundlesResult result =
base::BindOnce(&ServiceWorkerVersion::InitializeGlobalScope, embedded_worker_->CreateFactoryBundles();
weak_factory_.GetWeakPtr())); InitializeGlobalScope(std::move(result.script_bundle),
std::move(result.subresource_bundle));
} }
void ServiceWorkerVersion::InitializeGlobalScope( void ServiceWorkerVersion::InitializeGlobalScope(
......
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