Commit a5305022 authored by Patrick Monette's avatar Patrick Monette Committed by Commit Bot

ServiceWorkerContainerHost: Re-order parameters in factory functions.

This change is meant to make the order of the parameters of the factory
functions and the constructor consistent.

Change-Id: Icce46b60c7a5da5579fb172ea901eec92ffa566e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147888
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Auto-Submit: Patrick Monette <pmonette@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760076}
parent 74f76a6b
...@@ -83,13 +83,13 @@ class ServiceWorkerContainerHost::PendingUpdateVersion { ...@@ -83,13 +83,13 @@ class ServiceWorkerContainerHost::PendingUpdateVersion {
// static // static
base::WeakPtr<ServiceWorkerContainerHost> base::WeakPtr<ServiceWorkerContainerHost>
ServiceWorkerContainerHost::CreateForWindow( ServiceWorkerContainerHost::CreateForWindow(
base::WeakPtr<ServiceWorkerContextCore> context,
bool are_ancestors_secure, bool are_ancestors_secure,
int frame_tree_node_id, int frame_tree_node_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost> mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver, host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer> mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote) { container_remote,
base::WeakPtr<ServiceWorkerContextCore> context) {
DCHECK(context); DCHECK(context);
auto container_host = std::make_unique<ServiceWorkerContainerHost>( auto container_host = std::make_unique<ServiceWorkerContainerHost>(
blink::mojom::ServiceWorkerContainerType::kForWindow, blink::mojom::ServiceWorkerContainerType::kForWindow,
...@@ -111,13 +111,13 @@ ServiceWorkerContainerHost::CreateForWindow( ...@@ -111,13 +111,13 @@ ServiceWorkerContainerHost::CreateForWindow(
// static // static
base::WeakPtr<ServiceWorkerContainerHost> base::WeakPtr<ServiceWorkerContainerHost>
ServiceWorkerContainerHost::CreateForWebWorker( ServiceWorkerContainerHost::CreateForWebWorker(
base::WeakPtr<ServiceWorkerContextCore> context,
int process_id,
blink::mojom::ServiceWorkerContainerType container_type, blink::mojom::ServiceWorkerContainerType container_type,
int process_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost> mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver, host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer> mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote) { container_remote,
base::WeakPtr<ServiceWorkerContextCore> context) {
DCHECK(context); DCHECK(context);
using ServiceWorkerContainerType = blink::mojom::ServiceWorkerContainerType; using ServiceWorkerContainerType = blink::mojom::ServiceWorkerContainerType;
DCHECK((base::FeatureList::IsEnabled(blink::features::kPlzDedicatedWorker) && DCHECK((base::FeatureList::IsEnabled(blink::features::kPlzDedicatedWorker) &&
......
...@@ -96,24 +96,24 @@ class CONTENT_EXPORT ServiceWorkerContainerHost final ...@@ -96,24 +96,24 @@ class CONTENT_EXPORT ServiceWorkerContainerHost final
// origin. |frame_tree_node_id| is FrameTreeNode id. |web_contents_getter| // origin. |frame_tree_node_id| is FrameTreeNode id. |web_contents_getter|
// indicates the tab where the navigation is occurring. // indicates the tab where the navigation is occurring.
static base::WeakPtr<ServiceWorkerContainerHost> CreateForWindow( static base::WeakPtr<ServiceWorkerContainerHost> CreateForWindow(
base::WeakPtr<ServiceWorkerContextCore> context,
bool are_ancestors_secure, bool are_ancestors_secure,
int frame_tree_node_id, int frame_tree_node_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost> mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver, host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer> mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote); container_remote,
base::WeakPtr<ServiceWorkerContextCore> context);
// Used for starting a web worker (dedicated worker or shared worker). Returns // Used for starting a web worker (dedicated worker or shared worker). Returns
// a container host for the worker. // a container host for the worker.
static base::WeakPtr<ServiceWorkerContainerHost> CreateForWebWorker( static base::WeakPtr<ServiceWorkerContainerHost> CreateForWebWorker(
base::WeakPtr<ServiceWorkerContextCore> context,
int process_id,
blink::mojom::ServiceWorkerContainerType container_type, blink::mojom::ServiceWorkerContainerType container_type,
int process_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost> mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver, host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer> mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote); container_remote,
base::WeakPtr<ServiceWorkerContextCore> context);
ServiceWorkerContainerHost( ServiceWorkerContainerHost(
blink::mojom::ServiceWorkerContainerType type, blink::mojom::ServiceWorkerContainerType type,
......
...@@ -115,9 +115,9 @@ void MaybeCreateLoaderOnCoreThread( ...@@ -115,9 +115,9 @@ void MaybeCreateLoaderOnCoreThread(
if (params.resource_type == blink::mojom::ResourceType::kMainFrame || if (params.resource_type == blink::mojom::ResourceType::kMainFrame ||
params.resource_type == blink::mojom::ResourceType::kSubFrame) { params.resource_type == blink::mojom::ResourceType::kSubFrame) {
container_host = ServiceWorkerContainerHost::CreateForWindow( container_host = ServiceWorkerContainerHost::CreateForWindow(
context_core->AsWeakPtr(), params.are_ancestors_secure, params.are_ancestors_secure, params.frame_tree_node_id,
params.frame_tree_node_id, std::move(host_receiver), std::move(host_receiver), std::move(client_remote),
std::move(client_remote)); context_core->AsWeakPtr());
} else { } else {
DCHECK(params.resource_type == blink::mojom::ResourceType::kWorker || DCHECK(params.resource_type == blink::mojom::ResourceType::kWorker ||
params.resource_type == blink::mojom::ResourceType::kSharedWorker); params.resource_type == blink::mojom::ResourceType::kSharedWorker);
...@@ -126,8 +126,8 @@ void MaybeCreateLoaderOnCoreThread( ...@@ -126,8 +126,8 @@ void MaybeCreateLoaderOnCoreThread(
? blink::mojom::ServiceWorkerContainerType::kForDedicatedWorker ? blink::mojom::ServiceWorkerContainerType::kForDedicatedWorker
: blink::mojom::ServiceWorkerContainerType::kForSharedWorker; : blink::mojom::ServiceWorkerContainerType::kForSharedWorker;
container_host = ServiceWorkerContainerHost::CreateForWebWorker( container_host = ServiceWorkerContainerHost::CreateForWebWorker(
context_core->AsWeakPtr(), params.process_id, container_type, container_type, params.process_id, std::move(host_receiver),
std::move(host_receiver), std::move(client_remote)); std::move(client_remote), context_core->AsWeakPtr());
} }
DCHECK(container_host); DCHECK(container_host);
handle_core->set_container_host(container_host); handle_core->set_container_host(container_host);
......
...@@ -997,8 +997,9 @@ void ServiceWorkerProviderHostTest::TestReservedClientsAreNotExposed( ...@@ -997,8 +997,9 @@ void ServiceWorkerProviderHostTest::TestReservedClientsAreNotExposed(
provider_info->host_remote.InitWithNewEndpointAndPassReceiver(); provider_info->host_remote.InitWithNewEndpointAndPassReceiver();
base::WeakPtr<ServiceWorkerContainerHost> container_host = base::WeakPtr<ServiceWorkerContainerHost> container_host =
ServiceWorkerContainerHost::CreateForWebWorker( ServiceWorkerContainerHost::CreateForWebWorker(
context_->AsWeakPtr(), helper_->mock_render_process_id(), provider_type, helper_->mock_render_process_id(),
provider_type, std::move(host_receiver), std::move(client_remote)); std::move(host_receiver), std::move(client_remote),
context_->AsWeakPtr());
container_host->UpdateUrls(url, net::SiteForCookies::FromUrl(url), container_host->UpdateUrls(url, net::SiteForCookies::FromUrl(url),
url::Origin::Create(url)); url::Origin::Create(url));
EXPECT_FALSE(CanFindClientContainerHost(container_host.get())); EXPECT_FALSE(CanFindClientContainerHost(container_host.get()));
...@@ -1082,8 +1083,9 @@ void ServiceWorkerProviderHostTest::TestClientPhaseTransition( ...@@ -1082,8 +1083,9 @@ void ServiceWorkerProviderHostTest::TestClientPhaseTransition(
provider_info->host_remote.InitWithNewEndpointAndPassReceiver(); provider_info->host_remote.InitWithNewEndpointAndPassReceiver();
base::WeakPtr<ServiceWorkerContainerHost> container_host = base::WeakPtr<ServiceWorkerContainerHost> container_host =
ServiceWorkerContainerHost::CreateForWebWorker( ServiceWorkerContainerHost::CreateForWebWorker(
helper_->context()->AsWeakPtr(), helper_->mock_render_process_id(), provider_type, helper_->mock_render_process_id(),
provider_type, std::move(host_receiver), std::move(client_remote)); std::move(host_receiver), std::move(client_remote),
helper_->context()->AsWeakPtr());
EXPECT_FALSE(container_host->is_response_committed()); EXPECT_FALSE(container_host->is_response_committed());
EXPECT_FALSE(container_host->is_execution_ready()); EXPECT_FALSE(container_host->is_execution_ready());
......
...@@ -345,8 +345,9 @@ CreateContainerHostAndInfoForWindow( ...@@ -345,8 +345,9 @@ CreateContainerHostAndInfoForWindow(
host_receiver = info->host_remote.InitWithNewEndpointAndPassReceiver(); host_receiver = info->host_remote.InitWithNewEndpointAndPassReceiver();
return std::make_unique<ServiceWorkerContainerHostAndInfo>( return std::make_unique<ServiceWorkerContainerHostAndInfo>(
ServiceWorkerContainerHost::CreateForWindow( ServiceWorkerContainerHost::CreateForWindow(
context, are_ancestors_secure, FrameTreeNode::kFrameTreeNodeInvalidId, are_ancestors_secure, FrameTreeNode::kFrameTreeNodeInvalidId,
std::move(host_receiver), std::move(client_remote)), std::move(host_receiver), std::move(client_remote),
std::move(context)),
std::move(info)); std::move(info));
} }
......
...@@ -108,9 +108,9 @@ class SharedWorkerHostTest : public testing::Test { ...@@ -108,9 +108,9 @@ class SharedWorkerHostTest : public testing::Test {
provider_info->host_remote.InitWithNewEndpointAndPassReceiver(); provider_info->host_remote.InitWithNewEndpointAndPassReceiver();
base::WeakPtr<ServiceWorkerContainerHost> service_worker_container_host = base::WeakPtr<ServiceWorkerContainerHost> service_worker_container_host =
ServiceWorkerContainerHost::CreateForWebWorker( ServiceWorkerContainerHost::CreateForWebWorker(
helper_->context()->AsWeakPtr(), mock_render_process_host_.GetID(),
blink::mojom::ServiceWorkerContainerType::kForSharedWorker, blink::mojom::ServiceWorkerContainerType::kForSharedWorker,
std::move(host_receiver), std::move(client_remote)); mock_render_process_host_.GetID(), std::move(host_receiver),
std::move(client_remote), helper_->context()->AsWeakPtr());
service_worker_handle->OnCreatedProviderHost(std::move(provider_info)); service_worker_handle->OnCreatedProviderHost(std::move(provider_info));
host->SetServiceWorkerHandle(std::move(service_worker_handle)); host->SetServiceWorkerHandle(std::move(service_worker_handle));
......
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