mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add missing CL, fix targets for Fuchsia (flutter/engine#12338)
This commit is contained in:
parent
25d2d2a47a
commit
a8cfcfc78d
2
DEPS
2
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
|
||||
#
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <lib/fdio/directory.h>
|
||||
#include <lib/fdio/namespace.h>
|
||||
#include <lib/ui/scenic/cpp/view_token_pair.h>
|
||||
#include <lib/vfs/cpp/composed_service_dir.h>
|
||||
#include <lib/vfs/cpp/remote_dir.h>
|
||||
#include <lib/vfs/cpp/service.h>
|
||||
#include <sys/stat.h>
|
||||
@ -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<ServiceProviderDir>();
|
||||
service_provider_dir->set_fallback(std::move(flutter_public_dir));
|
||||
auto composed_service_dir = std::make_unique<vfs::ComposedServiceDir>();
|
||||
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<vfs::Service>(
|
||||
[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) {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 <lib/async/default.h>
|
||||
#include <lib/fdio/directory.h>
|
||||
#include <zircon/status.h>
|
||||
|
||||
namespace flutter_runner {
|
||||
|
||||
ServiceProviderDir::ServiceProviderDir() : root_(new vfs::PseudoDir()) {}
|
||||
|
||||
ServiceProviderDir::~ServiceProviderDir() {}
|
||||
|
||||
void ServiceProviderDir::set_fallback(
|
||||
fidl::InterfaceHandle<fuchsia::io::Directory> fallback_dir) {
|
||||
fallback_dir_ = fallback_dir.TakeChannel();
|
||||
}
|
||||
|
||||
void ServiceProviderDir::AddService(const std::string& service_name,
|
||||
std::unique_ptr<vfs::Service> 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<vfs::Service>(
|
||||
[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
|
||||
@ -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 <map>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <fuchsia/io/cpp/fidl.h>
|
||||
#include <fuchsia/sys/cpp/fidl.h>
|
||||
#include <lib/vfs/cpp/pseudo_dir.h>
|
||||
#include <lib/vfs/cpp/service.h>
|
||||
|
||||
#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<fuchsia::io::Directory> fallback_dir);
|
||||
|
||||
void AddService(const std::string& service_name,
|
||||
std::unique_ptr<vfs::Service> 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<vfs::PseudoDir> 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<std::string, std::unique_ptr<vfs::Service>>
|
||||
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_
|
||||
@ -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",
|
||||
]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user