From bf52d9d755193dbe670bc3a5eb925f70430c80fa Mon Sep 17 00:00:00 2001 From: Sebastien Marchand Date: Mon, 31 Oct 2022 16:16:42 +0000 Subject: [PATCH] [fuchsia] Bump the target API level to 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: we're working on moving the target API level definition out of .gn, this will hopefully be done during Q4. Bug: 1376558 Change-Id: I3f5d6b45cfcb83e02d7f7c9d02bcdd9e3ce75958 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3965828 Reviewed-by: Wez Reviewed-by: Nico Weber Commit-Queue: Sébastien Marchand Reviewed-by: Greg Thompson Cr-Commit-Position: refs/heads/main@{#1065518} --- .gn | 2 +- base/fuchsia/service_directory_test_base.cc | 3 +-- base/fuchsia/startup_context.h | 2 +- .../test_component_context_for_process.cc | 3 +-- .../inspect_unittest.cc | 3 +-- .../cast_runner_cfv1_shim_integration_test.cc | 5 ++--- .../cast/cast_runner_integration_test.cc | 2 +- .../runners/common/modular/agent_impl.cc | 3 +-- .../runners/web/web_runner_smoke_test.cc | 4 ++-- fuchsia_web/shell/web_engine_shell.cc | 2 +- .../webengine/context_provider_impl_unittest.cc | 9 ++++----- .../test/context_provider_for_test_v1.cc | 3 +-- .../webengine/test/isolated_archivist_v1.cc | 3 +-- .../webinstance_host/web_instance_host.cc | 17 ++++++++--------- 14 files changed, 26 insertions(+), 35 deletions(-) diff --git a/.gn b/.gn index 55f5ee19f13e49..53c9e4ec12aeff 100644 --- a/.gn +++ b/.gn @@ -58,7 +58,7 @@ default_args = { # Overwrite default args declared in the Fuchsia sdk fuchsia_sdk_readelf_exec = "//third_party/llvm-build/Release+Asserts/bin/llvm-readelf" - fuchsia_target_api_level = 9 + fuchsia_target_api_level = 10 devtools_visibility = [ "*" ] } diff --git a/base/fuchsia/service_directory_test_base.cc b/base/fuchsia/service_directory_test_base.cc index 79ce3f8f33738c..a2b9e3aca8c893 100644 --- a/base/fuchsia/service_directory_test_base.cc +++ b/base/fuchsia/service_directory_test_base.cc @@ -20,8 +20,7 @@ ServiceDirectoryTestBase::ServiceDirectoryTestBase() // Mount service dir and publish the service. outgoing_directory_ = std::make_unique(); fidl::InterfaceHandle<::fuchsia::io::Directory> directory; - zx_status_t status = - outgoing_directory_->Serve(directory.NewRequest().TakeChannel()); + zx_status_t status = outgoing_directory_->Serve(directory.NewRequest()); ZX_CHECK(status == ZX_OK, status); service_binding_ = std::make_unique>( diff --git a/base/fuchsia/startup_context.h b/base/fuchsia/startup_context.h index d20f65eb417af4..263342b18a958b 100644 --- a/base/fuchsia/startup_context.h +++ b/base/fuchsia/startup_context.h @@ -64,7 +64,7 @@ class BASE_EXPORT StartupContext { std::unique_ptr component_context_; // Used to store outgoing directory until ServeOutgoingDirectory() is called. - zx::channel outgoing_directory_request_; + fidl::InterfaceRequest outgoing_directory_request_; }; } // namespace base diff --git a/base/fuchsia/test_component_context_for_process.cc b/base/fuchsia/test_component_context_for_process.cc index f0576bbb0a0c67..7ec07e8043933a 100644 --- a/base/fuchsia/test_component_context_for_process.cc +++ b/base/fuchsia/test_component_context_for_process.cc @@ -54,8 +54,7 @@ TestComponentContextForProcess::TestComponentContextForProcess( fidl::InterfaceHandle<::fuchsia::io::Directory> published_root_directory; old_context_ = ReplaceComponentContextForProcessForTest( std::make_unique( - std::move(incoming_services), - published_root_directory.NewRequest().TakeChannel())); + std::move(incoming_services), published_root_directory.NewRequest())); // Connect to the "/svc" directory of the |published_root_directory| and wrap // that into a ServiceDirectory. diff --git a/components/fuchsia_component_support/inspect_unittest.cc b/components/fuchsia_component_support/inspect_unittest.cc index 3eb9bef6cf5850..3abfd5573b12e2 100644 --- a/components/fuchsia_component_support/inspect_unittest.cc +++ b/components/fuchsia_component_support/inspect_unittest.cc @@ -34,8 +34,7 @@ class InspectTest : public ::testing::Test { auto incoming_services = std::make_shared(std::move(incoming_directory)); context_ = std::make_unique( - std::move(incoming_services), - published_root_directory_.NewRequest().TakeChannel()); + std::move(incoming_services), published_root_directory_.NewRequest()); inspector_ = std::make_unique(context_.get()); base::RunLoop().RunUntilIdle(); } diff --git a/fuchsia_web/runners/cast/cast_runner_cfv1_shim_integration_test.cc b/fuchsia_web/runners/cast/cast_runner_cfv1_shim_integration_test.cc index 745abede558ad4..5e7a801fc38f97 100644 --- a/fuchsia_web/runners/cast/cast_runner_cfv1_shim_integration_test.cc +++ b/fuchsia_web/runners/cast/cast_runner_cfv1_shim_integration_test.cc @@ -116,13 +116,12 @@ class CastRunnerCfv1ShimIntegrationTest : public ::testing::Test { svc_dir->Serve(fuchsia::io::OpenFlags::RIGHT_READABLE | fuchsia::io::OpenFlags::RIGHT_WRITABLE, svc_dir_handle.NewRequest().TakeChannel()); - additional_services->host_directory = svc_dir_handle.TakeChannel(); + additional_services->host_directory = std::move(svc_dir_handle); launch_info.additional_services = std::move(additional_services); fuchsia::io::DirectoryHandle cast_runner_services_dir; - launch_info.directory_request = - cast_runner_services_dir.NewRequest().TakeChannel(); + launch_info.directory_request = cast_runner_services_dir.NewRequest(); fuchsia::sys::LauncherPtr launcher; base::ComponentContextForProcess()->svc()->Connect(launcher.NewRequest()); diff --git a/fuchsia_web/runners/cast/cast_runner_integration_test.cc b/fuchsia_web/runners/cast/cast_runner_integration_test.cc index 96b43323caa302..3444f13dc95fce 100644 --- a/fuchsia_web/runners/cast/cast_runner_integration_test.cc +++ b/fuchsia_web/runners/cast/cast_runner_integration_test.cc @@ -260,7 +260,7 @@ class TestCastComponent { fidl::InterfaceHandle outgoing_directory; startup_info.launch_info.directory_request = - outgoing_directory.NewRequest().TakeChannel(); + outgoing_directory.NewRequest(); fidl::InterfaceHandle svc_directory; EXPECT_EQ(fdio_service_connect_at( diff --git a/fuchsia_web/runners/common/modular/agent_impl.cc b/fuchsia_web/runners/common/modular/agent_impl.cc index 48f8e175bc8060..979d130db1de5a 100644 --- a/fuchsia_web/runners/common/modular/agent_impl.cc +++ b/fuchsia_web/runners/common/modular/agent_impl.cc @@ -67,8 +67,7 @@ AgentImpl::AgentImpl( agent_binding_(outgoing_directory, this) { if (!public_service_names_.empty()) { fuchsia::io::DirectoryHandle root_directory; - zx_status_t status = - outgoing_directory->Serve(root_directory.NewRequest().TakeChannel()); + zx_status_t status = outgoing_directory->Serve(root_directory.NewRequest()); ZX_CHECK(status == ZX_OK, status) << "Serve(root)"; fuchsia::io::DirectoryHandle svc_directory; status = fdio_service_connect_at( diff --git a/fuchsia_web/runners/web/web_runner_smoke_test.cc b/fuchsia_web/runners/web/web_runner_smoke_test.cc index 027d946b6ed16e..b819a8d0bfee4f 100644 --- a/fuchsia_web/runners/web/web_runner_smoke_test.cc +++ b/fuchsia_web/runners/web/web_runner_smoke_test.cc @@ -107,7 +107,7 @@ class WebRunnerSmokeTest : public testing::Test { auto services = fuchsia::sys::ServiceList::New(); services->names = std::move(runner_services); services->host_directory = - base::ComponentContextForProcess()->svc()->CloneChannel().TakeChannel(); + base::ComponentContextForProcess()->svc()->CloneChannel(); fuchsia::sys::EnvironmentPtr runner_environment; environment->CreateNestedEnvironment( @@ -174,7 +174,7 @@ TEST_F(WebRunnerSmokeTest, LifecycleTerminate) { fuchsia::sys::LaunchInfo launch_info = LaunchInfoWithServices(); launch_info.url = test_server_.GetURL("/test.html").spec(); - launch_info.directory_request = directory.NewRequest().TakeChannel(); + launch_info.directory_request = directory.NewRequest(); fuchsia::sys::ComponentControllerPtr controller; GetLauncher()->CreateComponent(std::move(launch_info), diff --git a/fuchsia_web/shell/web_engine_shell.cc b/fuchsia_web/shell/web_engine_shell.cc index 5049a0bdc39a5e..a1797d0d6560dd 100644 --- a/fuchsia_web/shell/web_engine_shell.cc +++ b/fuchsia_web/shell/web_engine_shell.cc @@ -100,7 +100,7 @@ fuchsia::web::ContextProviderPtr ConnectToContextProvider( web_engine_package_name.data()); launch_info.arguments = extra_command_line_arguments; fidl::InterfaceHandle service_directory; - launch_info.directory_request = service_directory.NewRequest().TakeChannel(); + launch_info.directory_request = service_directory.NewRequest(); launcher->CreateComponent(std::move(launch_info), component_controller_.NewRequest()); diff --git a/fuchsia_web/webengine/context_provider_impl_unittest.cc b/fuchsia_web/webengine/context_provider_impl_unittest.cc index 427fd5e6df7ea2..b3d884c00371f2 100644 --- a/fuchsia_web/webengine/context_provider_impl_unittest.cc +++ b/fuchsia_web/webengine/context_provider_impl_unittest.cc @@ -170,8 +170,7 @@ class FakeSysLauncher final : public fuchsia::sys::testing::Launcher_TestBase { tmp_directory.NewRequest().TakeChannel().release()); ZX_CHECK(status == ZX_OK, status) << "fdio_open(/tmp)"; launch_info.flat_namespace->paths.push_back("/tmp"); - launch_info.flat_namespace->directories.push_back( - tmp_directory.TakeChannel()); + launch_info.flat_namespace->directories.push_back(std::move(tmp_directory)); // Redirect the sub-process Component's stderr to feed into the test output. launch_info.err = fuchsia::sys::FileDescriptor::New(); @@ -258,9 +257,9 @@ class FakeSysEnvironment final fake_nested_environment_.Bind(std::move(environment_request)); nested_environment_controller_request_ = std::move(controller_request); } - void GetDirectory(zx::channel request) override { - base::ComponentContextForProcess()->svc()->CloneChannel( - fidl::InterfaceRequest(std::move(request))); + void GetDirectory( + fidl::InterfaceRequest<::fuchsia::io::Directory> request) override { + base::ComponentContextForProcess()->svc()->CloneChannel(std::move(request)); } private: diff --git a/fuchsia_web/webengine/test/context_provider_for_test_v1.cc b/fuchsia_web/webengine/test/context_provider_for_test_v1.cc index 8d479a350d7ce9..e3484ee1196ef1 100644 --- a/fuchsia_web/webengine/test/context_provider_for_test_v1.cc +++ b/fuchsia_web/webengine/test/context_provider_for_test_v1.cc @@ -44,8 +44,7 @@ fidl::InterfaceHandle StartWebEngineForTestsInternal( command_line.argv().begin() + 1, command_line.argv().end())); fuchsia::io::DirectorySyncPtr web_engine_services_dir; - launch_info.directory_request = - web_engine_services_dir.NewRequest().TakeChannel(); + launch_info.directory_request = web_engine_services_dir.NewRequest(); fuchsia::sys::LauncherPtr launcher; base::ComponentContextForProcess()->svc()->Connect(launcher.NewRequest()); diff --git a/fuchsia_web/webengine/test/isolated_archivist_v1.cc b/fuchsia_web/webengine/test/isolated_archivist_v1.cc index f7310ed84cd112..0c5011d7423697 100644 --- a/fuchsia_web/webengine/test/isolated_archivist_v1.cc +++ b/fuchsia_web/webengine/test/isolated_archivist_v1.cc @@ -30,8 +30,7 @@ fidl::InterfaceHandle StartIsolatedArchivist( launch_info.url = kArchivistUrl; fidl::InterfaceHandle archivist_services_dir; - launch_info.directory_request = - archivist_services_dir.NewRequest().TakeChannel(); + launch_info.directory_request = archivist_services_dir.NewRequest(); auto launcher = base::ComponentContextForProcess() ->svc() diff --git a/fuchsia_web/webinstance_host/web_instance_host.cc b/fuchsia_web/webinstance_host/web_instance_host.cc index b5648e0d06b1d8..f74ae5f73eb561 100644 --- a/fuchsia_web/webinstance_host/web_instance_host.cc +++ b/fuchsia_web/webinstance_host/web_instance_host.cc @@ -152,7 +152,7 @@ bool HandleDataDirectoryParam(fuchsia::web::CreateContextParams* params, launch_info->flat_namespace->paths.push_back( base::kPersistedDataDirectoryPath); launch_info->flat_namespace->directories.push_back( - params->mutable_data_directory()->TakeChannel()); + std::move(*params->mutable_data_directory())); if (params->has_data_quota_bytes()) { launch_args->AppendSwitchNative( switches::kDataQuotaBytes, @@ -173,7 +173,7 @@ bool HandleCdmDataDirectoryParam(fuchsia::web::CreateContextParams* params, launch_args->AppendSwitchNative(switches::kCdmDataDirectory, kCdmDataPath); launch_info->flat_namespace->paths.push_back(kCdmDataPath); launch_info->flat_namespace->directories.push_back( - params->mutable_cdm_data_directory()->TakeChannel()); + std::move(*params->mutable_cdm_data_directory())); if (params->has_cdm_data_quota_bytes()) { launch_args->AppendSwitchNative( switches::kCdmDataQuotaBytes, @@ -275,7 +275,7 @@ bool HandleContentDirectoriesParam(fuchsia::web::CreateContextParams* params, launch_info->flat_namespace->paths.push_back( kContentDirectories.Append(directory.name()).value()); launch_info->flat_namespace->directories.push_back( - directory.mutable_directory()->TakeChannel()); + std::move(*directory.mutable_directory())); } launch_args->AppendSwitch(switches::kEnableContentDirectories); @@ -649,13 +649,12 @@ zx_status_t WebInstanceHost::CreateInstanceForContextWithCopiedArgs( if (tmp_dir_.is_valid()) { launch_info.flat_namespace->paths.push_back("/tmp"); - launch_info.flat_namespace->directories.push_back(tmp_dir_.TakeChannel()); + launch_info.flat_namespace->directories.push_back(std::move(tmp_dir_)); } // Create a request for the new instance's service-directory. fidl::InterfaceHandle instance_services_handle; - launch_info.directory_request = - instance_services_handle.NewRequest().TakeChannel(); + launch_info.directory_request = instance_services_handle.NewRequest(); sys::ServiceDirectory instance_services(std::move(instance_services_handle)); // If one or more Debug protocol clients are active then enable debugging, @@ -677,7 +676,7 @@ zx_status_t WebInstanceHost::CreateInstanceForContextWithCopiedArgs( launch_info.additional_services = fuchsia::sys::ServiceList::New(); launch_info.additional_services->names = GetRequiredServicesForConfig(params); launch_info.additional_services->host_directory = - service_directory.TakeChannel(); + std::move(service_directory); // Take the accumulated command line arguments, omitting the program name in // argv[0], and set them in |launch_info|. @@ -712,8 +711,8 @@ fuchsia::sys::Launcher* WebInstanceHost::IsolatedEnvironmentLauncher() { auto services = fuchsia::sys::ServiceList::New(); services->names.push_back(fuchsia::sys::Loader::Name_); fidl::InterfaceHandle<::fuchsia::io::Directory> services_channel; - environment->GetDirectory(services_channel.NewRequest().TakeChannel()); - services->host_directory = services_channel.TakeChannel(); + environment->GetDirectory(services_channel.NewRequest()); + services->host_directory = std::move(services_channel); // Instantiate the isolated environment. This ContextProvider instance's PID // is included in the label to ensure that concurrent service instances