From 41a0a8e7632fb9c59efecdd7200b2c3931656e43 Mon Sep 17 00:00:00 2001 From: Brandon Castellano Date: Tue, 26 Nov 2024 18:50:27 +0000 Subject: [PATCH 1/5] [fuchsia] Use AT_FDCWD with fdio_open*_at The fdio library *_at functions work correctly with AT_FDCWD now, so we can reduce some code duplication for special cases. These library functions internally already call the *_at version with AT_FDCWD. --- .../runtime/dart/utils/mapped_resource.cc | 23 ++++--------------- .../fuchsia/runtime/dart/utils/vmo.cc | 21 +---------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc b/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc index c9c657b47bba7..b1abd3a2dee6f 100644 --- a/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc +++ b/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc @@ -103,24 +103,11 @@ MappedResource::~MappedResource() { static int OpenFdExec(const std::string& path, int dirfd) { int fd = -1; - zx_status_t result; - if (dirfd == AT_FDCWD) { - // fdio_open_fd_at does not support AT_FDCWD, by design. Use fdio_open_fd - // and expect an absolute path for that usage pattern. - FML_CHECK(path[0] == '/'); - result = fdio_open_fd( - path.c_str(), - static_cast(fuchsia::io::OpenFlags::RIGHT_READABLE | - fuchsia::io::OpenFlags::RIGHT_EXECUTABLE), - &fd); - } else { - FML_CHECK(path[0] != '/'); - result = fdio_open_fd_at( - dirfd, path.c_str(), - static_cast(fuchsia::io::OpenFlags::RIGHT_READABLE | - fuchsia::io::OpenFlags::RIGHT_EXECUTABLE), - &fd); - } + zx_status_t result = fdio_open_fd_at( + dirfd, path.c_str(), + static_cast(fuchsia::io::OpenFlags::RIGHT_READABLE | + fuchsia::io::OpenFlags::RIGHT_EXECUTABLE), + &fd); if (result != ZX_OK) { FML_LOG(ERROR) << "fdio_open_fd_at(" << path << ") " << "failed: " << zx_status_get_string(result); diff --git a/shell/platform/fuchsia/runtime/dart/utils/vmo.cc b/shell/platform/fuchsia/runtime/dart/utils/vmo.cc index f0295eb48f815..4d0315be9a0eb 100644 --- a/shell/platform/fuchsia/runtime/dart/utils/vmo.cc +++ b/shell/platform/fuchsia/runtime/dart/utils/vmo.cc @@ -57,26 +57,7 @@ namespace dart_utils { bool VmoFromFilename(const std::string& filename, bool executable, fuchsia::mem::Buffer* buffer) { - // Note: the implementation here cannot be shared with VmoFromFilenameAt - // because fdio_open_fd_at does not aim to provide POSIX compatibility, and - // thus does not handle AT_FDCWD as dirfd. - auto flags = fuchsia::io::OpenFlags::RIGHT_READABLE; - if (executable) { - flags |= fuchsia::io::OpenFlags::RIGHT_EXECUTABLE; - } - - int fd; - const zx_status_t status = - fdio_open_fd(filename.c_str(), static_cast(flags), &fd); - if (status != ZX_OK) { - FML_LOG(ERROR) << "fdio_open_fd(\"" << filename << "\", " << std::hex - << static_cast(flags) - << ") failed: " << zx_status_get_string(status); - return false; - } - bool result = VmoFromFd(fd, executable, buffer); - close(fd); - return result; + return VmoFromFilenameAt(AT_FDCWD, filename, executable, buffer); } bool VmoFromFilenameAt(int dirfd, From 3928351eed041f158df537860d4fe0337e4e6df6 Mon Sep 17 00:00:00 2001 From: Brandon Castellano Date: Tue, 26 Nov 2024 18:58:02 +0000 Subject: [PATCH 2/5] [fuchsia] Migrate fdio_open_* -> fdio_open3_* These functions are in the process of being deprecated, with Open -> Open3 and OpenFlags -> Flags. See https://fxbug.dev/378924259 for additional context. --- .../fuchsia/dart-pkg/zircon/sdk_ext/system.cc | 6 ++---- .../dart_runner/dart_component_controller.cc | 6 +++--- shell/platform/fuchsia/flutter/component_v2.cc | 10 +++++----- .../flutter/file_in_namespace_buffer.cc | 7 +++---- .../runtime/dart/utils/mapped_resource.cc | 15 +++++++++------ .../platform/fuchsia/runtime/dart/utils/vmo.cc | 18 +++++++++++------- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc b/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc index cdb51c1ad7987..7d79423e42c9d 100644 --- a/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc +++ b/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc @@ -183,10 +183,8 @@ zx_status_t FdFromPath(const char* path, fml::UniqueFD& fd) { path++; } int raw_fd; - if (zx_status_t status = fdio_open_fd_at( - dir_fd.get(), path, - static_cast(fuchsia::io::OpenFlags::RIGHT_READABLE), - &raw_fd); + if (zx_status_t status = fdio_open3_fd_at( + dir_fd.get(), path, uint64_t{fuchsia::io::PERM_READABLE}, &raw_fd); status != ZX_OK) { return status; } diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc index 666a29cba63a8..52dfbc03f7d39 100644 --- a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc +++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc @@ -246,10 +246,10 @@ bool DartComponentController::CreateAndBindNamespace() { for (auto& dir_str : other_dirs) { fuchsia::io::DirectoryHandle dir; auto request = dir.NewRequest().TakeChannel(); - auto status = fdio_open_at( + const zx_status_t status = fdio_open3_at( dart_outgoing_dir_ptr_.channel().get(), dir_str.c_str(), - static_cast(fuchsia::io::OpenFlags::DIRECTORY | - fuchsia::io::OpenFlags::RIGHT_READABLE), + uint64_t{fuchsia::io::Flags::PROTOCOL_DIRECTORY | + fuchsia::io::PERM_READABLE}, request.release()); if (status == ZX_OK) { dart_outgoing_dir_->AddEntry( diff --git a/shell/platform/fuchsia/flutter/component_v2.cc b/shell/platform/fuchsia/flutter/component_v2.cc index 98f1f57abfcb4..e53ca3bc200d4 100644 --- a/shell/platform/fuchsia/flutter/component_v2.cc +++ b/shell/platform/fuchsia/flutter/component_v2.cc @@ -292,11 +292,11 @@ ComponentV2::ComponentV2( for (auto& dir_str : other_dirs) { fuchsia::io::DirectoryHandle dir; auto request = dir.NewRequest().TakeChannel(); - auto status = fdio_open_at( - directory_ptr_.channel().get(), dir_str.c_str(), - static_cast(fuchsia::io::OpenFlags::DIRECTORY | - fuchsia::io::OpenFlags::RIGHT_READABLE), - request.release()); + const zx_status_t status = + fdio_open3_at(directory_ptr_.channel().get(), dir_str.c_str(), + uint64_t{fuchsia::io::Flags::PROTOCOL_DIRECTORY | + fuchsia::io::PERM_READABLE}, + request.release()); if (status == ZX_OK) { outgoing_dir_->AddEntry( dir_str.c_str(), diff --git a/shell/platform/fuchsia/flutter/file_in_namespace_buffer.cc b/shell/platform/fuchsia/flutter/file_in_namespace_buffer.cc index 698f7fb9263c8..509eb900f60b7 100644 --- a/shell/platform/fuchsia/flutter/file_in_namespace_buffer.cc +++ b/shell/platform/fuchsia/flutter/file_in_namespace_buffer.cc @@ -74,16 +74,15 @@ std::unique_ptr LoadFile(int namespace_fd, std::unique_ptr MakeFileMapping(const char* path, bool executable) { - auto flags = fuchsia::io::OpenFlags::RIGHT_READABLE; + fuchsia::io::Flags flags = fuchsia::io::PERM_READABLE; if (executable) { - flags |= fuchsia::io::OpenFlags::RIGHT_EXECUTABLE; + flags |= fuchsia::io::PERM_EXECUTABLE; } // The returned file descriptor is compatible with standard posix operations // such as close, mmap, etc. We only need to treat open/open_at specially. int fd; - const zx_status_t status = - fdio_open_fd(path, static_cast(flags), &fd); + const zx_status_t status = fdio_open3_fd(path, uint64_t{flags}, &fd); if (status != ZX_OK) { return nullptr; } diff --git a/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc b/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc index b1abd3a2dee6f..41445c980f52c 100644 --- a/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc +++ b/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc @@ -103,13 +103,16 @@ MappedResource::~MappedResource() { static int OpenFdExec(const std::string& path, int dirfd) { int fd = -1; - zx_status_t result = fdio_open_fd_at( - dirfd, path.c_str(), - static_cast(fuchsia::io::OpenFlags::RIGHT_READABLE | - fuchsia::io::OpenFlags::RIGHT_EXECUTABLE), - &fd); + // fdio_open3_fd_at only allows relative paths + const char* path_ptr = path.c_str(); + if (path_ptr && path_ptr[0] == '/') { + ++path_ptr; + } + zx_status_t result = fdio_open3_fd_at( + dirfd, path_ptr, + uint64_t{fuchsia::io::PERM_READABLE | fuchsia::io::PERM_EXECUTABLE}, &fd); if (result != ZX_OK) { - FML_LOG(ERROR) << "fdio_open_fd_at(" << path << ") " + FML_LOG(ERROR) << "fdio_open3_fd_at(" << path << ") " << "failed: " << zx_status_get_string(result); return -1; } diff --git a/shell/platform/fuchsia/runtime/dart/utils/vmo.cc b/shell/platform/fuchsia/runtime/dart/utils/vmo.cc index 4d0315be9a0eb..dc79f01e14e98 100644 --- a/shell/platform/fuchsia/runtime/dart/utils/vmo.cc +++ b/shell/platform/fuchsia/runtime/dart/utils/vmo.cc @@ -64,17 +64,21 @@ bool VmoFromFilenameAt(int dirfd, const std::string& filename, bool executable, fuchsia::mem::Buffer* buffer) { - auto flags = fuchsia::io::OpenFlags::RIGHT_READABLE; + fuchsia::io::Flags flags = fuchsia::io::PERM_READABLE; if (executable) { - flags |= fuchsia::io::OpenFlags::RIGHT_EXECUTABLE; + flags |= fuchsia::io::PERM_EXECUTABLE; + } + // fdio_open3_fd_at only allows relative paths + const char* path = filename.c_str(); + if (path && path[0] == '/') { + ++path; } - int fd; - const zx_status_t status = fdio_open_fd_at(dirfd, filename.c_str(), - static_cast(flags), &fd); + const zx_status_t status = + fdio_open3_fd_at(dirfd, path, uint64_t{flags}, &fd); if (status != ZX_OK) { - FML_LOG(ERROR) << "fdio_open_fd_at(" << dirfd << ", \"" << filename - << "\", " << std::hex << static_cast(flags) + FML_LOG(ERROR) << "fdio_open3_fd_at(" << dirfd << ", \"" << filename + << "\", " << std::hex << uint64_t{flags} << ") failed: " << zx_status_get_string(status); return false; } From 0f0bbe729e864765204c426e19fda7a01ed696c4 Mon Sep 17 00:00:00 2001 From: Brandon Castellano Date: Tue, 26 Nov 2024 19:05:11 +0000 Subject: [PATCH 3/5] [fuchsia] Migrate SDK VFS Serve() to typed replacement Migrate vfs::PseudoDir::Serve to use the new typed channel replacement, which is already available at all supported API levels. The previous signature is deprecated as of Fuchsia API level 25. See https://fxbug.dev/378924259 for additional context. --- .../dart_runner/dart_component_controller.cc | 8 ++++---- shell/platform/fuchsia/flutter/component_v2.cc | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc index 52dfbc03f7d39..73fb080ec5eba 100644 --- a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc +++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc @@ -283,11 +283,11 @@ bool DartComponentController::CreateAndBindNamespace() { dart_outgoing_dir_->AddEntry("svc", std::move(composed_service_dir)); if (start_info_.has_outgoing_dir()) { + fidl::ServerEnd server_end{ + start_info_.mutable_outgoing_dir()->TakeChannel()}; dart_outgoing_dir_->Serve( - fuchsia::io::OpenFlags::RIGHT_READABLE | - fuchsia::io::OpenFlags::RIGHT_WRITABLE | - fuchsia::io::OpenFlags::DIRECTORY, - start_info_.mutable_outgoing_dir()->TakeChannel()); + fuchsia_io::wire::kPermReadable | fuchsia_io::wire::kPermWritable, + std::move(server_end)); } return true; diff --git a/shell/platform/fuchsia/flutter/component_v2.cc b/shell/platform/fuchsia/flutter/component_v2.cc index e53ca3bc200d4..44db0f1f37c2c 100644 --- a/shell/platform/fuchsia/flutter/component_v2.cc +++ b/shell/platform/fuchsia/flutter/component_v2.cc @@ -235,18 +235,20 @@ ComponentV2::ComponentV2( // ComponentStartInfo::runtime_dir (optional). if (start_info.has_runtime_dir()) { - runtime_dir_->Serve(fuchsia::io::OpenFlags::RIGHT_READABLE | - fuchsia::io::OpenFlags::RIGHT_WRITABLE | - fuchsia::io::OpenFlags::DIRECTORY, - start_info.mutable_runtime_dir()->TakeChannel()); + fidl::ServerEnd server_end{ + start_info.mutable_runtime_dir()->TakeChannel()}; + runtime_dir_->Serve( + fuchsia_io::wire::kPermReadable | fuchsia_io::wire::kPermWritable, + std::move(server_end)); } // ComponentStartInfo::outgoing_dir (optional). if (start_info.has_outgoing_dir()) { - outgoing_dir_->Serve(fuchsia::io::OpenFlags::RIGHT_READABLE | - fuchsia::io::OpenFlags::RIGHT_WRITABLE | - fuchsia::io::OpenFlags::DIRECTORY, - start_info.mutable_outgoing_dir()->TakeChannel()); + fidl::ServerEnd server_end{ + start_info.mutable_outgoing_dir()->TakeChannel()}; + outgoing_dir_->Serve( + fuchsia_io::wire::kPermReadable | fuchsia_io::wire::kPermWritable, + std::move(server_end)); } directory_request_ = directory_ptr_.NewRequest(); From aae4cc505d97d1b09bdc929e76b7604c2df4fa27 Mon Sep 17 00:00:00 2001 From: Brandon Castellano Date: Tue, 26 Nov 2024 19:08:41 +0000 Subject: [PATCH 4/5] [fuchsia] Remove deprecation warning suppression These were added in #50358 as we were originally planning on removing the vfs::ComposedPseudoDir and vfs::LazyDir types from the SDK VFS. However, we have dropped the deprecation in https://fxrev.dev/1123733 and are supporting these at all current API levels again. --- .../fuchsia/dart_runner/dart_component_controller.cc | 7 +------ shell/platform/fuchsia/flutter/component_v2.cc | 5 ----- .../platform/fuchsia/runtime/dart/utils/vmservice_object.h | 5 ----- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc index 73fb080ec5eba..1b2f40bec4fcd 100644 --- a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc +++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc @@ -215,15 +215,10 @@ bool DartComponentController::CreateAndBindNamespace() { // That will prevent FL-175 for public directory fdio_service_connect_at(dart_outgoing_dir_ptr_.channel().get(), "svc", dart_public_dir.NewRequest().TakeChannel().release()); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - + auto composed_service_dir = std::make_unique(); composed_service_dir->set_fallback(std::move(dart_public_dir)); -#pragma clang diagnostic pop - // Clone and check if client is servicing the directory. dart_outgoing_dir_ptr_->Clone( fuchsia::io::OpenFlags::DESCRIBE | diff --git a/shell/platform/fuchsia/flutter/component_v2.cc b/shell/platform/fuchsia/flutter/component_v2.cc index 44db0f1f37c2c..12f7b3191e193 100644 --- a/shell/platform/fuchsia/flutter/component_v2.cc +++ b/shell/platform/fuchsia/flutter/component_v2.cc @@ -261,14 +261,9 @@ ComponentV2::ComponentV2( fdio_service_connect_at(directory_ptr_.channel().get(), "svc", request.release()); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - auto composed_service_dir = std::make_unique(); composed_service_dir->set_fallback(std::move(flutter_public_dir)); -#pragma clang diagnostic pop - // Clone and check if client is servicing the directory. directory_ptr_->Clone(fuchsia::io::OpenFlags::DESCRIBE | fuchsia::io::OpenFlags::CLONE_SAME_RIGHTS, diff --git a/shell/platform/fuchsia/runtime/dart/utils/vmservice_object.h b/shell/platform/fuchsia/runtime/dart/utils/vmservice_object.h index c02d609e51506..697922491a277 100644 --- a/shell/platform/fuchsia/runtime/dart/utils/vmservice_object.h +++ b/shell/platform/fuchsia/runtime/dart/utils/vmservice_object.h @@ -9,9 +9,6 @@ namespace dart_utils { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - class VMServiceObject : public vfs::LazyDir { public: static constexpr const char* kDirName = "DartVM"; @@ -24,8 +21,6 @@ class VMServiceObject : public vfs::LazyDir { std::string name) const override; }; -#pragma clang diagnostic pop - } // namespace dart_utils #endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_VMSERVICE_OBJECT_H_ From 30cb2bc3a20d7aaaa8b47d0fa9014dc220af6be5 Mon Sep 17 00:00:00 2001 From: Brandon Castellano Date: Tue, 26 Nov 2024 19:44:39 +0000 Subject: [PATCH 5/5] [fuchsia] Migrate away from Clone and open /svc with permissions This completes the migration as part of https://fxbug.dev/378924259 --- .../dart_runner/dart_component_controller.cc | 39 ++++++++++--------- .../platform/fuchsia/flutter/component_v2.cc | 36 ++++++++--------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc index 1b2f40bec4fcd..2060d81500dbd 100644 --- a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc +++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc @@ -210,33 +210,34 @@ bool DartComponentController::CreateAndBindNamespace() { dart_outgoing_dir_request_ = dart_outgoing_dir_ptr_.NewRequest(); fuchsia::io::DirectoryHandle dart_public_dir; - // TODO(anmittal): when fixing enumeration using new c++ vfs, make sure that - // flutter_public_dir is only accessed once we receive OnOpen Event. - // That will prevent FL-175 for public directory - fdio_service_connect_at(dart_outgoing_dir_ptr_.channel().get(), "svc", - dart_public_dir.NewRequest().TakeChannel().release()); - + { + auto request = dart_public_dir.NewRequest().TakeChannel(); + const zx_status_t status = + fdio_open3_at(dart_outgoing_dir_ptr_.channel().get(), "svc", + uint64_t{fuchsia::io::PERM_READABLE}, request.release()); + if (status != ZX_OK) { + FML_LOG(ERROR) << "Failed to open /svc in outgoing directory: " + << zx_status_get_string(status); + return false; + } + } + auto composed_service_dir = std::make_unique(); composed_service_dir->set_fallback(std::move(dart_public_dir)); - // Clone and check if client is servicing the directory. - dart_outgoing_dir_ptr_->Clone( - fuchsia::io::OpenFlags::DESCRIBE | - fuchsia::io::OpenFlags::CLONE_SAME_RIGHTS, - dart_outgoing_dir_ptr_to_check_on_open_.NewRequest()); + // Request an event from the directory to ensure it is servicing requests. + dart_outgoing_dir_ptr_->Open3( + ".", + fuchsia::io::Flags::PROTOCOL_NODE | + fuchsia::io::Flags::FLAG_SEND_REPRESENTATION, + {}, dart_outgoing_dir_ptr_to_check_on_open_.NewRequest().TakeChannel()); // Collect our standard set of directories. std::vector other_dirs = {"debug", "ctrl"}; - dart_outgoing_dir_ptr_to_check_on_open_.events().OnOpen = - [this, other_dirs](zx_status_t status, auto unused) { + dart_outgoing_dir_ptr_to_check_on_open_.events().OnRepresentation = + [this, other_dirs](auto unused) { dart_outgoing_dir_ptr_to_check_on_open_.Unbind(); - if (status != ZX_OK) { - FML_LOG(ERROR) << "could not bind out directory for dart component(" - << label_ << "): " << zx_status_get_string(status); - return; - } - // add other directories as RemoteDirs. for (auto& dir_str : other_dirs) { fuchsia::io::DirectoryHandle dir; diff --git a/shell/platform/fuchsia/flutter/component_v2.cc b/shell/platform/fuchsia/flutter/component_v2.cc index 12f7b3191e193..4191a89edbb10 100644 --- a/shell/platform/fuchsia/flutter/component_v2.cc +++ b/shell/platform/fuchsia/flutter/component_v2.cc @@ -254,20 +254,26 @@ ComponentV2::ComponentV2( directory_request_ = directory_ptr_.NewRequest(); fuchsia::io::DirectoryHandle flutter_public_dir; - // TODO(anmittal): when fixing enumeration using new c++ vfs, make sure that - // flutter_public_dir is only accessed once we receive OnOpen Event. - // That will prevent FL-175 for public directory - auto request = flutter_public_dir.NewRequest().TakeChannel(); - fdio_service_connect_at(directory_ptr_.channel().get(), "svc", - request.release()); + { + auto request = flutter_public_dir.NewRequest().TakeChannel(); + const zx_status_t status = + fdio_open3_at(directory_ptr_.channel().get(), "svc", + uint64_t{fuchsia::io::PERM_READABLE}, request.release()); + if (status != ZX_OK) { + FML_LOG(ERROR) << "Failed to open /svc in outgoing directory: " + << zx_status_get_string(status); + return; + } + } auto composed_service_dir = std::make_unique(); composed_service_dir->set_fallback(std::move(flutter_public_dir)); - // Clone and check if client is servicing the directory. - directory_ptr_->Clone(fuchsia::io::OpenFlags::DESCRIBE | - fuchsia::io::OpenFlags::CLONE_SAME_RIGHTS, - cloned_directory_ptr_.NewRequest()); + // Request an event from the directory to ensure it is servicing requests. + directory_ptr_->Open3(".", + fuchsia::io::Flags::PROTOCOL_NODE | + fuchsia::io::Flags::FLAG_SEND_REPRESENTATION, + {}, cloned_directory_ptr_.NewRequest().TakeChannel()); // Collect our standard set of directories along with directories that are // included in the cml file to expose. @@ -276,15 +282,9 @@ ComponentV2::ComponentV2( other_dirs.push_back(dir); } - cloned_directory_ptr_.events().OnOpen = [this, other_dirs](zx_status_t status, - auto unused) { + cloned_directory_ptr_.events().OnRepresentation = [this, + other_dirs](auto unused) { cloned_directory_ptr_.Unbind(); - if (status != ZX_OK) { - FML_LOG(ERROR) << "could not bind out directory for flutter component(" - << debug_label_ << "): " << zx_status_get_string(status); - return; - } - // add other directories as RemoteDirs. for (auto& dir_str : other_dirs) { fuchsia::io::DirectoryHandle dir;