5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_DART_COMPONENT_CONTROLLER_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_DART_COMPONENT_CONTROLLER_H_
8#include <dart/test/cpp/fidl.h>
9#include <fuchsia/component/runner/cpp/fidl.h>
10#include <lib/async-loop/cpp/loop.h>
11#include <lib/async/cpp/wait.h>
12#include <lib/fdio/namespace.h>
13#include <lib/fidl/cpp/binding.h>
14#include <lib/fidl/cpp/binding_set.h>
15#include <lib/fidl/cpp/string.h>
16#include <lib/sys/cpp/component_context.h>
17#include <lib/sys/cpp/service_directory.h>
18#include <lib/vfs/cpp/pseudo_dir.h>
19#include <lib/zx/timer.h>
24#include "third_party/dart/runtime/include/dart_api.h"
31 public fuchsia::component::runner::ComponentController {
34 fuchsia::component::runner::ComponentStartInfo start_info,
35 std::shared_ptr<sys::ServiceDirectory> runner_incoming_services,
36 fidl::InterfaceRequest<fuchsia::component::runner::ComponentController>
58 bool CreateAndBindNamespace();
60 bool SetUpFromKernel();
61 bool SetUpFromAppSnapshot();
67 void EchoString(fidl::StringPtr
value, EchoStringCallback
callback)
override;
75 void OnIdleTimer(async_dispatcher_t* dispatcher,
76 async::WaitBase* wait,
78 const zx_packet_signal* signal);
82 std::unique_ptr<async::Loop> loop_;
86 std::string data_path_;
87 std::shared_ptr<sys::ServiceDirectory> runner_incoming_services_;
88 std::unique_ptr<sys::ComponentContext> context_;
89 std::unique_ptr<vfs::PseudoDir> dart_outgoing_dir_;
90 fuchsia::io::DirectoryPtr dart_outgoing_dir_ptr_;
91 fidl::InterfaceRequest<fuchsia::io::Directory> dart_outgoing_dir_request_;
92 fuchsia::io::NodePtr dart_outgoing_dir_ptr_to_check_on_open_;
94 fuchsia::component::runner::ComponentStartInfo start_info_;
95 fidl::Binding<fuchsia::component::runner::ComponentController> binding_;
96 fidl::BindingSet<dart::test::Echo> echo_binding_;
98 fdio_ns_t* namespace_ =
nullptr;
105 std::vector<dart_utils::MappedResource> kernel_peices_;
108 int32_t return_code_ = 0;
111 zx::timer idle_timer_;
113 &DartComponentController::OnIdleTimer>
Starts a Dart component written in CFv2.
DartComponentController(fuchsia::component::runner::ComponentStartInfo start_info, std::shared_ptr< sys::ServiceDirectory > runner_incoming_services, fidl::InterfaceRequest< fuchsia::component::runner::ComponentController > controller)
~DartComponentController() override
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t * isolate_snapshot_data
const uint8_t * isolate_snapshot_instructions
static void Echo(Thread *thread, JSONStream *js)
static double time(int loops, Benchmark *bench, Target *target)