Flutter Engine
 
Loading...
Searching...
No Matches
dart_runner::DartRunner Class Reference

#include <dart_runner.h>

Inheritance diagram for dart_runner::DartRunner:

Public Member Functions

 DartRunner (sys::ComponentContext *context)
 
 ~DartRunner () override
 
void handle_unknown_method (uint64_t ordinal, bool method_has_response) 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
207 dart::bin::BootstrapDartIo();
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
215 Dart_InitializeParams params = {};
216 params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION;
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 error = Dart_Initialize(&params);
232 if (error)
233 FML_LOG(FATAL) << "Dart_Initialize failed: " << error;
234}
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
const EmbeddedViewParams * params
const uint8_t uint32_t uint32_t GError ** error
#define FML_LOG(severity)
Definition logging.h:101
size_t ArraySize(T(&array)[SIZE])
Definition inlines.h:11

References dart_utils::MappedResource::address(), dart_utils::ArraySize(), error, FML_LOG, dart_utils::VMServiceObject::kPortDirName, dart_utils::MappedResource::LoadFromNamespace(), and params.

◆ ~DartRunner()

dart_runner::DartRunner::~DartRunner ( )
override

Definition at line 236 of file dart_runner.cc.

236 {
237 char* error = Dart_Cleanup();
238 if (error)
239 FML_LOG(FATAL) << "Dart_Cleanup failed: " << error;
240}

References error, and FML_LOG.

Member Function Documentation

◆ handle_unknown_method()

void dart_runner::DartRunner::handle_unknown_method ( uint64_t  ordinal,
bool  method_has_response 
)
override

Definition at line 276 of file dart_runner.cc.

277 {
278 FML_LOG(ERROR) << "Unknown method called on DartRunner. Ordinal: "
279 << ordinal;
280}

References FML_LOG.


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