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 {
// static
base::WeakPtr<ServiceWorkerContainerHost>
ServiceWorkerContainerHost::CreateForWindow(
base::WeakPtr<ServiceWorkerContextCore> context,
bool are_ancestors_secure,
int frame_tree_node_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote) {
container_remote,
base::WeakPtr<ServiceWorkerContextCore> context) {
DCHECK(context);
auto container_host = std::make_unique<ServiceWorkerContainerHost>(
blink::mojom::ServiceWorkerContainerType::kForWindow,
......@@ -111,13 +111,13 @@ ServiceWorkerContainerHost::CreateForWindow(
// static
base::WeakPtr<ServiceWorkerContainerHost>
ServiceWorkerContainerHost::CreateForWebWorker(
base::WeakPtr<ServiceWorkerContextCore> context,
int process_id,
blink::mojom::ServiceWorkerContainerType container_type,
int process_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote) {
container_remote,
base::WeakPtr<ServiceWorkerContextCore> context) {
DCHECK(context);
using ServiceWorkerContainerType = blink::mojom::ServiceWorkerContainerType;
DCHECK((base::FeatureList::IsEnabled(blink::features::kPlzDedicatedWorker) &&
......
......@@ -96,24 +96,24 @@ class CONTENT_EXPORT ServiceWorkerContainerHost final
// origin. |frame_tree_node_id| is FrameTreeNode id. |web_contents_getter|
// indicates the tab where the navigation is occurring.
static base::WeakPtr<ServiceWorkerContainerHost> CreateForWindow(
base::WeakPtr<ServiceWorkerContextCore> context,
bool are_ancestors_secure,
int frame_tree_node_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver,
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
// a container host for the worker.
static base::WeakPtr<ServiceWorkerContainerHost> CreateForWebWorker(
base::WeakPtr<ServiceWorkerContextCore> context,
int process_id,
blink::mojom::ServiceWorkerContainerType container_type,
int process_id,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainerHost>
host_receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainer>
container_remote);
container_remote,
base::WeakPtr<ServiceWorkerContextCore> context);
ServiceWorkerContainerHost(
blink::mojom::ServiceWorkerContainerType type,
......
......@@ -115,9 +115,9 @@ void MaybeCreateLoaderOnCoreThread(
if (params.resource_type == blink::mojom::ResourceType::kMainFrame ||
params.resource_type == blink::mojom::ResourceType::kSubFrame) {
container_host = ServiceWorkerContainerHost::CreateForWindow(
context_core->AsWeakPtr(), params.are_ancestors_secure,
params.frame_tree_node_id, std::move(host_receiver),
std::move(client_remote));
params.are_ancestors_secure, params.frame_tree_node_id,
std::move(host_receiver), std::move(client_remote),
context_core->AsWeakPtr());
} else {
DCHECK(params.resource_type == blink::mojom::ResourceType::kWorker ||
params.resource_type == blink::mojom::ResourceType::kSharedWorker);
......@@ -126,8 +126,8 @@ void MaybeCreateLoaderOnCoreThread(
? blink::mojom::ServiceWorkerContainerType::kForDedicatedWorker
: blink::mojom::ServiceWorkerContainerType::kForSharedWorker;
container_host = ServiceWorkerContainerHost::CreateForWebWorker(
context_core->AsWeakPtr(), params.process_id, container_type,
std::move(host_receiver), std::move(client_remote));
container_type, params.process_id, std::move(host_receiver),
std::move(client_remote), context_core->AsWeakPtr());
}
DCHECK(container_host);
handle_core->set_container_host(container_host);
......
......@@ -997,8 +997,9 @@ void ServiceWorkerProviderHostTest::TestReservedClientsAreNotExposed(
provider_info->host_remote.InitWithNewEndpointAndPassReceiver();
base::WeakPtr<ServiceWorkerContainerHost> container_host =
ServiceWorkerContainerHost::CreateForWebWorker(
context_->AsWeakPtr(), helper_->mock_render_process_id(),
provider_type, std::move(host_receiver), std::move(client_remote));
provider_type, helper_->mock_render_process_id(),
std::move(host_receiver), std::move(client_remote),
context_->AsWeakPtr());
container_host->UpdateUrls(url, net::SiteForCookies::FromUrl(url),
url::Origin::Create(url));
EXPECT_FALSE(CanFindClientContainerHost(container_host.get()));
......@@ -1082,8 +1083,9 @@ void ServiceWorkerProviderHostTest::TestClientPhaseTransition(
provider_info->host_remote.InitWithNewEndpointAndPassReceiver();
base::WeakPtr<ServiceWorkerContainerHost> container_host =
ServiceWorkerContainerHost::CreateForWebWorker(
helper_->context()->AsWeakPtr(), helper_->mock_render_process_id(),
provider_type, std::move(host_receiver), std::move(client_remote));
provider_type, helper_->mock_render_process_id(),
std::move(host_receiver), std::move(client_remote),
helper_->context()->AsWeakPtr());
EXPECT_FALSE(container_host->is_response_committed());
EXPECT_FALSE(container_host->is_execution_ready());
......
......@@ -345,8 +345,9 @@ CreateContainerHostAndInfoForWindow(
host_receiver = info->host_remote.InitWithNewEndpointAndPassReceiver();
return std::make_unique<ServiceWorkerContainerHostAndInfo>(
ServiceWorkerContainerHost::CreateForWindow(
context, are_ancestors_secure, FrameTreeNode::kFrameTreeNodeInvalidId,
std::move(host_receiver), std::move(client_remote)),
are_ancestors_secure, FrameTreeNode::kFrameTreeNodeInvalidId,
std::move(host_receiver), std::move(client_remote),
std::move(context)),
std::move(info));
}
......
......@@ -108,9 +108,9 @@ class SharedWorkerHostTest : public testing::Test {
provider_info->host_remote.InitWithNewEndpointAndPassReceiver();
base::WeakPtr<ServiceWorkerContainerHost> service_worker_container_host =
ServiceWorkerContainerHost::CreateForWebWorker(
helper_->context()->AsWeakPtr(), mock_render_process_host_.GetID(),
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));
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