20 "empty or missing file ",
22 "unknown attribute name ",
23 "error in attribute value ",
62constexpr const void* kHashSeed = &kHashSeed;
70struct ParsingContext {
73 , fXMLParser(XML_ParserCreate_MM(nullptr, &
sk_XML_alloc, nullptr)) { }
76 if (!fBufferedText.empty()) {
77 fParser->text(fBufferedText.data(), SkTo<int>(fBufferedText.size()));
78 fBufferedText.clear();
82 void appendText(
const char*
txt,
size_t len) {
83 fBufferedText.insert(fBufferedText.end(),
txt, &
txt[
len]);
90 std::vector<char> fBufferedText;
93#define HANDLER_CONTEXT(arg, name) ParsingContext* name = static_cast<ParsingContext*>(arg)
99 ctx->fParser->startElement(tag);
101 for (
size_t i = 0; attributes[
i];
i += 2) {
102 ctx->fParser->addAttribute(attributes[
i], attributes[
i + 1]);
110 ctx->fParser->endElement(tag);
113void XMLCALL text_handler(
void *
data,
const char*
txt,
int len) {
116 ctx->appendText(
txt, SkTo<size_t>(
len));
119void XMLCALL entity_decl_handler(
void *
data,
120 const XML_Char *entityName,
121 int is_parameter_entity,
122 const XML_Char *
value,
124 const XML_Char *
base,
125 const XML_Char *systemId,
126 const XML_Char *publicId,
127 const XML_Char *notationName) {
130 SkDEBUGF(
"'%s' entity declaration found, stopping processing", entityName);
131 XML_StopParser(ctx->fXMLParser, XML_FALSE);
146 ParsingContext ctx(
this);
147 if (!ctx.fXMLParser) {
148 SkDEBUGF(
"could not create XML parser\n");
155 unsigned long seed =
static_cast<unsigned long>(
156 reinterpret_cast<size_t>(kHashSeed) & 0xFFFFFFFF);
157 XML_SetHashSalt(ctx.fXMLParser, seed ? seed : 1);
159 XML_SetUserData(ctx.fXMLParser, &ctx);
161 XML_SetCharacterDataHandler(ctx.fXMLParser, text_handler);
164 XML_SetEntityDeclHandler(ctx.fXMLParser, entity_decl_handler);
166 XML_Status status = XML_STATUS_OK;
169 status = XML_Parse(ctx.fXMLParser,
179 SkDEBUGF(
"could not buffer enough to continue\n");
186 if (XML_STATUS_ERROR == status) {
191 if (XML_STATUS_ERROR == status) {
193 XML_Error
error = XML_GetErrorCode(ctx.fXMLParser);
194 int line = XML_GetCurrentLineNumber(ctx.fXMLParser);
195 int column = XML_GetCurrentColumnNumber(ctx.fXMLParser);
196 const XML_LChar* errorString = XML_ErrorString(
error);
208 return this->
parse(docStream);
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
static void XMLCALL start_element_handler(void *data, const char *tag, const char **attributes)
static void XMLCALL end_element_handler(void *data, const char *tag)
static const XML_Memory_Handling_Suite sk_XML_alloc
SK_API void sk_free(void *)
static void * sk_malloc_throw(size_t size)
SK_API void * sk_realloc_throw(void *buffer, size_t size)
static const size_t kBufferSize
constexpr int32_t SkToS32(S x)
#define HANDLER_CONTEXT(arg, name)
static char const *const gErrorStrings[]
virtual size_t getPosition() const
virtual bool isAtEnd() const =0
virtual size_t getLength() const
virtual const void * getMemoryBase()
virtual bool hasLength() const
virtual size_t read(void *buffer, size_t size)=0
void set(const SkString &src)
void append(const char text[])
virtual ~SkXMLParserError()
virtual void getErrorString(SkString *str) const
bool startElement(const char elem[])
bool endElement(const char elem[])
virtual bool onEndElement(const char elem[])
static void GetNativeErrorString(int nativeErrorCode, SkString *str)
virtual bool onAddAttribute(const char name[], const char value[])
virtual bool onText(const char text[], int len)
virtual bool onStartElement(const char elem[])
bool addAttribute(const char name[], const char value[])
bool text(const char text[], int len)
bool parse(const char doc[], size_t len)
SkXMLParser(SkXMLParserError *parserError=nullptr)
const uint8_t uint32_t uint32_t GError ** error
DEF_SWITCHES_START aot vmservice shared library name
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