Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart_runner::DartRunner Class Reference

#include <dart_runner.h>

Inheritance diagram for dart_runner::DartRunner:

Public Member Functions

 DartRunner (sys::ComponentContext *context)
 
 ~DartRunner () override
 

Detailed Description

Definition at line 17 of file dart_runner.h.

Constructor & Destructor Documentation

◆ DartRunner()

dart_runner::DartRunner::DartRunner ( sys::ComponentContext *  context)
explicit

Definition at line 189 of file dart_runner.cc.

189 : context_(context) {
190 context_->outgoing()
191 ->AddPublicService<fuchsia::component::runner::ComponentRunner>(
192 [this](fidl::InterfaceRequest<
193 fuchsia::component::runner::ComponentRunner> request) {
194 component_runner_bindings_.AddBinding(this, std::move(request));
195 });
196
197#if !defined(DART_PRODUCT)
198 // The VM service isolate uses the process-wide namespace. It writes the
199 // vm service protocol port under /tmp. The VMServiceObject exposes that
200 // port number to The Hub.
201 context_->outgoing()->debug_dir()->AddEntry(
203 std::make_unique<dart_utils::VMServiceObject>());
204
205#endif // !defined(DART_PRODUCT)
206
208
209 char* error =
210 Dart_SetVMFlags(dart_utils::ArraySize(kDartVMArgs), kDartVMArgs);
211 if (error) {
212 FML_LOG(FATAL) << "Dart_SetVMFlags failed: " << error;
213 }
214
217#if defined(AOT_RUNTIME)
218 params.vm_snapshot_data = ::_kDartVmSnapshotData;
219 params.vm_snapshot_instructions = ::_kDartVmSnapshotInstructions;
220#else
222 nullptr, "/pkg/data/vm_snapshot_data.bin", vm_snapshot_data_)) {
223 FML_LOG(FATAL) << "Failed to load vm snapshot data";
224 }
225 params.vm_snapshot_data = vm_snapshot_data_.address();
226#endif
227 params.create_group = IsolateGroupCreateCallback;
228 params.shutdown_isolate = IsolateShutdownCallback;
229 params.cleanup_group = IsolateGroupCleanupCallback;
230 params.entropy_source = EntropySource;
231#if !defined(DART_PRODUCT)
232 params.get_service_assets = GetVMServiceAssetsArchiveCallback;
233#endif
235 if (error)
236 FML_LOG(FATAL) << "Dart_Initialize failed: " << error;
237}
static bool LoadFromNamespace(fdio_ns_t *namespc, const std::string &path, MappedResource &resource, bool executable=false)
const uint8_t * address() const
static constexpr const char * kPortDirName
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION
Definition: dart_api.h:840
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Initialize(Dart_InitializeParams *params)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_SetVMFlags(int argc, const char **argv)
const EmbeddedViewParams * params
#define FATAL(error)
const uint8_t uint32_t uint32_t GError ** error
#define FML_LOG(severity)
Definition: logging.h:82
void BootstrapDartIo()
Dart_Handle GetVMServiceAssetsArchiveCallback()
size_t ArraySize(T(&array)[SIZE])
Definition: inlines.h:11

◆ ~DartRunner()

dart_runner::DartRunner::~DartRunner ( )
override

Definition at line 239 of file dart_runner.cc.

239 {
240 char* error = Dart_Cleanup();
241 if (error)
242 FML_LOG(FATAL) << "Dart_Cleanup failed: " << error;
243}
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Cleanup(void)

The documentation for this class was generated from the following files: