Flutter Engine
The Flutter Engine
fl_standard_message_codec.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 "flutter/shell/platform/linux/public/flutter_linux/fl_standard_message_codec.h"
6
7#include <gmodule.h>
8
9#include <cstring>
10
11// See lib/src/services/message_codecs.dart in Flutter source for description of
12// encoding.
13
14// Type values.
15static constexpr int kValueNull = 0;
16static constexpr int kValueTrue = 1;
17static constexpr int kValueFalse = 2;
18static constexpr int kValueInt32 = 3;
19static constexpr int kValueInt64 = 4;
20static constexpr int kValueFloat64 = 6;
21static constexpr int kValueString = 7;
22static constexpr int kValueUint8List = 8;
23static constexpr int kValueInt32List = 9;
24static constexpr int kValueInt64List = 10;
25static constexpr int kValueFloat64List = 11;
26static constexpr int kValueList = 12;
27static constexpr int kValueMap = 13;
28static constexpr int kValueFloat32List = 14;
29
30G_DEFINE_TYPE(FlStandardMessageCodec,
31 fl_standard_message_codec,
32 fl_message_codec_get_type())
33
34// Functions to write standard C number types.
35
36static void write_uint8(GByteArray* buffer, uint8_t value) {
37 g_byte_array_append(buffer, &value, sizeof(uint8_t));
38}
39
40static void write_uint16(GByteArray* buffer, uint16_t value) {
41 g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
42 sizeof(uint16_t));
43}
44
45static void write_uint32(GByteArray* buffer, uint32_t value) {
46 g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
47 sizeof(uint32_t));
48}
49
50static void write_int32(GByteArray* buffer, int32_t value) {
51 g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
52 sizeof(int32_t));
53}
54
55static void write_int64(GByteArray* buffer, int64_t value) {
56 g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
57 sizeof(int64_t));
58}
59
60static void write_float64(GByteArray* buffer, double value) {
61 g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
62 sizeof(double));
63}
64
65// Write padding bytes to align to @align multiple of bytes.
66static void write_align(GByteArray* buffer, guint align) {
67 while (buffer->len % align != 0) {
68 write_uint8(buffer, 0);
69 }
70}
71
72// Checks there is enough data in @buffer to be read.
73static gboolean check_size(GBytes* buffer,
74 size_t offset,
75 size_t required,
76 GError** error) {
77 if (offset + required > g_bytes_get_size(buffer)) {
78 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
79 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, "Unexpected end of data");
80 return FALSE;
81 }
82 return TRUE;
83}
84
85// Skip bytes to align next read on @align multiple of bytes.
86static gboolean read_align(GBytes* buffer,
87 size_t* offset,
88 size_t align,
89 GError** error) {
90 if ((*offset) % align == 0) {
91 return TRUE;
92 }
93
94 size_t required = align - (*offset) % align;
95 if (!check_size(buffer, *offset, required, error)) {
96 return FALSE;
97 }
98
99 (*offset) += required;
100 return TRUE;
101}
102
103// Gets a pointer to the given offset in @buffer.
104static const uint8_t* get_data(GBytes* buffer, size_t* offset) {
105 return static_cast<const uint8_t*>(g_bytes_get_data(buffer, nullptr)) +
106 *offset;
107}
108
109// Reads an unsigned 8 bit number from @buffer and writes it to @value.
110// Returns TRUE if successful, otherwise sets an error.
111static gboolean read_uint8(GBytes* buffer,
112 size_t* offset,
113 uint8_t* value,
114 GError** error) {
115 if (!check_size(buffer, *offset, sizeof(uint8_t), error)) {
116 return FALSE;
117 }
118
119 *value = get_data(buffer, offset)[0];
120 (*offset)++;
121 return TRUE;
122}
123
124// Reads an unsigned 16 bit integer from @buffer and writes it to @value.
125// Returns TRUE if successful, otherwise sets an error.
126static gboolean read_uint16(GBytes* buffer,
127 size_t* offset,
128 uint16_t* value,
129 GError** error) {
130 if (!check_size(buffer, *offset, sizeof(uint16_t), error)) {
131 return FALSE;
132 }
133
134 *value = reinterpret_cast<const uint16_t*>(get_data(buffer, offset))[0];
135 *offset += sizeof(uint16_t);
136 return TRUE;
137}
138
139// Reads an unsigned 32 bit integer from @buffer and writes it to @value.
140// Returns TRUE if successful, otherwise sets an error.
141static gboolean read_uint32(GBytes* buffer,
142 size_t* offset,
143 uint32_t* value,
144 GError** error) {
145 if (!check_size(buffer, *offset, sizeof(uint32_t), error)) {
146 return FALSE;
147 }
148
149 *value = reinterpret_cast<const uint32_t*>(get_data(buffer, offset))[0];
150 *offset += sizeof(uint32_t);
151 return TRUE;
152}
153
154// Reads a #FL_VALUE_TYPE_INT stored as a signed 32 bit integer from @buffer.
155// Returns a new #FlValue of type #FL_VALUE_TYPE_INT if successful or %NULL on
156// error.
158 size_t* offset,
159 GError** error) {
160 if (!check_size(buffer, *offset, sizeof(int32_t), error)) {
161 return nullptr;
162 }
163
165 reinterpret_cast<const int32_t*>(get_data(buffer, offset))[0]);
166 *offset += sizeof(int32_t);
167 return value;
168}
169
170// Reads a #FL_VALUE_TYPE_INT stored as a signed 64 bit integer from @buffer.
171// Returns a new #FlValue of type #FL_VALUE_TYPE_INT if successful or %NULL on
172// error.
174 size_t* offset,
175 GError** error) {
176 if (!check_size(buffer, *offset, sizeof(int64_t), error)) {
177 return nullptr;
178 }
179
181 reinterpret_cast<const int64_t*>(get_data(buffer, offset))[0]);
182 *offset += sizeof(int64_t);
183 return value;
184}
185
186// Reads a 64 bit floating point number from @buffer and writes it to @value.
187// Returns a new #FlValue of type #FL_VALUE_TYPE_FLOAT if successful or %NULL on
188// error.
190 size_t* offset,
191 GError** error) {
192 if (!read_align(buffer, offset, 8, error)) {
193 return nullptr;
194 }
195 if (!check_size(buffer, *offset, sizeof(double), error)) {
196 return nullptr;
197 }
198
200 reinterpret_cast<const double*>(get_data(buffer, offset))[0]);
201 *offset += sizeof(double);
202 return value;
203}
204
205// Reads an UTF-8 text string from @buffer in standard codec format.
206// Returns a new #FlValue of type #FL_VALUE_TYPE_STRING if successful or %NULL
207// on error.
208static FlValue* read_string_value(FlStandardMessageCodec* self,
209 GBytes* buffer,
210 size_t* offset,
211 GError** error) {
212 uint32_t length;
214 error)) {
215 return nullptr;
216 }
217 if (!check_size(buffer, *offset, length, error)) {
218 return nullptr;
219 }
221 reinterpret_cast<const gchar*>(get_data(buffer, offset)), length);
222 *offset += length;
223 return value;
224}
225
226// Reads an unsigned 8 bit list from @buffer in standard codec format.
227// Returns a new #FlValue of type #FL_VALUE_TYPE_UINT8_LIST if successful or
228// %NULL on error.
229static FlValue* read_uint8_list_value(FlStandardMessageCodec* self,
230 GBytes* buffer,
231 size_t* offset,
232 GError** error) {
233 uint32_t length;
235 error)) {
236 return nullptr;
237 }
238 if (!check_size(buffer, *offset, sizeof(uint8_t) * length, error)) {
239 return nullptr;
240 }
242 *offset += length;
243 return value;
244}
245
246// Reads a signed 32 bit list from @buffer in standard codec format.
247// Returns a new #FlValue of type #FL_VALUE_TYPE_INT32_LIST if successful or
248// %NULL on error.
249static FlValue* read_int32_list_value(FlStandardMessageCodec* self,
250 GBytes* buffer,
251 size_t* offset,
252 GError** error) {
253 uint32_t length;
255 error)) {
256 return nullptr;
257 }
258 if (!read_align(buffer, offset, 4, error)) {
259 return nullptr;
260 }
261 if (!check_size(buffer, *offset, sizeof(int32_t) * length, error)) {
262 return nullptr;
263 }
265 reinterpret_cast<const int32_t*>(get_data(buffer, offset)), length);
266 *offset += sizeof(int32_t) * length;
267 return value;
268}
269
270// Reads a signed 64 bit list from @buffer in standard codec format.
271// Returns a new #FlValue of type #FL_VALUE_TYPE_INT64_LIST if successful or
272// %NULL on error.
273static FlValue* read_int64_list_value(FlStandardMessageCodec* self,
274 GBytes* buffer,
275 size_t* offset,
276 GError** error) {
277 uint32_t length;
279 error)) {
280 return nullptr;
281 }
282 if (!read_align(buffer, offset, 8, error)) {
283 return nullptr;
284 }
285 if (!check_size(buffer, *offset, sizeof(int64_t) * length, error)) {
286 return nullptr;
287 }
289 reinterpret_cast<const int64_t*>(get_data(buffer, offset)), length);
290 *offset += sizeof(int64_t) * length;
291 return value;
292}
293
294// Reads a 32 bit floating point number list from @buffer in standard codec
295// format. Returns a new #FlValue of type #FL_VALUE_TYPE_FLOAT32_LIST if
296// successful or %NULL on error.
297static FlValue* read_float32_list_value(FlStandardMessageCodec* self,
298 GBytes* buffer,
299 size_t* offset,
300 GError** error) {
301 uint32_t length;
303 error)) {
304 return nullptr;
305 }
306 if (!read_align(buffer, offset, 4, error)) {
307 return nullptr;
308 }
309 if (!check_size(buffer, *offset, sizeof(float) * length, error)) {
310 return nullptr;
311 }
313 reinterpret_cast<const float*>(get_data(buffer, offset)), length);
314 *offset += sizeof(float) * length;
315 return value;
316}
317
318// Reads a floating point number list from @buffer in standard codec format.
319// Returns a new #FlValue of type #FL_VALUE_TYPE_FLOAT_LIST if successful or
320// %NULL on error.
321static FlValue* read_float64_list_value(FlStandardMessageCodec* self,
322 GBytes* buffer,
323 size_t* offset,
324 GError** error) {
325 uint32_t length;
327 error)) {
328 return nullptr;
329 }
330 if (!read_align(buffer, offset, 8, error)) {
331 return nullptr;
332 }
333 if (!check_size(buffer, *offset, sizeof(double) * length, error)) {
334 return nullptr;
335 }
337 reinterpret_cast<const double*>(get_data(buffer, offset)), length);
338 *offset += sizeof(double) * length;
339 return value;
340}
341
342// Reads a list from @buffer in standard codec format.
343// Returns a new #FlValue of type #FL_VALUE_TYPE_LIST if successful or %NULL on
344// error.
345static FlValue* read_list_value(FlStandardMessageCodec* self,
346 GBytes* buffer,
347 size_t* offset,
348 GError** error) {
349 uint32_t length;
351 error)) {
352 return nullptr;
353 }
354
355 g_autoptr(FlValue) list = fl_value_new_list();
356 for (size_t i = 0; i < length; i++) {
357 g_autoptr(FlValue) child =
359 if (child == nullptr) {
360 return nullptr;
361 }
362 fl_value_append(list, child);
363 }
364
365 return fl_value_ref(list);
366}
367
368// Reads a map from @buffer in standard codec format.
369// Returns a new #FlValue of type #FL_VALUE_TYPE_MAP if successful or %NULL on
370// error.
371static FlValue* read_map_value(FlStandardMessageCodec* self,
372 GBytes* buffer,
373 size_t* offset,
374 GError** error) {
375 uint32_t length;
377 error)) {
378 return nullptr;
379 }
380
381 g_autoptr(FlValue) map = fl_value_new_map();
382 for (size_t i = 0; i < length; i++) {
383 g_autoptr(FlValue) key =
385 if (key == nullptr) {
386 return nullptr;
387 }
388 g_autoptr(FlValue) value =
390 if (value == nullptr) {
391 return nullptr;
392 }
394 }
395
396 return fl_value_ref(map);
397}
398
399// Implements FlMessageCodec::encode_message.
400static GBytes* fl_standard_message_codec_encode_message(FlMessageCodec* codec,
402 GError** error) {
403 FlStandardMessageCodec* self =
404 reinterpret_cast<FlStandardMessageCodec*>(codec);
405
406 g_autoptr(GByteArray) buffer = g_byte_array_new();
408 return nullptr;
409 }
410 return g_byte_array_free_to_bytes(
411 static_cast<GByteArray*>(g_steal_pointer(&buffer)));
412}
413
414// Implements FlMessageCodec::decode_message.
416 GBytes* message,
417 GError** error) {
418 if (g_bytes_get_size(message) == 0) {
419 return fl_value_new_null();
420 }
421
422 FlStandardMessageCodec* self =
423 reinterpret_cast<FlStandardMessageCodec*>(codec);
424
425 size_t offset = 0;
426 g_autoptr(FlValue) value =
428 if (value == nullptr) {
429 return nullptr;
430 }
431
432 if (offset != g_bytes_get_size(message)) {
433 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
435 "Unused %zi bytes after standard message",
436 g_bytes_get_size(message) - offset);
437 return nullptr;
438 }
439
440 return fl_value_ref(value);
441}
442
443// Implements FlStandardMessageCodec::write_value.
445 FlStandardMessageCodec* self,
446 GByteArray* buffer,
447 FlValue* value,
448 GError** error) {
449 if (value == nullptr) {
450 write_uint8(buffer, kValueNull);
451 return TRUE;
452 }
453
454 switch (fl_value_get_type(value)) {
456 write_uint8(buffer, kValueNull);
457 return TRUE;
460 write_uint8(buffer, kValueTrue);
461 } else {
462 write_uint8(buffer, kValueFalse);
463 }
464 return TRUE;
465 case FL_VALUE_TYPE_INT: {
466 int64_t v = fl_value_get_int(value);
467 if (v >= INT32_MIN && v <= INT32_MAX) {
468 write_uint8(buffer, kValueInt32);
470 } else {
471 write_uint8(buffer, kValueInt64);
473 }
474 return TRUE;
475 }
477 write_uint8(buffer, kValueFloat64);
480 return TRUE;
482 write_uint8(buffer, kValueString);
483 const char* text = fl_value_get_string(value);
484 size_t length = strlen(text);
486 g_byte_array_append(buffer, reinterpret_cast<const uint8_t*>(text),
487 length);
488 return TRUE;
489 }
491 write_uint8(buffer, kValueUint8List);
495 sizeof(uint8_t) * length);
496 return TRUE;
497 }
499 write_uint8(buffer, kValueInt32List);
504 buffer,
505 reinterpret_cast<const uint8_t*>(fl_value_get_int32_list(value)),
506 sizeof(int32_t) * length);
507 return TRUE;
508 }
510 write_uint8(buffer, kValueInt64List);
515 buffer,
516 reinterpret_cast<const uint8_t*>(fl_value_get_int64_list(value)),
517 sizeof(int64_t) * length);
518 return TRUE;
519 }
521 write_uint8(buffer, kValueFloat32List);
526 buffer,
527 reinterpret_cast<const uint8_t*>(fl_value_get_float32_list(value)),
528 sizeof(float) * length);
529 return TRUE;
530 }
532 write_uint8(buffer, kValueFloat64List);
537 buffer,
538 reinterpret_cast<const uint8_t*>(fl_value_get_float_list(value)),
539 sizeof(double) * length);
540 return TRUE;
541 }
543 write_uint8(buffer, kValueList);
546 for (size_t i = 0; i < fl_value_get_length(value); i++) {
549 return FALSE;
550 }
551 }
552 return TRUE;
554 write_uint8(buffer, kValueMap);
557 for (size_t i = 0; i < fl_value_get_length(value); i++) {
562 return FALSE;
563 }
564 }
565 return TRUE;
567 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
569 "Custom value not implemented");
570 return FALSE;
571 }
572
573 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
575 "Unexpected FlValue type %d", fl_value_get_type(value));
576 return FALSE;
577}
578
579// Implements FlStandardMessageCodec::read_value_of_type.
581 FlStandardMessageCodec* self,
582 GBytes* buffer,
583 size_t* offset,
584 int type,
585 GError** error) {
586 g_autoptr(FlValue) value = nullptr;
587 if (type == kValueNull) {
588 return fl_value_new_null();
589 } else if (type == kValueTrue) {
590 return fl_value_new_bool(TRUE);
591 } else if (type == kValueFalse) {
592 return fl_value_new_bool(FALSE);
593 } else if (type == kValueInt32) {
595 } else if (type == kValueInt64) {
597 } else if (type == kValueFloat64) {
599 } else if (type == kValueString) {
601 } else if (type == kValueUint8List) {
603 } else if (type == kValueInt32List) {
605 } else if (type == kValueInt64List) {
607 } else if (type == kValueFloat32List) {
609 } else if (type == kValueFloat64List) {
611 } else if (type == kValueList) {
613 } else if (type == kValueMap) {
615 } else {
616 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
618 "Unexpected standard codec type %02x", type);
619 return nullptr;
620 }
621
622 return value == nullptr ? nullptr : fl_value_ref(value);
623}
624
626 FlStandardMessageCodecClass* klass) {
627 FL_MESSAGE_CODEC_CLASS(klass)->encode_message =
629 FL_MESSAGE_CODEC_CLASS(klass)->decode_message =
632 klass->read_value_of_type = fl_standard_message_codec_read_value_of_type;
633}
634
635static void fl_standard_message_codec_init(FlStandardMessageCodec* self) {}
636
637G_MODULE_EXPORT FlStandardMessageCodec* fl_standard_message_codec_new() {
638 return static_cast<FlStandardMessageCodec*>(
639 g_object_new(fl_standard_message_codec_get_type(), nullptr));
640}
641
643 FlStandardMessageCodec* codec,
644 GByteArray* buffer,
645 uint32_t size) {
646 if (size < 254) {
647 write_uint8(buffer, size);
648 } else if (size <= 0xffff) {
649 write_uint8(buffer, 254);
651 } else {
652 write_uint8(buffer, 255);
654 }
655}
656
657G_MODULE_EXPORT gboolean fl_standard_message_codec_read_size(
658 FlStandardMessageCodec* codec,
659 GBytes* buffer,
660 size_t* offset,
661 uint32_t* value,
662 GError** error) {
663 uint8_t value8;
664 if (!read_uint8(buffer, offset, &value8, error)) {
665 return FALSE;
666 }
667
668 if (value8 == 255) {
670 return FALSE;
671 }
672 } else if (value8 == 254) {
673 uint16_t value16;
674 if (!read_uint16(buffer, offset, &value16, error)) {
675 return FALSE;
676 }
677 *value = value16;
678 } else {
679 *value = value8;
680 }
681
682 return TRUE;
683}
684
686 FlStandardMessageCodec* self,
687 GByteArray* buffer,
688 FlValue* value,
689 GError** error) {
690 return FL_STANDARD_MESSAGE_CODEC_GET_CLASS(self)->write_value(self, buffer,
691 value, error);
692}
693
695 FlStandardMessageCodec* self,
696 GBytes* buffer,
697 size_t* offset,
698 GError** error) {
699 uint8_t type;
700 if (!read_uint8(buffer, offset, &type, error)) {
701 return nullptr;
702 }
703
704 return FL_STANDARD_MESSAGE_CODEC_GET_CLASS(self)->read_value_of_type(
706}
GLenum type
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
@ FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA
#define FL_MESSAGE_CODEC_ERROR
const uint8_t uint32_t uint32_t GError ** error
static FlValue * read_int64_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
G_MODULE_EXPORT gboolean fl_standard_message_codec_write_value(FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)
static FlValue * read_int32_value(GBytes *buffer, size_t *offset, GError **error)
static constexpr int kValueNull
static constexpr int kValueString
static gboolean read_uint32(GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
static FlValue * read_float64_value(GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT void fl_standard_message_codec_write_size(FlStandardMessageCodec *codec, GByteArray *buffer, uint32_t size)
static FlValue * fl_standard_message_codec_decode_message(FlMessageCodec *codec, GBytes *message, GError **error)
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static constexpr int kValueTrue
static FlValue * read_float32_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static gboolean fl_standard_message_codec_real_write_value(FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
static void write_align(GByteArray *buffer, guint align)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
static GBytes * fl_standard_message_codec_encode_message(FlMessageCodec *codec, FlValue *message, GError **error)
static constexpr int kValueInt64List
static FlValue * read_int64_value(GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_standard_message_codec_read_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static constexpr int kValueFloat64List
uint8_t value
static constexpr int kValueFloat32List
static constexpr int kValueUint8List
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
static void fl_standard_message_codec_init(FlStandardMessageCodec *self)
static constexpr int kValueInt32
static constexpr int kValueList
static gboolean read_uint16(GBytes *buffer, size_t *offset, uint16_t *value, GError **error)
static constexpr int kValueFloat64
static constexpr int kValueMap
static FlValue * read_string_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static constexpr int kValueInt32List
static FlValue * read_uint8_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static void write_uint32(GByteArray *buffer, uint32_t value)
static void write_int64(GByteArray *buffer, int64_t value)
static FlValue * read_float64_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static void write_uint16(GByteArray *buffer, uint16_t value)
static FlValue * fl_standard_message_codec_read_value_of_type(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, int type, GError **error)
static gboolean read_uint8(GBytes *buffer, size_t *offset, uint8_t *value, GError **error)
static void write_float64(GByteArray *buffer, double value)
static constexpr int kValueInt64
static void write_int32(GByteArray *buffer, int32_t value)
static FlValue * read_map_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static void fl_standard_message_codec_class_init(FlStandardMessageCodecClass *klass)
static constexpr int kValueFalse
static FlValue * read_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_int32_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_DEFINE_TYPE(FlStandardMessageCodec, fl_standard_message_codec, fl_message_codec_get_type()) static void write_uint8(GByteArray *buffer
g_byte_array_append(buffer, &type, sizeof(uint8_t))
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:717
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
Definition: fl_value.cc:329
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:309
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:784
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:269
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:689
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:776
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:292
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:339
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:283
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:319
G_MODULE_EXPORT const float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:710
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:792
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:696
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:703
G_MODULE_EXPORT void fl_value_set(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:609
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:69
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:65
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:67
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:66
@ FL_VALUE_TYPE_FLOAT32_LIST
Definition: fl_value.h:76
@ FL_VALUE_TYPE_INT32_LIST
Definition: fl_value.h:71
@ FL_VALUE_TYPE_UINT8_LIST
Definition: fl_value.h:70
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:74
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:75
@ FL_VALUE_TYPE_INT64_LIST
Definition: fl_value.h:72
@ FL_VALUE_TYPE_FLOAT_LIST
Definition: fl_value.h:73
@ FL_VALUE_TYPE_CUSTOM
Definition: fl_value.h:77
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:68
size_t length
std::u16string text
Win32Message message
return FALSE
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
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
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680
SeparatedVector2 offset