Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::SnapshotHeaderReader Class Reference

#include <app_snapshot.h>

Public Member Functions

 SnapshotHeaderReader (const Snapshot *snapshot)
 
 SnapshotHeaderReader (Snapshot::Kind kind, const uint8_t *buffer, intptr_t size)
 
void SetCoverageFromSnapshotFeatures (IsolateGroup *isolate_group)
 
char * VerifyVersionAndFeatures (IsolateGroup *isolate_group, intptr_t *offset)
 

Static Public Member Functions

static char * InitializeGlobalVMFlagsFromSnapshot (const Snapshot *snapshot)
 

Detailed Description

Definition at line 72 of file app_snapshot.h.

Constructor & Destructor Documentation

◆ SnapshotHeaderReader() [1/2]

dart::SnapshotHeaderReader::SnapshotHeaderReader ( const Snapshot snapshot)
inlineexplicit

Definition at line 76 of file app_snapshot.h.

77 : SnapshotHeaderReader(snapshot->kind(),
78 snapshot->Addr(),
79 snapshot->length()) {}
SnapshotHeaderReader(const Snapshot *snapshot)
Definition: app_snapshot.h:76

◆ SnapshotHeaderReader() [2/2]

dart::SnapshotHeaderReader::SnapshotHeaderReader ( Snapshot::Kind  kind,
const uint8_t *  buffer,
intptr_t  size 
)
inline

Definition at line 81 of file app_snapshot.h.

84 : kind_(kind), stream_(buffer, size) {
86 }
void SetPosition(intptr_t value)
Definition: datastream.h:128
static constexpr intptr_t kHeaderSize
Definition: snapshot.h:43
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

Member Function Documentation

◆ InitializeGlobalVMFlagsFromSnapshot()

char * dart::SnapshotHeaderReader::InitializeGlobalVMFlagsFromSnapshot ( const Snapshot snapshot)
static

Definition at line 9838 of file app_snapshot.cc.

9839 {
9840 SnapshotHeaderReader header_reader(snapshot);
9841
9842 char* error = header_reader.VerifyVersion();
9843 if (error != nullptr) {
9844 return error;
9845 }
9846
9847 const char* features = nullptr;
9848 intptr_t features_length = 0;
9849 error = header_reader.ReadFeatures(&features, &features_length);
9850 if (error != nullptr) {
9851 return error;
9852 }
9853
9854 ASSERT(features[features_length] == '\0');
9855 const char* cursor = features;
9856 while (*cursor != '\0') {
9857 while (*cursor == ' ') {
9858 cursor++;
9859 }
9860
9861 const char* end = strstr(cursor, " ");
9862 if (end == nullptr) {
9863 end = features + features_length;
9864 }
9865
9866#define SET_FLAG(name) \
9867 if (strncmp(cursor, #name, end - cursor) == 0) { \
9868 FLAG_##name = true; \
9869 cursor = end; \
9870 continue; \
9871 } \
9872 if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
9873 FLAG_##name = false; \
9874 cursor = end; \
9875 continue; \
9876 }
9877
9878#define CHECK_FLAG(name, mode) \
9879 if (strncmp(cursor, #name, end - cursor) == 0) { \
9880 if (!FLAG_##name) { \
9881 return header_reader.BuildError("Flag " #name \
9882 " is true in snapshot, " \
9883 "but " #name \
9884 " is always false in " mode); \
9885 } \
9886 cursor = end; \
9887 continue; \
9888 } \
9889 if (strncmp(cursor, "no-" #name, end - cursor) == 0) { \
9890 if (FLAG_##name) { \
9891 return header_reader.BuildError("Flag " #name \
9892 " is false in snapshot, " \
9893 "but " #name \
9894 " is always true in " mode); \
9895 } \
9896 cursor = end; \
9897 continue; \
9898 }
9899
9900#define SET_P(name, T, DV, C) SET_FLAG(name)
9901
9902#if defined(PRODUCT)
9903#define SET_OR_CHECK_R(name, PV, T, DV, C) CHECK_FLAG(name, "product mode")
9904#else
9905#define SET_OR_CHECK_R(name, PV, T, DV, C) SET_FLAG(name)
9906#endif
9907
9908#if defined(PRODUCT)
9909#define SET_OR_CHECK_C(name, PCV, PV, T, DV, C) CHECK_FLAG(name, "product mode")
9910#elif defined(DART_PRECOMPILED_RUNTIME)
9911#define SET_OR_CHECK_C(name, PCV, PV, T, DV, C) \
9912 CHECK_FLAG(name, "the precompiled runtime")
9913#else
9914#define SET_OR_CHECK_C(name, PV, T, DV, C) SET_FLAG(name)
9915#endif
9916
9917#if !defined(DEBUG)
9918#define SET_OR_CHECK_D(name, T, DV, C) CHECK_FLAG(name, "non-debug mode")
9919#else
9920#define SET_OR_CHECK_D(name, T, DV, C) SET_FLAG(name)
9921#endif
9922
9924
9925#undef SET_OR_CHECK_D
9926#undef SET_OR_CHECK_C
9927#undef SET_OR_CHECK_R
9928#undef SET_P
9929#undef CHECK_FLAG
9930#undef SET_FLAG
9931
9932 cursor = end;
9933 }
9934
9935 return nullptr;
9936}
#define SET_OR_CHECK_R(name, PV, T, DV, C)
#define SET_P(name, T, DV, C)
#define SET_OR_CHECK_C(name, PV, T, DV, C)
#define SET_OR_CHECK_D(name, T, DV, C)
#define ASSERT(E)
glong glong end
const uint8_t uint32_t uint32_t GError ** error
#define VM_GLOBAL_FLAG_LIST(P, R, C, D)
Definition: flag_list.h:58

◆ SetCoverageFromSnapshotFeatures()

void dart::SnapshotHeaderReader::SetCoverageFromSnapshotFeatures ( IsolateGroup isolate_group)

Definition at line 9283 of file app_snapshot.cc.

9284 {
9285 auto prev_position = stream_.Position();
9286 char* error = VerifyVersion();
9287 if (error == nullptr) {
9288 const char* features = nullptr;
9289 intptr_t features_length = 0;
9290 char* error = ReadFeatures(&features, &features_length);
9291 if (error == nullptr) {
9292 if (strstr(features, " no-coverage") != nullptr) {
9293 isolate_group->set_coverage(false);
9294 } else if (strstr(features, " coverage") != nullptr) {
9295 isolate_group->set_coverage(true);
9296 }
9297 }
9298 }
9299
9300 stream_.SetPosition(prev_position);
9301}
intptr_t Position() const
Definition: datastream.h:127

◆ VerifyVersionAndFeatures()

char * dart::SnapshotHeaderReader::VerifyVersionAndFeatures ( IsolateGroup isolate_group,
intptr_t *  offset 
)

Definition at line 9303 of file app_snapshot.cc.

9305 {
9306 char* error = VerifyVersion();
9307 if (error == nullptr) {
9308 error = VerifyFeatures(isolate_group);
9309 }
9310 if (error == nullptr) {
9311 *offset = stream_.Position();
9312 }
9313 return error;
9314}
SeparatedVector2 offset

The documentation for this class was generated from the following files: