Flutter Engine
The Flutter Engine
Functions
SkXMLWriter.cpp File Reference
#include "src/xml/SkXMLWriter.h"
#include "include/core/SkStream.h"
#include "include/private/base/SkTo.h"
#include "src/xml/SkXMLParser.h"

Go to the source code of this file.

Functions

static const char * escape_char (char c, char storage[2])
 
static size_t escape_markup (char dst[], const char src[], size_t length)
 
static void write_dom (const SkDOM &dom, const SkDOM::Node *node, SkXMLWriter *w, bool skipRoot)
 

Function Documentation

◆ escape_char()

static const char * escape_char ( char  c,
char  storage[2] 
)
static

Definition at line 88 of file SkXMLWriter.cpp.

88 {
89 static const char* gEscapeChars[] = {
90 "<&lt;",
91 ">&gt;",
92 //"\"&quot;",
93 //"'&apos;",
94 "&&amp;"
95 };
96
97 const char** array = gEscapeChars;
98 for (unsigned i = 0; i < std::size(gEscapeChars); i++) {
99 if (array[i][0] == c) {
100 return &array[i][1];
101 }
102 }
103 storage[0] = c;
104 storage[1] = 0;
105 return storage;
106}
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

◆ escape_markup()

static size_t escape_markup ( char  dst[],
const char  src[],
size_t  length 
)
static

Definition at line 108 of file SkXMLWriter.cpp.

108 {
109 size_t extra = 0;
110 const char* stop = src + length;
111
112 while (src < stop) {
113 char orig[2];
114 const char* seq = escape_char(*src, orig);
115 size_t seqSize = strlen(seq);
116
117 if (dst) {
118 memcpy(dst, seq, seqSize);
119 dst += seqSize;
120 }
121
122 // now record the extra size needed
123 extra += seqSize - 1; // minus one to subtract the original char
124
125 // bump to the next src char
126 src += 1;
127 }
128 return extra;
129}
static const char * escape_char(char c, char storage[2])
Definition: SkXMLWriter.cpp:88
size_t length
dst
Definition: cp.py:12

◆ write_dom()

static void write_dom ( const SkDOM dom,
const SkDOM::Node node,
SkXMLWriter w,
bool  skipRoot 
)
static

Definition at line 152 of file SkXMLWriter.cpp.

152 {
153 if (!skipRoot) {
154 const char* elem = dom.getName(node);
155 if (dom.getType(node) == SkDOM::kText_Type) {
156 SkASSERT(dom.countChildren(node) == 0);
157 w->addText(elem, strlen(elem));
158 return;
159 }
160
161 w->startElement(elem);
162
163 SkDOM::AttrIter iter(dom, node);
164 const char* name;
165 const char* value;
166 while ((name = iter.next(&value)) != nullptr) {
167 w->addAttribute(name, value);
168 }
169 }
170
171 node = dom.getFirstChild(node, nullptr);
172 while (node) {
173 write_dom(dom, node, w, false);
174 node = dom.getNextSibling(node, nullptr);
175 }
176
177 if (!skipRoot) {
178 w->endElement();
179 }
180}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void write_dom(const SkDOM &dom, const SkDOM::Node *node, SkXMLWriter *w, bool skipRoot)
@ kText_Type
Definition: SkDOM.h:44
uint8_t value
Definition: dom.py:1
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
SkScalar w