Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
system.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "system.h"
6
7#include <array>
8
9#include <fuchsia/io/cpp/fidl.h>
10#include <lib/fdio/directory.h>
11#include <lib/fdio/fd.h>
12#include <lib/fdio/io.h>
13#include <lib/fdio/limits.h>
14#include <lib/fdio/namespace.h>
15#include <lib/zx/channel.h>
16#include <sys/stat.h>
17#include <unistd.h>
18#include <zircon/process.h>
19#include <zircon/processargs.h>
20
21#include "flutter/fml/unique_fd.h"
24
25using tonic::ToDart;
26
27namespace zircon {
28namespace dart {
29
30namespace {
31
32constexpr char kGetSizeResult[] = "GetSizeResult";
33constexpr char kHandlePairResult[] = "HandlePairResult";
34constexpr char kHandleResult[] = "HandleResult";
35constexpr char kReadResult[] = "ReadResult";
36constexpr char kHandleInfo[] = "HandleInfo";
37constexpr char kReadEtcResult[] = "ReadEtcResult";
38constexpr char kWriteResult[] = "WriteResult";
39constexpr char kFromFileResult[] = "FromFileResult";
40constexpr char kMapResult[] = "MapResult";
41
42class ByteDataScope {
43 public:
44 explicit ByteDataScope(Dart_Handle dart_handle) : dart_handle_(dart_handle) {
45 Acquire();
46 }
47
48 explicit ByteDataScope(size_t size) {
49 dart_handle_ = Dart_NewTypedData(Dart_TypedData_kByteData, size);
51 Acquire();
52 FML_DCHECK(size == size_);
53 }
54
55 ~ByteDataScope() {
56 if (is_valid_) {
57 Release();
58 }
59 }
60
61 void* data() const { return data_; }
62 size_t size() const { return size_; }
63 Dart_Handle dart_handle() const { return dart_handle_; }
64 bool is_valid() const { return is_valid_; }
65
66 void Release() {
67 FML_DCHECK(is_valid_);
70 is_valid_ = false;
71 data_ = nullptr;
72 size_ = 0;
73 }
74
75 private:
76 void Acquire() {
77 FML_DCHECK(size_ == 0);
78 FML_DCHECK(data_ == nullptr);
79 FML_DCHECK(!is_valid_);
80
82 intptr_t size;
84 Dart_TypedDataAcquireData(dart_handle_, &type, &data_, &size);
85 is_valid_ = !tonic::CheckAndHandleError(result) &&
87 if (is_valid_) {
88 size_ = size;
89 } else {
90 size_ = 0;
91 }
92 }
93
94 Dart_Handle dart_handle_;
95 bool is_valid_ = false;
96 size_t size_ = 0;
97 void* data_ = nullptr;
98};
99
100Dart_Handle MakeHandleList(const std::vector<zx_handle_t>& in_handles) {
101 tonic::DartClassLibrary& class_library =
103 Dart_Handle handle_type = class_library.GetClass("zircon", "Handle");
105 handle_type, Handle::CreateInvalid(), in_handles.size());
106 if (Dart_IsError(list))
107 return list;
108 for (size_t i = 0; i < in_handles.size(); i++) {
110 Dart_ListSetAt(list, i, ToDart(Handle::Create(in_handles[i])));
111 if (Dart_IsError(result))
112 return result;
113 }
114 return list;
115}
116
117template <class... Args>
118Dart_Handle ConstructDartObject(const char* class_name, Args&&... args) {
119 tonic::DartClassLibrary& class_library =
122 Dart_HandleFromPersistent(class_library.GetClass("zircon", class_name));
124
125 const char* cstr;
127
128 std::array<Dart_Handle, sizeof...(Args)> args_array{
129 {std::forward<Args>(args)...}};
130 Dart_Handle object =
131 Dart_New(type, Dart_EmptyString(), sizeof...(Args), args_array.data());
133 return object;
134}
135
136Dart_Handle MakeHandleInfoList(
137 const std::vector<zx_handle_info_t>& in_handles) {
138 tonic::DartClassLibrary& class_library =
140 Dart_Handle handle_info_type = class_library.GetClass("zircon", kHandleInfo);
141 Dart_Handle empty_handle_info = ConstructDartObject(
142 kHandleInfo, ToDart(Handle::CreateInvalid()), ToDart(-1), ToDart(-1));
144 handle_info_type, empty_handle_info, in_handles.size());
145 if (Dart_IsError(list))
146 return list;
147 for (size_t i = 0; i < in_handles.size(); i++) {
148 Dart_Handle handle = ToDart(Handle::Create(in_handles[i].handle));
150 list, i,
151 ConstructDartObject(kHandleInfo, handle, ToDart(in_handles[i].type),
152 ToDart(in_handles[i].rights)));
153 if (Dart_IsError(result))
154 return result;
155 }
156 return list;
157}
158
159fdio_ns_t* GetNamespace() {
160 // Grab the fdio_ns_t* out of the isolate.
161 Dart_Handle zircon_lib = Dart_LookupLibrary(ToDart("dart:zircon"));
163 Dart_Handle namespace_type =
164 Dart_GetNonNullableType(zircon_lib, ToDart("_Namespace"), 0, nullptr);
165 FML_DCHECK(!tonic::CheckAndHandleError(namespace_type));
166 Dart_Handle namespace_field =
167 Dart_GetField(namespace_type, ToDart("_namespace"));
168 FML_DCHECK(!tonic::CheckAndHandleError(namespace_field));
169 uint64_t fdio_ns_ptr;
170 Dart_Handle result = Dart_IntegerToUint64(namespace_field, &fdio_ns_ptr);
172
173 return reinterpret_cast<fdio_ns_t*>(fdio_ns_ptr);
174}
175
176zx_status_t FdFromPath(const char* path, fml::UniqueFD& fd) {
177 fml::UniqueFD dir_fd(fdio_ns_opendir(GetNamespace()));
178 if (!dir_fd.is_valid()) {
179 // TODO: can we return errno?
180 return ZX_ERR_IO;
181 }
182 if (path != nullptr && *path == '/') {
183 path++;
184 }
185 int raw_fd;
186 if (zx_status_t status = fdio_open_fd_at(
187 dir_fd.get(), path,
188 static_cast<uint32_t>(fuchsia::io::OpenFlags::RIGHT_READABLE),
189 &raw_fd);
190 status != ZX_OK) {
191 return status;
192 }
193 fd.reset(raw_fd);
194 return ZX_OK;
195}
196
197} // namespace
198
200
202 zx_handle_t out0 = 0, out1 = 0;
203 zx_status_t status = zx_channel_create(options, &out0, &out1);
204 if (status != ZX_OK) {
205 return ConstructDartObject(kHandlePairResult, ToDart(status));
206 } else {
207 return ConstructDartObject(kHandlePairResult, ToDart(status),
208 ToDart(Handle::Create(out0)),
209 ToDart(Handle::Create(out1)));
210 }
211}
212
213zx_status_t System::ConnectToService(std::string path,
214 fml::RefPtr<Handle> channel) {
215 return fdio_ns_service_connect(GetNamespace(), path.c_str(),
216 channel->ReleaseHandle());
217}
218
220 fml::UniqueFD fd;
221 if (zx_status_t status = FdFromPath(path.c_str(), fd); status != ZX_OK) {
222 return ConstructDartObject(kHandleResult, ToDart(status));
223 }
224
225 zx::handle handle;
226 if (zx_status_t status =
227 fdio_fd_transfer(fd.release(), handle.reset_and_get_address());
228 status != ZX_OK) {
229 return ConstructDartObject(kHandleResult, ToDart(status));
230 }
231 zx_info_handle_basic_t info;
232 if (zx_status_t status = handle.get_info(ZX_INFO_HANDLE_BASIC, &info,
233 sizeof(info), nullptr, nullptr);
234 status != ZX_OK) {
235 return ConstructDartObject(kHandleResult, ToDart(status));
236 }
237 if (info.type != ZX_OBJ_TYPE_CHANNEL) {
238 return ConstructDartObject(kHandleResult, ToDart(ZX_ERR_WRONG_TYPE));
239 }
240
241 return ConstructDartObject(kHandleResult, ToDart(ZX_OK),
242 ToDart(Handle::Create(handle.release())));
243}
244
246 const tonic::DartByteData& data,
247 std::vector<Handle*> handles) {
248 if (!channel || !channel->is_valid()) {
249 data.Release();
250 return ZX_ERR_BAD_HANDLE;
251 }
252
253 std::vector<zx_handle_t> zx_handles;
254 for (Handle* handle : handles) {
255 zx_handles.push_back(handle->handle());
256 }
257
258 zx_status_t status = zx_channel_write(channel->handle(), 0, data.data(),
259 data.length_in_bytes(),
260 zx_handles.data(), zx_handles.size());
261 // Handles are always consumed.
262 for (Handle* handle : handles) {
263 handle->ReleaseHandle();
264 }
265
266 data.Release();
267 return status;
268}
269
271 fml::RefPtr<Handle> channel,
272 const tonic::DartByteData& data,
273 std::vector<HandleDisposition*> handle_dispositions) {
274 if (!channel || !channel->is_valid()) {
275 data.Release();
276 return ZX_ERR_BAD_HANDLE;
277 }
278
279 std::vector<zx_handle_disposition_t> zx_handle_dispositions;
280 for (HandleDisposition* handle : handle_dispositions) {
281 FML_DCHECK(handle->result() == ZX_OK);
282 zx_handle_dispositions.push_back({.operation = handle->operation(),
283 .handle = handle->handle()->handle(),
284 .type = handle->type(),
285 .rights = handle->rights(),
286 .result = ZX_OK});
287 }
288
289 zx_status_t status = zx_channel_write_etc(
290 channel->handle(), 0, data.data(), data.length_in_bytes(),
291 zx_handle_dispositions.data(), zx_handle_dispositions.size());
292
293 for (size_t i = 0; i < handle_dispositions.size(); ++i) {
294 handle_dispositions[i]->set_result(zx_handle_dispositions[i].result);
295
296 // Handles that are not copied (i.e. moved) are always consumed.
297 if (handle_dispositions[i]->operation() != ZX_HANDLE_OP_DUPLICATE) {
298 handle_dispositions[i]->handle()->ReleaseHandle();
299 }
300 }
301
302 data.Release();
303 return status;
304}
305
307 if (!channel || !channel->is_valid()) {
308 return ConstructDartObject(kReadResult, ToDart(ZX_ERR_BAD_HANDLE));
309 }
310
311 uint32_t actual_bytes = 0;
312 uint32_t actual_handles = 0;
313
314 // Query the size of the next message.
315 zx_status_t status = zx_channel_read(channel->handle(), 0, nullptr, nullptr,
316 0, 0, &actual_bytes, &actual_handles);
317 if (status != ZX_ERR_BUFFER_TOO_SMALL) {
318 // An empty message or an error.
319 return ConstructDartObject(kReadResult, ToDart(status));
320 }
321
322 // Allocate space for the bytes and handles.
323 ByteDataScope bytes(actual_bytes);
324 FML_DCHECK(bytes.is_valid());
325 std::vector<zx_handle_t> handles(actual_handles);
326
327 // Make the call to actually get the message.
328 status = zx_channel_read(channel->handle(), 0, bytes.data(), handles.data(),
329 bytes.size(), handles.size(), &actual_bytes,
330 &actual_handles);
331 FML_DCHECK(status != ZX_OK || bytes.size() == actual_bytes);
332
333 bytes.Release();
334
335 if (status == ZX_OK) {
336 FML_DCHECK(handles.size() == actual_handles);
337
338 // return a ReadResult object.
339 return ConstructDartObject(kReadResult, ToDart(status), bytes.dart_handle(),
340 ToDart(actual_bytes), MakeHandleList(handles));
341 } else {
342 return ConstructDartObject(kReadResult, ToDart(status));
343 }
344}
345
347 if (!channel || !channel->is_valid()) {
348 return ConstructDartObject(kReadEtcResult, ToDart(ZX_ERR_BAD_HANDLE));
349 }
350
351 uint32_t actual_bytes = 0;
352 uint32_t actual_handles = 0;
353
354 // Query the size of the next message.
355 zx_status_t status = zx_channel_read(channel->handle(), 0, nullptr, nullptr,
356 0, 0, &actual_bytes, &actual_handles);
357 if (status != ZX_ERR_BUFFER_TOO_SMALL) {
358 // An empty message or an error.
359 return ConstructDartObject(kReadEtcResult, ToDart(status));
360 }
361
362 // Allocate space for the bytes and handles.
363 ByteDataScope bytes(actual_bytes);
364 FML_DCHECK(bytes.is_valid());
365 std::vector<zx_handle_info_t> handles(actual_handles);
366
367 // Make the call to actually get the message.
368 status = zx_channel_read_etc(channel->handle(), 0, bytes.data(),
369 handles.data(), bytes.size(), handles.size(),
370 &actual_bytes, &actual_handles);
371 FML_DCHECK(status != ZX_OK || bytes.size() == actual_bytes);
372
373 bytes.Release();
374
375 if (status == ZX_OK) {
376 FML_DCHECK(handles.size() == actual_handles);
377
378 // return a ReadResult object.
379 return ConstructDartObject(kReadEtcResult, ToDart(status),
380 bytes.dart_handle(), ToDart(actual_bytes),
381 MakeHandleInfoList(handles));
382 } else {
383 return ConstructDartObject(kReadEtcResult, ToDart(status));
384 }
385}
386
388 zx_handle_t out0 = 0, out1 = 0;
389 zx_status_t status = zx_eventpair_create(0, &out0, &out1);
390 if (status != ZX_OK) {
391 return ConstructDartObject(kHandlePairResult, ToDart(status));
392 } else {
393 return ConstructDartObject(kHandlePairResult, ToDart(status),
394 ToDart(Handle::Create(out0)),
395 ToDart(Handle::Create(out1)));
396 }
397}
398
400 zx_handle_t out0 = 0, out1 = 0;
401 zx_status_t status = zx_socket_create(options, &out0, &out1);
402 if (status != ZX_OK) {
403 return ConstructDartObject(kHandlePairResult, ToDart(status));
404 } else {
405 return ConstructDartObject(kHandlePairResult, ToDart(status),
406 ToDart(Handle::Create(out0)),
407 ToDart(Handle::Create(out1)));
408 }
409}
410
412 const tonic::DartByteData& data,
413 int options) {
414 if (!socket || !socket->is_valid()) {
415 data.Release();
416 return ConstructDartObject(kWriteResult, ToDart(ZX_ERR_BAD_HANDLE));
417 }
418
419 size_t actual;
420 zx_status_t status = zx_socket_write(socket->handle(), options, data.data(),
421 data.length_in_bytes(), &actual);
422 data.Release();
423 return ConstructDartObject(kWriteResult, ToDart(status), ToDart(actual));
424}
425
427 if (!socket || !socket->is_valid()) {
428 return ConstructDartObject(kReadResult, ToDart(ZX_ERR_BAD_HANDLE));
429 }
430
431 ByteDataScope bytes(size);
432 size_t actual;
433 zx_status_t status =
434 zx_socket_read(socket->handle(), 0, bytes.data(), size, &actual);
435 bytes.Release();
436 if (status == ZX_OK) {
437 FML_DCHECK(actual <= size);
438 return ConstructDartObject(kReadResult, ToDart(status), bytes.dart_handle(),
439 ToDart(actual));
440 }
441
442 return ConstructDartObject(kReadResult, ToDart(status));
443}
444
445Dart_Handle System::VmoCreate(uint64_t size, uint32_t options) {
446 zx_handle_t vmo = ZX_HANDLE_INVALID;
447 zx_status_t status = zx_vmo_create(size, options, &vmo);
448 if (status != ZX_OK) {
449 return ConstructDartObject(kHandleResult, ToDart(status));
450 } else {
451 return ConstructDartObject(kHandleResult, ToDart(status),
452 ToDart(Handle::Create(vmo)));
453 }
454}
455
457 fml::UniqueFD fd;
458 if (zx_status_t status = FdFromPath(path.c_str(), fd); status != ZX_OK) {
459 return ConstructDartObject(kHandleResult, ToDart(status));
460 }
461
462 struct stat stat_struct;
463 if (fstat(fd.get(), &stat_struct) != 0) {
464 // TODO: can we return errno?
465 return ConstructDartObject(kFromFileResult, ToDart(ZX_ERR_IO));
466 }
467 zx::vmo vmo;
468 if (zx_status_t status =
469 fdio_get_vmo_clone(fd.get(), vmo.reset_and_get_address());
470 status != ZX_OK) {
471 return ConstructDartObject(kFromFileResult, ToDart(status));
472 }
473
474 return ConstructDartObject(kFromFileResult, ToDart(ZX_OK),
475 ToDart(Handle::Create(vmo.release())),
476 ToDart(stat_struct.st_size));
477}
478
480 if (!vmo || !vmo->is_valid()) {
481 return ConstructDartObject(kGetSizeResult, ToDart(ZX_ERR_BAD_HANDLE));
482 }
483
484 uint64_t size;
485 zx_status_t status = zx_vmo_get_size(vmo->handle(), &size);
486
487 return ConstructDartObject(kGetSizeResult, ToDart(status), ToDart(size));
488}
489
490zx_status_t System::VmoSetSize(fml::RefPtr<Handle> vmo, uint64_t size) {
491 if (!vmo || !vmo->is_valid()) {
492 return ZX_ERR_BAD_HANDLE;
493 }
494 return zx_vmo_set_size(vmo->handle(), size);
495}
496
498 uint64_t offset,
499 const tonic::DartByteData& data) {
500 if (!vmo || !vmo->is_valid()) {
501 data.Release();
502 return ZX_ERR_BAD_HANDLE;
503 }
504
505 zx_status_t status =
506 zx_vmo_write(vmo->handle(), data.data(), offset, data.length_in_bytes());
507
508 data.Release();
509 return status;
510}
511
513 uint64_t offset,
514 size_t size) {
515 if (!vmo || !vmo->is_valid()) {
516 return ConstructDartObject(kReadResult, ToDart(ZX_ERR_BAD_HANDLE));
517 }
518
519 // TODO: constrain size?
520 ByteDataScope bytes(size);
521 zx_status_t status = zx_vmo_read(vmo->handle(), bytes.data(), offset, size);
522 bytes.Release();
523 if (status == ZX_OK) {
524 return ConstructDartObject(kReadResult, ToDart(status), bytes.dart_handle(),
525 ToDart(size));
526 }
527 return ConstructDartObject(kReadResult, ToDart(status));
528}
529
531 SizedRegion(void* r, size_t s) : region(r), size(s) {}
532 void* region;
533 size_t size;
534};
535
536void System::VmoMapFinalizer(void* isolate_callback_data, void* peer) {
537 SizedRegion* r = reinterpret_cast<SizedRegion*>(peer);
538 zx_vmar_unmap(zx_vmar_root_self(), reinterpret_cast<uintptr_t>(r->region),
539 r->size);
540 delete r;
541}
542
544 if (!vmo || !vmo->is_valid())
545 return ConstructDartObject(kMapResult, ToDart(ZX_ERR_BAD_HANDLE));
546
547 uint64_t size;
548 zx_status_t status = zx_vmo_get_size(vmo->handle(), &size);
549 if (status != ZX_OK)
550 return ConstructDartObject(kMapResult, ToDart(status));
551
552 uintptr_t mapped_addr;
553 status = zx_vmar_map(zx_vmar_root_self(), ZX_VM_PERM_READ, 0, vmo->handle(),
554 0, size, &mapped_addr);
555 if (status != ZX_OK)
556 return ConstructDartObject(kMapResult, ToDart(status));
557
558 void* data = reinterpret_cast<void*>(mapped_addr);
560 static_cast<intptr_t>(size));
562
563 SizedRegion* r = new SizedRegion(data, size);
564 Dart_NewFinalizableHandle(object, reinterpret_cast<void*>(r),
565 static_cast<intptr_t>(size) + sizeof(*r),
566 System::VmoMapFinalizer);
567
568 return ConstructDartObject(kMapResult, ToDart(ZX_OK), object);
569}
570
572 return zx_clock_get_monotonic();
573}
574
575// clang-format: off
576
577#define FOR_EACH_STATIC_BINDING(V) \
578 V(System, ChannelCreate) \
579 V(System, ChannelFromFile) \
580 V(System, ChannelWrite) \
581 V(System, ChannelWriteEtc) \
582 V(System, ChannelQueryAndRead) \
583 V(System, ChannelQueryAndReadEtc) \
584 V(System, EventpairCreate) \
585 V(System, ConnectToService) \
586 V(System, SocketCreate) \
587 V(System, SocketWrite) \
588 V(System, SocketRead) \
589 V(System, VmoCreate) \
590 V(System, VmoFromFile) \
591 V(System, VmoGetSize) \
592 V(System, VmoSetSize) \
593 V(System, VmoRead) \
594 V(System, VmoWrite) \
595 V(System, VmoMap) \
596 V(System, ClockGetMonotonic)
597
598// clang-format: on
599
600// Tonic is missing a comma.
601#define DART_REGISTER_NATIVE_STATIC_(CLASS, METHOD) \
602 DART_REGISTER_NATIVE_STATIC(CLASS, METHOD),
603
605
606void System::RegisterNatives(tonic::DartLibraryNatives* natives) {
608}
609
610} // namespace dart
611} // namespace zircon
const char * options
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
Definition SkMD5.cpp:144
static bool is_valid(SkISize dim)
void reset(const T &value=Traits::InvalidValue())
const T & get() const
Dart_PersistentHandle GetClass(const DartWrapperInfo &info)
static DartState * Current()
Definition dart_state.cc:56
DartClassLibrary & class_library()
Definition dart_state.h:60
static Dart_Handle CreateInvalid()
Definition handle.cc:32
static fml::RefPtr< Handle > Create(zx_handle_t handle)
Definition handle.cc:28
static Dart_Handle ChannelCreate(uint32_t options)
Definition system.cc:201
static Dart_Handle SocketCreate(uint32_t options)
Definition system.cc:399
static Dart_Handle VmoCreate(uint64_t size, uint32_t options)
Definition system.cc:445
static Dart_Handle VmoMap(fml::RefPtr< Handle > vmo)
Definition system.cc:543
static zx_status_t VmoWrite(fml::RefPtr< Handle > vmo, uint64_t offset, const tonic::DartByteData &data)
Definition system.cc:497
static Dart_Handle SocketWrite(fml::RefPtr< Handle > socket, const tonic::DartByteData &data, int options)
Definition system.cc:411
static Dart_Handle VmoRead(fml::RefPtr< Handle > vmo, uint64_t offset, size_t size)
Definition system.cc:512
static uint64_t ClockGetMonotonic()
Definition system.cc:571
static Dart_Handle VmoFromFile(std::string path)
Definition system.cc:456
static zx_status_t ChannelWriteEtc(fml::RefPtr< Handle > channel, const tonic::DartByteData &data, std::vector< HandleDisposition * > handle_dispositions)
Definition system.cc:270
static zx_status_t ConnectToService(std::string path, fml::RefPtr< Handle > channel)
Definition system.cc:213
static Dart_Handle ChannelQueryAndReadEtc(fml::RefPtr< Handle > channel)
Definition system.cc:346
static Dart_Handle EventpairCreate(uint32_t options)
Definition system.cc:387
static Dart_Handle ChannelFromFile(std::string path)
Definition system.cc:219
static zx_status_t ChannelWrite(fml::RefPtr< Handle > channel, const tonic::DartByteData &data, std::vector< Handle * > handles)
Definition system.cc:245
static Dart_Handle VmoGetSize(fml::RefPtr< Handle > vmo)
Definition system.cc:479
static Dart_Handle ChannelQueryAndRead(fml::RefPtr< Handle > channel)
Definition system.cc:306
static zx_status_t VmoSetSize(fml::RefPtr< Handle > vmo, uint64_t size)
Definition system.cc:490
static Dart_Handle SocketRead(fml::RefPtr< Handle > socket, size_t size)
Definition system.cc:426
DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object)
DART_EXPORT Dart_Handle Dart_GetNonNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, void *data, intptr_t length)
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled(Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_EmptyString(void)
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
Dart_TypedData_Type
Definition dart_api.h:2603
@ Dart_TypedData_kUint8
Definition dart_api.h:2606
@ Dart_TypedData_kByteData
Definition dart_api.h:2604
DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str, const char **cstr)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer, uint64_t *value)
#define DART_NATIVE_CALLBACK_STATIC(CLASS, METHOD)
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
struct MyStruct s
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GAsyncResult * result
#define FML_DCHECK(condition)
Definition logging.h:103
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259
Dart_Handle ToDart(const T &object)
bool CheckAndHandleError(Dart_Handle handle)
Definition dart_error.cc:33
#define FOR_EACH_STATIC_BINDING(V)
Definition handle.cc:112
#define DART_REGISTER_NATIVE_STATIC_(CLASS, METHOD)
Definition handle.cc:126
Point offset
SizedRegion(void *r, size_t s)
Definition system.cc:531