36 uint8_t** dictionary) {
37 ASSERT(dictionary !=
nullptr);
38 uint8_t*
src =
nullptr;
53 reinterpret_cast<void**
>(&
src), &
size);
78 uint8_t* dictionary =
nullptr;
79 intptr_t dictionary_length = 0;
85 ASSERT(dictionary !=
nullptr);
86 dictionary_length = 0;
95 static_cast<int32_t
>(window_bits), dictionary, dictionary_length, raw);
96 if (filter ==
nullptr) {
101 if (!filter->
Init()) {
107 filter_obj, filter,
sizeof(*filter) + dictionary_length);
132 uint8_t* dictionary =
nullptr;
133 intptr_t dictionary_length = 0;
139 ASSERT(dictionary !=
nullptr);
140 dictionary_length = 0;
149 gzip,
static_cast<int32_t
>(
level),
static_cast<int32_t
>(window_bits),
150 static_cast<int32_t
>(mem_level),
static_cast<int32_t
>(strategy),
151 dictionary, dictionary_length, raw);
152 if (filter ==
nullptr) {
157 if (!filter->
Init()) {
163 filter_obj, filter,
sizeof(*filter) + dictionary_length);
175 intptr_t chunk_length =
end -
start;
178 uint8_t*
buffer =
nullptr;
193 "Invalid argument passed to Filter_Process"));
195 uint8_t* zlib_buffer =
new uint8_t[chunk_length];
196 if (zlib_buffer ==
nullptr) {
201 memmove(zlib_buffer,
buffer +
start, chunk_length);
209 buffer =
new uint8_t[chunk_length];
223 "Call to Process while still processing data"));
245 }
else if (
read == 0) {
260 Filter* filter =
reinterpret_cast<Filter*
>(filter_pointer);
269 reinterpret_cast<intptr_t
>(filter_pointer));
279 Filter** filter_pointer) {
282 reinterpret_cast<intptr_t*
>(filter_pointer));
286 delete[] dictionary_;
287 delete[] current_buffer_;
289 deflateEnd(&stream_);
294 int window_bits = window_bits_;
295 if ((raw_ || gzip_) && (window_bits == 8)) {
306 window_bits = -window_bits;
310 stream_.next_in = Z_NULL;
311 stream_.zalloc = Z_NULL;
312 stream_.zfree = Z_NULL;
313 stream_.opaque = Z_NULL;
314 int result = deflateInit2(&stream_, level_, Z_DEFLATED, window_bits,
315 mem_level_, strategy_);
319 if ((dictionary_ !=
nullptr) && !gzip_ && !raw_) {
320 result = deflateSetDictionary(&stream_, dictionary_, dictionary_length_);
321 delete[] dictionary_;
322 dictionary_ =
nullptr;
332 if (current_buffer_ !=
nullptr) {
335 stream_.avail_in =
length;
336 stream_.next_in = current_buffer_ =
data;
344 stream_.avail_out =
length;
345 stream_.next_out =
buffer;
347 switch (deflate(&stream_,
end ? Z_FINISH
348 : flush ? Z_SYNC_FLUSH
353 intptr_t processed =
length - stream_.avail_out;
354 if (processed == 0) {
365 delete[] current_buffer_;
366 current_buffer_ =
nullptr;
368 return error ? -1 : 0;
372 delete[] dictionary_;
373 delete[] current_buffer_;
375 inflateEnd(&stream_);
383 stream_.next_in = Z_NULL;
384 stream_.avail_in = 0;
385 stream_.zalloc = Z_NULL;
386 stream_.zfree = Z_NULL;
387 stream_.opaque = Z_NULL;
388 int result = inflateInit2(&stream_, window_bits);
397 if (current_buffer_ !=
nullptr) {
400 stream_.avail_in =
length;
401 stream_.next_in = current_buffer_ =
data;
409 stream_.avail_out =
length;
410 stream_.next_out =
buffer;
413 switch (v = inflate(&stream_,
end ? Z_FINISH
414 : flush ? Z_SYNC_FLUSH
419 intptr_t processed =
length - stream_.avail_out;
421 if (v == Z_STREAM_END) {
432 inflateReset(&stream_);
434 if (processed == 0) {
441 if (dictionary_ ==
nullptr) {
445 inflateSetDictionary(&stream_, dictionary_, dictionary_length_);
446 delete[] dictionary_;
447 dictionary_ =
nullptr;
463 delete[] current_buffer_;
464 current_buffer_ =
nullptr;
466 return error ? -1 : 0;
static bool read(SkStream *stream, void *buffer, size_t amount)
#define FUNCTION_NAME(name)
static Dart_Handle NewDartFormatException(const char *message)
static int64_t GetIntegerValue(Dart_Handle value_obj)
static int64_t GetInt64ValueCheckRange(Dart_Handle value_obj, int64_t lower, int64_t upper)
static Dart_Handle NewDartOSError()
static bool GetBooleanValue(Dart_Handle bool_obj)
static Dart_Handle NewInternalError(const char *message)
static intptr_t GetIntptrValue(Dart_Handle value_obj)
virtual intptr_t Processed(uint8_t *buffer, intptr_t length, bool finish, bool end)=0
static Dart_Handle SetFilterAndCreateFinalizer(Dart_Handle filter, Filter *filter_pointer, intptr_t filter_size)
virtual bool Process(uint8_t *data, intptr_t length)=0
intptr_t processed_buffer_size() const
uint8_t * processed_buffer()
static Dart_Handle GetFilterNativeField(Dart_Handle filter, Filter **filter_pointer)
void set_initialized(bool value)
static Dart_Handle Allocate(intptr_t size, uint8_t **buffer)
virtual bool Process(uint8_t *data, intptr_t length)
virtual intptr_t Processed(uint8_t *buffer, intptr_t length, bool finish, bool end)
virtual ~ZLibDeflateFilter()
virtual intptr_t Processed(uint8_t *buffer, intptr_t length, bool finish, bool end)
virtual ~ZLibInflateFilter()
virtual bool Process(uint8_t *data, intptr_t length)
struct _Dart_Handle * Dart_Handle
struct _Dart_NativeArguments * Dart_NativeArguments
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
void FUNCTION_NAME() Filter_Processed(Dart_NativeArguments args)
void FUNCTION_NAME() Filter_Process(Dart_NativeArguments args)
static void DeleteFilter(void *isolate_data, void *filter_pointer)
const int kZLibFlagAcceptAnyHeader
const int kZLibFlagUseGZipHeader
static Dart_Handle CopyDictionary(Dart_Handle dictionary_obj, uint8_t **dictionary)
static constexpr int kFilterPointerNativeField
void FUNCTION_NAME() Filter_CreateZLibDeflate(Dart_NativeArguments args)
void FUNCTION_NAME() Filter_CreateZLibInflate(Dart_NativeArguments args)
static Dart_Handle GetFilter(Dart_Handle filter_obj, Filter **filter)
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
constexpr int32_t kMinInt32
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)
constexpr int32_t kMaxInt32
DART_EXPORT Dart_Handle Dart_NewApiError(const char *error)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *len)
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_Null()
static int8_t data[kExtLength]
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