5#include "flutter/shell/platform/darwin/common/framework/Source/FlutterStandardCodecHelper.h"
10#include "flutter/fml/logging.h"
20 uint8_t mod = *location % alignment;
22 *location += (alignment - mod);
28 CFRange range = CFRangeMake(location, 1);
37 CFRange range = CFRangeMake(*location,
length);
38 CFDataGetBytes(
data, range,
static_cast<UInt8*
>(destination));
53 return (uint32_t)byte;
54 }
else if (
byte == 254) {
68 CFDataRef
result = CFDataCreateWithBytesNoCopy(
69 kCFAllocatorDefault, CFDataGetBytePtr(
data) + *location,
length,
72 return static_cast<CFDataRef
>(CFAutorelease(
result));
79 CFStringRef
result = CFStringCreateFromExternalRepresentation(
80 kCFAllocatorDefault, bytes, kCFStringEncodingUTF8);
81 return static_cast<CFStringRef
>(CFAutorelease(
result));
88 unsigned long* location,
90 CFTypeRef (*ReadValue)(CFTypeRef),
104 unsigned long* location,
107 CFTypeRef (*ReadValue)(CFTypeRef),
115 return kCFBooleanTrue;
117 return kCFBooleanFalse;
121 return CFAutorelease(
122 CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &
value));
127 return CFAutorelease(
128 CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &
value));
134 return CFAutorelease(
135 CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &
value));
145 return ReadTypedDataOfType(field,
user_data);
148 CFMutableArrayRef array = CFArrayCreateMutable(
149 kCFAllocatorDefault,
length, &kCFTypeArrayCallBacks);
153 CFArrayAppendValue(array, (
value == nil ? kCFNull :
value));
155 return CFAutorelease(array);
159 CFMutableDictionaryRef dict = CFDictionaryCreateMutable(
160 kCFAllocatorDefault,
size, &kCFTypeDictionaryKeyCallBacks,
161 &kCFTypeDictionaryValueCallBacks);
162 for (UInt32
i = 0;
i <
size;
i++) {
167 CFDictionaryAddValue(dict, (
key == nil ? kCFNull :
key),
168 (val == nil ? kCFNull : val));
170 return CFAutorelease(dict);
185 CFDataAppendBytes(
data,
static_cast<const UInt8*
>(bytes),
length);
191 }
else if (
size <= 0xffff) {
203 uint8_t mod = CFDataGetLength(
data) % alignment;
205 for (
int i = 0;
i < (alignment - mod);
i++) {
213 const char*
utf8 = CFStringGetCStringPtr(
value, kCFStringEncodingUTF8);
220 CFIndex used_length = 0;
222 CFIndex buffer_length =
length * 3;
223 std::vector<UInt8>
buffer;
224 buffer.resize(buffer_length);
225 CFStringGetBytes(
value, CFRangeMake(0,
length), kCFStringEncodingUTF8, 0,
226 false,
buffer.data(), buffer_length, &used_length);
234 const UInt8* bytes = CFDataGetBytePtr(
value);
240 CFNumberRef number) {
241 bool success =
false;
242 if (CFGetTypeID(number) == CFBooleanGetTypeID()) {
243 bool b = CFBooleanGetValue((CFBooleanRef)number);
247 }
else if (CFNumberIsFloatType(number)) {
249 success = CFNumberGetValue(number, kCFNumberFloat64Type, &
f);
255 }
else if (CFNumberGetByteSize(number) <= 4) {
257 success = CFNumberGetValue(number, kCFNumberSInt32Type, &n);
262 }
else if (CFNumberGetByteSize(number) <= 8) {
264 success = CFNumberGetValue(number, kCFNumberSInt64Type, &n);
static uint8_t PeekByte(unsigned long location, CFDataRef data)
CFTypeRef FlutterStandardCodecHelperReadValueOfType(unsigned long *location, CFDataRef data, uint8_t type, CFTypeRef(*ReadValue)(CFTypeRef), CFTypeRef(*ReadTypedDataOfType)(FlutterStandardField, CFTypeRef), CFTypeRef user_data)
bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data, CFNumberRef number)
void FlutterStandardCodecHelperWriteData(CFMutableDataRef data, CFDataRef value)
uint8_t FlutterStandardCodecHelperReadByte(unsigned long *location, CFDataRef data)
void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size)
CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long *location, CFDataRef data)
void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data, const void *bytes, unsigned long length)
void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data, CFStringRef value)
void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value)
uint32_t FlutterStandardCodecHelperReadSize(unsigned long *location, CFDataRef data)
void FlutterStandardCodecHelperReadAlignment(unsigned long *location, uint8_t alignment)
static CFTypeRef FastReadValue(unsigned long *location, CFDataRef data, CFTypeRef(*ReadValue)(CFTypeRef), CFTypeRef(*ReadTypedDataOfType)(FlutterStandardField, CFTypeRef), CFTypeRef user_data)
void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data, uint8_t alignment)
static CFDataRef ReadDataNoCopy(unsigned long *location, unsigned long length, CFDataRef data)
void FlutterStandardCodecHelperReadBytes(unsigned long *location, unsigned long length, void *destination, CFDataRef data)
@ FlutterStandardFieldUInt8Data
@ FlutterStandardFieldFloat64
@ FlutterStandardFieldFloat32Data
@ FlutterStandardFieldIntHex
@ FlutterStandardFieldMap
@ FlutterStandardFieldInt64Data
@ FlutterStandardFieldList
@ FlutterStandardFieldInt32
@ FlutterStandardFieldNil
@ FlutterStandardFieldTrue
@ FlutterStandardFieldString
@ FlutterStandardFieldFalse
@ FlutterStandardFieldInt32Data
@ FlutterStandardFieldInt64
@ FlutterStandardFieldFloat64Data
static bool FlutterStandardFieldIsStandardType(uint8_t field)
#define FML_DCHECK(condition)
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
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
std::shared_ptr< const fml::Mapping > data