Flutter Engine
The Flutter Engine
dart_converter.h
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#ifndef LIB_CONVERTER_TONIC_DART_CONVERTER_H_
6#define LIB_CONVERTER_TONIC_DART_CONVERTER_H_
7
8#include <string>
9#include <type_traits>
10#include <vector>
11
12#include "third_party/dart/runtime/include/dart_api.h"
13#include "tonic/common/macros.h"
15
16namespace tonic {
17
18// DartConvert converts types back and forth from Sky to Dart. The template
19// parameter |T| determines what kind of type conversion to perform.
20template <typename T, typename Enable = void>
21struct DartConverter {};
22
23// This is to work around the fact that typedefs do not create new types. If you
24// have a typedef, and want it to use a different converter, specialize this
25// template and override the types here.
26// Ex:
27// typedef int ColorType; // Want to use a different converter.
28// class ColorConverterType {}; // Dummy type.
29// template<> struct DartConvertType<ColorConverterType> {
30// using ConverterType = ColorConverterType;
31// using ValueType = ColorType;
32// };
33template <typename T>
36 using ValueType = T;
37};
38
39template <>
40struct DartConverter<void> {
41 using FfiType = void;
42 static constexpr const char* kFfiRepresentation = "Void";
43 static constexpr const char* kDartRepresentation = "void";
44 static constexpr bool kAllowedInLeafCall = true;
45 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
46 static const char* GetDartRepresentation() { return kDartRepresentation; }
47 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
48};
49
50////////////////////////////////////////////////////////////////////////////////
51// Boolean
52
53template <>
54struct DartConverter<bool> {
55 using NativeType = bool;
56 using FfiType = bool;
57 static constexpr const char* kFfiRepresentation = "Bool";
58 static constexpr const char* kDartRepresentation = "bool";
59 static constexpr bool kAllowedInLeafCall = true;
60
61 static Dart_Handle ToDart(NativeType val) { return Dart_NewBoolean(val); }
62
63 static void SetReturnValue(Dart_NativeArguments args, bool val) {
65 }
66
68 bool result = 0;
69 Dart_BooleanValue(handle, &result);
70 return result;
71 }
72
74 int index,
75 Dart_Handle& exception) {
76 bool result = false;
78 return result;
79 }
80
81 static NativeType FromFfi(FfiType val) { return val; }
82 static FfiType ToFfi(NativeType val) { return val; }
83 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
84 static const char* GetDartRepresentation() { return kDartRepresentation; }
85 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
86};
87
88////////////////////////////////////////////////////////////////////////////////
89// Numbers
90
91template <typename T>
93 using FfiType = T;
94 static constexpr const char* kDartRepresentation = "int";
95 static constexpr bool kAllowedInLeafCall = true;
96
97 static Dart_Handle ToDart(T val) { return Dart_NewInteger(val); }
98
101 }
102
103 static T FromDart(Dart_Handle handle) {
104 int64_t result = 0;
105 Dart_IntegerToInt64(handle, &result);
106 return static_cast<T>(result);
107 }
108
110 int index,
111 Dart_Handle& exception) {
112 int64_t result = 0;
114 return static_cast<T>(result);
115 }
116 static T FromFfi(FfiType val) { return val; }
117 static FfiType ToFfi(T val) { return val; }
118 static const char* GetDartRepresentation() { return kDartRepresentation; }
119 // Note: Returns the correct bit-width for the host architecture.
120 static const char* GetFfiRepresentation() {
121 if (sizeof(T) == 4) {
122 if (std::is_signed<T>()) {
123 return "Int32";
124 }
125 return "Uint32";
126 }
127 TONIC_DCHECK(sizeof(T) == 8);
128 if (std::is_signed<T>()) {
129 return "Int64";
130 }
131 return "Uint64";
132 }
133 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
134};
135
136template <>
137struct DartConverter<int> : public DartConverterInteger<int> {};
138
139template <>
140struct DartConverter<long int> : public DartConverterInteger<long int> {};
141
142template <>
143struct DartConverter<unsigned> : public DartConverterInteger<unsigned> {};
144
145template <>
146struct DartConverter<long long> : public DartConverterInteger<long long> {};
147
148template <>
149struct DartConverter<unsigned long>
150 : public DartConverterInteger<unsigned long> {};
151
152template <>
153struct DartConverter<unsigned long long> {
154 using FfiType = unsigned long long;
155 static constexpr const char* kFfiRepresentation = "Uint64";
156 static constexpr const char* kDartRepresentation = "int";
157 static constexpr bool kAllowedInLeafCall = true;
158
159 // TODO(abarth): The Dart VM API doesn't yet have an entry-point for
160 // an unsigned 64-bit type. We will need to add a Dart API for
161 // constructing an integer from uint64_t.
162 //
163 // (In the meantime, we have asserts below to check that we're never
164 // converting values that have the 64th bit set.)
165
166 static Dart_Handle ToDart(unsigned long long val) {
167 TONIC_DCHECK(val <= 0x7fffffffffffffffLL);
168 return Dart_NewInteger(static_cast<int64_t>(val));
169 }
170
172 unsigned long long val) {
173 TONIC_DCHECK(val <= 0x7fffffffffffffffLL);
175 }
176
177 static unsigned long long FromDart(Dart_Handle handle) {
178 int64_t result = 0;
179 Dart_IntegerToInt64(handle, &result);
180 return result;
181 }
182
183 static unsigned long long FromArguments(Dart_NativeArguments args,
184 int index,
185 Dart_Handle& exception) {
186 int64_t result = 0;
188 return result;
189 }
190
191 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
192 static const char* GetDartRepresentation() { return kDartRepresentation; }
193 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
194 static FfiType FromFfi(FfiType val) {
195 TONIC_DCHECK(val <= 0x7fffffffffffffffLL);
196 return val;
197 }
198 // FFI does a bitwise conversion from uint64_t in C to int64 in Dart.
199 static FfiType ToFfi(FfiType val) {
200 TONIC_DCHECK(val <= 0x7fffffffffffffffLL);
201 return val;
202 }
203};
204
205// There is intentionally no DartConverter<float>, to avoid UB when Dart code
206// gives us a double that is greater than the max float or less than -max float.
207template <>
208struct DartConverter<double> {
209 using FfiType = double;
210 static constexpr const char* kFfiRepresentation = "Double";
211 static constexpr const char* kDartRepresentation = "double";
212 static constexpr bool kAllowedInLeafCall = true;
213
214 static Dart_Handle ToDart(double val) { return Dart_NewDouble(val); }
215
216 static void SetReturnValue(Dart_NativeArguments args, double val) {
218 }
219
220 static double FromDart(Dart_Handle handle) {
221 double result = 0;
222 Dart_DoubleValue(handle, &result);
223 return result;
224 }
225
227 int index,
228 Dart_Handle& exception) {
229 double result = 0;
231 return result;
232 }
233
234 static double FromFfi(FfiType val) { return val; }
235 static FfiType ToFfi(double val) { return val; }
236 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
237
238 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
239 static const char* GetDartRepresentation() { return kDartRepresentation; }
240};
241
242////////////////////////////////////////////////////////////////////////////////
243// Enum Classes
244
245template <typename T>
246struct DartConverter<T, typename std::enable_if<std::is_enum<T>::value>::type> {
247 using FfiType = int32_t;
248 static constexpr const char* kFfiRepresentation = "Int32";
249 static constexpr const char* kDartRepresentation = "int";
250 static constexpr bool kAllowedInLeafCall = true;
251
252 static Dart_Handle ToDart(T val) {
253 return Dart_NewInteger(
254 static_cast<typename std::underlying_type<T>::type>(val));
255 }
256
259 args, static_cast<typename std::underlying_type<T>::type>(val));
260 }
261
262 static T FromDart(Dart_Handle handle) {
263 int64_t result = 0;
264 Dart_IntegerToInt64(handle, &result);
265 return static_cast<T>(result);
266 }
267
269 int index,
270 Dart_Handle& exception) {
271 int64_t result = 0;
273 return static_cast<T>(result);
274 }
275
276 static T FromFfi(FfiType val) { return static_cast<T>(val); }
277 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
278 static const char* GetDartRepresentation() { return kDartRepresentation; }
279 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
280};
281
282////////////////////////////////////////////////////////////////////////////////
283// Strings
284
285template <>
286struct DartConverter<std::string> {
287 using NativeType = std::string;
289 static constexpr const char* kFfiRepresentation = "Handle";
290 static constexpr const char* kDartRepresentation = "String";
291 static constexpr bool kAllowedInLeafCall = false;
292
293 static Dart_Handle ToDart(const NativeType& val) {
294 return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(val.data()),
295 val.length());
296 }
297
300 }
301
303 if (Dart_IsNull(handle)) {
304 return std::string();
305 }
306 uint8_t* data = nullptr;
307 intptr_t length = 0;
308 if (Dart_IsError(Dart_StringToUTF8(handle, &data, &length)))
309 return std::string();
310 return std::string(reinterpret_cast<char*>(data), length);
311 }
312
314 int index,
315 Dart_Handle& exception) {
316 return FromDart(Dart_GetNativeArgument(args, index));
317 }
318
319 static NativeType FromFfi(FfiType val) { return FromDart(val); }
320 static FfiType ToFfi(NativeType val) { return ToDart(val); }
321 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
322 static const char* GetDartRepresentation() { return kDartRepresentation; }
323 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
324};
325
326template <>
327struct DartConverter<std::u16string> {
328 using NativeType = std::u16string;
330 static constexpr const char* kFfiRepresentation = "Handle";
331 static constexpr const char* kDartRepresentation = "String";
332 static constexpr bool kAllowedInLeafCall = false;
333
334 static Dart_Handle ToDart(const NativeType& val) {
336 reinterpret_cast<const uint16_t*>(val.data()), val.length());
337 }
338
341 }
342
344 if (Dart_IsNull(handle)) {
345 return std::u16string();
346 }
347 intptr_t length = 0;
348 Dart_StringLength(handle, &length);
349 std::vector<uint16_t> data(length);
350 Dart_StringToUTF16(handle, data.data(), &length);
351 return std::u16string(reinterpret_cast<char16_t*>(data.data()), length);
352 }
353
355 int index,
356 Dart_Handle& exception) {
357 return FromDart(Dart_GetNativeArgument(args, index));
358 }
359
360 static NativeType FromFfi(FfiType val) { return FromDart(val); }
361 static FfiType ToFfi(NativeType val) { return ToDart(val); }
362 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
363 static const char* GetDartRepresentation() { return kDartRepresentation; }
364 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
365};
366
367template <>
368struct DartConverter<const char*> {
369 static Dart_Handle ToDart(const char* val) {
370 return Dart_NewStringFromCString(val);
371 }
372
373 static void SetReturnValue(Dart_NativeArguments args, const char* val) {
375 }
376
377 static const char* FromDart(Dart_Handle handle) {
378 if (Dart_IsNull(handle)) {
379 return nullptr;
380 }
381 const char* result = nullptr;
383 return result;
384 }
385
387 int index,
388 Dart_Handle& exception) {
389 return FromDart(Dart_GetNativeArgument(args, index));
390 }
391};
392
393////////////////////////////////////////////////////////////////////////////////
394// Collections
395
396inline Dart_Handle LookupNonNullableType(const std::string& library_name,
397 const std::string& type_name) {
398 auto library =
400 if (CheckAndHandleError(library)) {
401 return library;
402 }
403 auto type_string = DartConverter<std::string>::ToDart(type_name);
404 if (CheckAndHandleError(type_string)) {
405 return type_string;
406 }
407 auto type = Dart_GetNonNullableType(library, type_string, 0, nullptr);
409 return type;
410 }
411 return type;
412}
413
414template <typename T,
417 return LookupNonNullableType("dart:core", "String");
418}
419
422 return LookupNonNullableType("dart:core", "int");
423}
424
425template <typename T,
428 return LookupNonNullableType("dart:core", "double");
429}
430
431template <typename T>
433 Dart_Handle type_handle_or_null = ::Dart_Null()) {
436 } else if constexpr (std::is_integral<T>::value) {
438 } else if constexpr (std::is_floating_point<T>::value) {
440 } else {
441 auto object = ::Dart_New(type_handle_or_null, ::Dart_Null(), 0, nullptr);
442 CheckAndHandleError(object);
443 return object;
444 }
446}
447
448template <typename T, typename Enable = void>
450 static Dart_Handle NewList(Dart_Handle type_handle, intptr_t length) {
451 bool is_nullable = false;
452 auto is_nullable_handle = ::Dart_IsNullableType(type_handle, &is_nullable);
453 if (CheckAndHandleError(is_nullable_handle)) {
454 return is_nullable_handle;
455 }
456 if (is_nullable) {
457 auto list = ::Dart_NewListOfType(type_handle, length);
459 return list;
460 } else {
461 auto sentinel = CreateZeroInitializedDartObject<T>(type_handle);
462 if (CheckAndHandleError(sentinel)) {
463 return sentinel;
464 }
465 auto list = ::Dart_NewListOfTypeFilled(type_handle, sentinel, length);
467 return list;
468 }
470 }
471};
472
473template <typename T>
474struct DartConverter<std::vector<T>> {
476 static constexpr const char* kFfiRepresentation = "Handle";
477 static constexpr const char* kDartRepresentation = "List";
478 static constexpr bool kAllowedInLeafCall = false;
479
482
483 static Dart_Handle ToDart(const std::vector<ValueType>& val) {
485 ToDartTypeHandle<ValueType>(), val.size());
486 if (Dart_IsError(list))
487 return list;
488 for (size_t i = 0; i < val.size(); i++) {
491 if (Dart_IsError(result))
492 return result;
493 }
494 return list;
495 }
496
498 const std::vector<ValueType>& val) {
500 }
501
502 static std::vector<ValueType> FromDart(Dart_Handle handle) {
503 std::vector<ValueType> result;
504
505 if (!Dart_IsList(handle))
506 return result;
507
508 intptr_t length = 0;
509 Dart_ListLength(handle, &length);
510
511 if (length == 0)
512 return result;
513
514 result.reserve(length);
515
516 std::vector<Dart_Handle> items(length);
517 Dart_Handle items_result =
518 Dart_ListGetRange(handle, 0, length, items.data());
519 TONIC_DCHECK(!Dart_IsError(items_result));
520
521 for (intptr_t i = 0; i < length; ++i) {
522 TONIC_DCHECK(items[i]);
524 }
525 return result;
526 }
527
528 static std::vector<ValueType> FromArguments(Dart_NativeArguments args,
529 int index,
530 Dart_Handle& exception) {
531 return FromDart(Dart_GetNativeArgument(args, index));
532 }
533
534 static std::vector<ValueType> FromFfi(FfiType val) { return FromDart(val); }
535 static FfiType ToFfi(std::vector<ValueType> val) { return ToDart(val); }
536 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
537 static const char* GetDartRepresentation() { return kDartRepresentation; }
538 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
539};
540
541////////////////////////////////////////////////////////////////////////////////
542// Dart_Handle
543
544template <>
548 static constexpr const char* kFfiRepresentation = "Handle";
549 static constexpr const char* kDartRepresentation = "Object";
550 static constexpr bool kAllowedInLeafCall = false;
551
552 static Dart_Handle ToDart(NativeType val) { return val; }
553
556 }
557
558 static NativeType FromDart(Dart_Handle handle) { return handle; }
559
561 int index,
562 Dart_Handle& exception) {
565 return result;
566 }
567
568 static NativeType FromFfi(FfiType val) { return val; }
569 static FfiType ToFfi(NativeType val) { return val; }
570 static const char* GetFfiRepresentation() { return kFfiRepresentation; }
571 static const char* GetDartRepresentation() { return kDartRepresentation; }
572 static bool AllowedInLeafCall() { return kAllowedInLeafCall; }
573};
574
575////////////////////////////////////////////////////////////////////////////////
576// Convenience wrappers using type inference
577
578template <typename T>
579Dart_Handle ToDart(const T& object) {
580 return DartConverter<T>::ToDart(object);
581}
582
583////////////////////////////////////////////////////////////////////////////////
584// std::string support
585
586inline Dart_Handle StdStringToDart(const std::string& val) {
588}
589
590inline std::string StdStringFromDart(Dart_Handle handle) {
592}
593
594// Alias Dart_NewStringFromCString for less typing.
595inline Dart_Handle ToDart(const char* val) {
596 return Dart_NewStringFromCString(val);
597}
598
599} // namespace tonic
600
601#endif // LIB_CONVERTER_TONIC_DART_CONVERTER_H_
GLenum type
DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str, uint16_t *utf16_array, intptr_t *length)
DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t *length)
DART_EXPORT Dart_Handle Dart_NewDouble(double value)
DART_EXPORT void Dart_SetIntegerReturnValue(Dart_NativeArguments args, int64_t retval)
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_Handle Dart_IsNullableType(Dart_Handle type, bool *result)
DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, intptr_t offset, intptr_t length, Dart_Handle *result)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, int64_t *value)
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 void Dart_SetDoubleReturnValue(Dart_NativeArguments args, double retval)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_EmptyString(void)
DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value)
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
struct _Dart_NativeArguments * Dart_NativeArguments
Definition: dart_api.h:3019
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_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, int index, int64_t *value)
DART_EXPORT Dart_Handle Dart_Null(void)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *length)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str, const char **cstr)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, double *value)
DART_EXPORT Dart_Handle Dart_NewBoolean(bool value)
DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, bool retval)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t *utf16_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_NewListOfType(Dart_Handle element_type, intptr_t length)
DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool *value)
DART_EXPORT bool Dart_IsList(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument(Dart_NativeArguments args, int index, double *value)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args, int index, bool *value)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint8_t value
GAsyncResult * result
size_t length
Definition: ref_ptr.h:256
Dart_Handle LookupNonNullableType(const std::string &library_name, const std::string &type_name)
Dart_Handle StdStringToDart(const std::string &val)
Dart_Handle ToDartTypeHandle()
Dart_Handle ToDart(const T &object)
Dart_Handle ToDart(const char *val)
bool CheckAndHandleError(Dart_Handle handle)
Definition: dart_error.cc:33
std::string StdStringFromDart(Dart_Handle handle)
Dart_Handle CreateZeroInitializedDartObject(Dart_Handle type_handle_or_null=::Dart_Null())
#define T
Definition: precompiler.cc:65
static Dart_Handle ToDart(T val)
static const char * GetFfiRepresentation()
static constexpr const char * kDartRepresentation
static void SetReturnValue(Dart_NativeArguments args, T val)
static T FromFfi(FfiType val)
static const char * GetDartRepresentation()
static constexpr bool kAllowedInLeafCall
static T FromDart(Dart_Handle handle)
static FfiType ToFfi(T val)
static T FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static NativeType FromFfi(FfiType val)
static FfiType ToFfi(NativeType val)
static Dart_Handle ToDart(NativeType val)
static const char * GetDartRepresentation()
static const char * GetFfiRepresentation()
static NativeType FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static NativeType FromDart(Dart_Handle handle)
static void SetReturnValue(Dart_NativeArguments args, Dart_Handle val)
static T FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static void SetReturnValue(Dart_NativeArguments args, bool val)
static FfiType ToFfi(NativeType val)
static Dart_Handle ToDart(NativeType val)
static const char * GetFfiRepresentation()
static const char * GetDartRepresentation()
static NativeType FromDart(Dart_Handle handle)
static NativeType FromFfi(FfiType val)
static NativeType FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static const char * FromDart(Dart_Handle handle)
static void SetReturnValue(Dart_NativeArguments args, const char *val)
static const char * FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static Dart_Handle ToDart(const char *val)
static FfiType ToFfi(double val)
static void SetReturnValue(Dart_NativeArguments args, double val)
static double FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static const char * GetFfiRepresentation()
static Dart_Handle ToDart(double val)
static double FromFfi(FfiType val)
static double FromDart(Dart_Handle handle)
static const char * GetDartRepresentation()
static FfiType ToFfi(NativeType val)
static const char * GetDartRepresentation()
static const char * GetFfiRepresentation()
static Dart_Handle ToDart(const NativeType &val)
static NativeType FromDart(Dart_Handle handle)
static NativeType FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static NativeType FromFfi(FfiType val)
static void SetReturnValue(Dart_NativeArguments args, const NativeType &val)
static NativeType FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static const char * GetDartRepresentation()
static NativeType FromFfi(FfiType val)
static const char * GetFfiRepresentation()
static void SetReturnValue(Dart_NativeArguments args, const NativeType &val)
static NativeType FromDart(Dart_Handle handle)
static FfiType ToFfi(NativeType val)
static Dart_Handle ToDart(const NativeType &val)
typename DartConverterTypes< T >::ValueType ValueType
static Dart_Handle ToDart(const std::vector< ValueType > &val)
static std::vector< ValueType > FromDart(Dart_Handle handle)
static FfiType ToFfi(std::vector< ValueType > val)
static void SetReturnValue(Dart_NativeArguments args, const std::vector< ValueType > &val)
typename DartConverterTypes< T >::ConverterType ConverterType
static std::vector< ValueType > FromFfi(FfiType val)
static std::vector< ValueType > FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static void SetReturnValue(Dart_NativeArguments args, unsigned long long val)
static Dart_Handle ToDart(unsigned long long val)
static unsigned long long FromDart(Dart_Handle handle)
static unsigned long long FromArguments(Dart_NativeArguments args, int index, Dart_Handle &exception)
static const char * GetDartRepresentation()
static const char * GetFfiRepresentation()
static Dart_Handle NewList(Dart_Handle type_handle, intptr_t length)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
#define TONIC_DCHECK
Definition: macros.h:32