From a8cfcfc78dbc3d64a34e1c854e6a523d55c24401 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 18 Sep 2019 15:06:50 -0700 Subject: [PATCH] Add missing CL, fix targets for Fuchsia (flutter/engine#12338) --- DEPS | 2 +- .../ci/licenses_golden/licenses_flutter | 2 - .../platform/fuchsia/dart_runner/BUILD.gn | 4 +- .../platform/fuchsia/flutter/component.cc | 10 +-- .../fuchsia/flutter/engine_flutter_runner.gni | 6 +- .../fuchsia/flutter/service_provider_dir.cc | 69 ------------------ .../fuchsia/flutter/service_provider_dir.h | 73 ------------------- .../fuchsia/runtime/dart/utils/BUILD.gn | 4 +- 8 files changed, 12 insertions(+), 158 deletions(-) delete mode 100644 engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.cc delete mode 100644 engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.h diff --git a/DEPS b/DEPS index 96872731cf4..d0997114e20 100644 --- a/DEPS +++ b/DEPS @@ -136,7 +136,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '3a215c622c53eeff4e1dd28b2a7e3b835f84d89e', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '25b164b5f49fe4592a8cd8d6cd08440522b36a75', # Fuchsia compatibility # diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index 67b13b31d95..970783583d2 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -958,8 +958,6 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_context.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_context.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/sample_unittests.cc -FILE: ../../../flutter/shell/platform/fuchsia/flutter/service_provider_dir.cc -FILE: ../../../flutter/shell/platform/fuchsia/flutter/service_provider_dir.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/session_connection.cc FILE: ../../../flutter/shell/platform/fuchsia/flutter/session_connection.h FILE: ../../../flutter/shell/platform/fuchsia/flutter/surface.cc diff --git a/engine/src/flutter/shell/platform/fuchsia/dart_runner/BUILD.gn b/engine/src/flutter/shell/platform/fuchsia/dart_runner/BUILD.gn index de37e317350..2b4ed499242 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart_runner/BUILD.gn +++ b/engine/src/flutter/shell/platform/fuchsia/dart_runner/BUILD.gn @@ -57,11 +57,11 @@ template("runner") { "$fuchsia_sdk_root/pkg:async-loop", "$fuchsia_sdk_root/pkg:async-loop-cpp", "$fuchsia_sdk_root/pkg:fidl_cpp", + "$fuchsia_sdk_root/pkg:sys_cpp", "$fuchsia_sdk_root/pkg:syslog", "$fuchsia_sdk_root/pkg:trace", "$fuchsia_sdk_root/pkg:trace-provider-so", - "$fuchsia_sdk_root/pkg/lib/sys/cpp", - "$fuchsia_sdk_root/pkg/lib/vfs/cpp", + "$fuchsia_sdk_root/pkg:vfs_cpp", "//third_party/tonic", ] + dart_deps + extra_deps } diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc index cda44979dc9..89dc0244670 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/component.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include "runtime/dart/utils/tempfs.h" #include "runtime/dart/utils/vmo.h" -#include "service_provider_dir.h" #include "task_observers.h" #include "task_runner_adapter.h" #include "thread.h" @@ -163,8 +163,8 @@ Application::Application( fdio_service_connect_at(directory_ptr_.channel().get(), "svc", request.release()); - auto service_provider_dir = std::make_unique(); - service_provider_dir->set_fallback(std::move(flutter_public_dir)); + 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::OPEN_FLAG_DESCRIBE | @@ -201,7 +201,7 @@ Application::Application( // All launch arguments have been read. Perform service binding and // final settings configuration. The next call will be to create a view // for this application. - service_provider_dir->AddService( + composed_service_dir->AddService( fuchsia::ui::app::ViewProvider::Name_, std::make_unique( [this](zx::channel channel, async_dispatcher_t* dispatcher) { @@ -210,7 +210,7 @@ Application::Application( std::move(channel))); })); - outgoing_dir_->AddEntry("svc", std::move(service_provider_dir)); + outgoing_dir_->AddEntry("svc", std::move(composed_service_dir)); // Setup the application controller binding. if (application_controller_request) { diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/engine_flutter_runner.gni b/engine/src/flutter/shell/platform/fuchsia/flutter/engine_flutter_runner.gni index 9b9aeeb568e..862db5ad770 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/engine_flutter_runner.gni +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/engine_flutter_runner.gni @@ -62,8 +62,6 @@ template("flutter_runner") { "runner.h", "runner_context.cc", "runner_context.h", - "service_provider_dir.cc", - "service_provider_dir.h", "session_connection.cc", "session_connection.h", "surface.cc", @@ -126,13 +124,13 @@ template("flutter_runner") { "$fuchsia_sdk_root/pkg:fdio", "$fuchsia_sdk_root/pkg:fidl_cpp", "$fuchsia_sdk_root/pkg:scenic_cpp", + "$fuchsia_sdk_root/pkg:sys_cpp", "$fuchsia_sdk_root/pkg:syslog", "$fuchsia_sdk_root/pkg:trace", "$fuchsia_sdk_root/pkg:trace-engine", "$fuchsia_sdk_root/pkg:trace-provider-so", + "$fuchsia_sdk_root/pkg:vfs_cpp", "$fuchsia_sdk_root/pkg:zx", - "$fuchsia_sdk_root/pkg/lib/sys/cpp", - "$fuchsia_sdk_root/pkg/lib/vfs/cpp", "//third_party/skia", "//third_party/tonic", ] + fuchsia_deps + flutter_deps + extra_deps diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.cc deleted file mode 100644 index c671a04ecef..00000000000 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "service_provider_dir.h" - -#include -#include -#include - -namespace flutter_runner { - -ServiceProviderDir::ServiceProviderDir() : root_(new vfs::PseudoDir()) {} - -ServiceProviderDir::~ServiceProviderDir() {} - -void ServiceProviderDir::set_fallback( - fidl::InterfaceHandle fallback_dir) { - fallback_dir_ = fallback_dir.TakeChannel(); -} - -void ServiceProviderDir::AddService(const std::string& service_name, - std::unique_ptr service) { - root_->AddEntry(service_name, std::move(service)); -} - -zx_status_t ServiceProviderDir::GetAttr( - fuchsia::io::NodeAttributes* out_attributes) const { - return root_->GetAttr(out_attributes); -} - -zx_status_t ServiceProviderDir::Readdir(uint64_t offset, - void* data, - uint64_t len, - uint64_t* out_offset, - uint64_t* out_actual) { - // TODO(anmittal): enumerate fallback_dir_ in future once we have simple - // implementation of fuchsia.io.Directory. - return root_->Readdir(offset, data, len, out_offset, out_actual); -} - -zx_status_t ServiceProviderDir::Lookup(const std::string& name, - vfs::Node** out) const { - zx_status_t status = root_->Lookup(name, out); - if (status == ZX_OK) { - return status; - } - if (fallback_dir_) { - auto entry = fallback_services_.find(name); - if (entry != fallback_services_.end()) { - *out = entry->second.get(); - } else { - auto service = std::make_unique( - [name = std::string(name.data(), name.length()), - dir = &fallback_dir_](zx::channel request, - async_dispatcher_t* dispatcher) { - fdio_service_connect_at(dir->get(), name.c_str(), - request.release()); - }); - *out = service.get(); - fallback_services_[name] = std::move(service); - } - } else { - return ZX_ERR_NOT_FOUND; - } - return ZX_OK; -} - -} // namespace flutter_runner diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.h b/engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.h deleted file mode 100644 index 0e26e6d165c..00000000000 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/service_provider_dir.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_SERVICE_PROVIDER_DIR_H_ -#define FLUTTER_SHELL_PLATFORM_FUCHSIA_SERVICE_PROVIDER_DIR_H_ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "lib/fidl/cpp/binding_set.h" - -namespace flutter_runner { - -// A directory-like object which dynamically creates Service nodes -// for any file lookup. It also exposes service provider interface. -// -// It supports enumeration for only first level of services. -class ServiceProviderDir : public vfs::Directory { - public: - ServiceProviderDir(); - ~ServiceProviderDir() override; - - void set_fallback(fidl::InterfaceHandle fallback_dir); - - void AddService(const std::string& service_name, - std::unique_ptr service); - - // - // Overridden from |vfs::Node|: - // - - zx_status_t Lookup(const std::string& name, vfs::Node** out_node) const final; - - zx_status_t GetAttr(fuchsia::io::NodeAttributes* out_attributes) const final; - - zx_status_t Readdir(uint64_t offset, - void* data, - uint64_t len, - uint64_t* out_offset, - uint64_t* out_actual) final; - - private: - // |root_| has all services offered by this provider (including those - // inherited from the parent, if any). - std::unique_ptr root_; - zx::channel fallback_dir_; - // The collection of services that have been looked up on the fallback - // directory. These services are just passthrough in the sense that they - // forward connection requests to the fallback directory. Since there is no - // good way in the present context to know whether these service entries - // actually match an existing service, and since the present object must own - // these entries, we keep them around until the present object gets deleted. - // Needs to be marked mutable so that it can be altered by the Lookup method. - mutable std::map> - fallback_services_; - - // Disallow copy and assignment. - ServiceProviderDir(const ServiceProviderDir&) = delete; - ServiceProviderDir& operator=(const ServiceProviderDir&) = delete; -}; - -} // namespace flutter_runner - -#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_SERVICE_PROVIDER_DIR_H_ diff --git a/engine/src/flutter/shell/platform/fuchsia/runtime/dart/utils/BUILD.gn b/engine/src/flutter/shell/platform/fuchsia/runtime/dart/utils/BUILD.gn index e6986989a55..b2324ec2553 100644 --- a/engine/src/flutter/shell/platform/fuchsia/runtime/dart/utils/BUILD.gn +++ b/engine/src/flutter/shell/platform/fuchsia/runtime/dart/utils/BUILD.gn @@ -35,8 +35,8 @@ source_set("utils") { "$fuchsia_sdk_root/pkg:memfs", "$fuchsia_sdk_root/pkg:syslog", "$fuchsia_sdk_root/pkg:zx", - "$fuchsia_sdk_root/pkg/lib/sys/cpp", - "$fuchsia_sdk_root/pkg/lib/vfs/cpp", + "$fuchsia_sdk_root/pkg:sys_cpp", + "$fuchsia_sdk_root/pkg:vfs_cpp", "//third_party/tonic", ]