17 const char* shortName,
19 const char* defaultValue,
20 const char* helpString,
21 const char* extendedHelpString) {
26 info->fStrings = pStrings;
32 const char* defaultValue) {
39 if (defaultLength > 0) {
40 const char*
const defaultEnd =
defaultValue + defaultLength;
46 if (
begin < defaultEnd) {
48 while (
end < defaultEnd &&
' ' != *
end) {
62 for (
size_t i = 0;
i <
len;
i++) {
78 static const char* trueValues[] = {
"1",
"TRUE",
"true"};
83 static const char* falseValues[] = {
"0",
"FALSE",
"false"};
88 SkDebugf(
"Parameter \"%s\" not supported.\n",
string);
102 compareName = &fShortName;
106 if (compareName->
equals(
string)) {
113 if (fName.
equals(
string)) {
120 if (equalIndex > 0) {
123 if (
flag.equals(*compareName)) {
125 string += equalIndex + 1;
133 return compareName->
equals(
string);
148#define LINE_LENGTH 72
152 const char* currLine =
text.c_str();
153 const char* stop = currLine +
length;
154 while (currLine < stop) {
155 int lineBreak =
SkStrFind(currLine,
"\n");
157 lineBreak =
static_cast<int>(strlen(currLine));
163 while (spaceIndex > 0 && currLine[spaceIndex] !=
' ') {
167 if (0 == spaceIndex) {
175 SkDebugf(
" %.*s\n", spaceIndex, currLine);
176 currLine += spaceIndex + gap;
180 SkDebugf(
" %.*s", lineBreak, currLine);
181 currLine += lineBreak;
189 if (shortName.
size() > 0) {
193 if (
flag->defaultValue().size() > 0) {
194 SkDebugf(
"\tdefault: %s",
flag->defaultValue().c_str());
208struct CompareFlagsByName {
210 return strcmp(
a->name().c_str(),
b->name().c_str()) < 0;
219 SkDebugf(
"Parse should only be called once at the beginning of main!\n");
225 bool helpPrinted =
false;
226 bool flagsPrinted =
false;
228 for (
int i = 1;
i < argc;
i++) {
229 if (0 == strcmp(
"-h",
argv[
i]) || 0 == strcmp(
"--help",
argv[
i])) {
232 for (
int j =
i + 1; j < argc; j++) {
238 if (0 == helpFlags.
size()) {
246 if (0 == helpFlags.
size()) {
255 if (
flag->extendedHelp().size() > 0) {
256 SkDebugf(
" Use '--help %s' for more information.\n",
257 flag->name().c_str());
262 for (
int k = 0; k < helpFlags.
size(); k++) {
263 if (
flag->name().equals(helpFlags[k]) ||
264 flag->shortName().equals(helpFlags[k])) {
272 if (helpFlags.
size() > 0) {
273 SkDebugf(
"Requested help for unrecognized flags:\n");
274 for (
int k = 0; k < helpFlags.
size(); k++) {
284 while (
flag !=
nullptr) {
293 switch (
flag->getFlagType()) {
306 flag->resetStrings();
308 while (
i + 1 < argc) {
333#if defined(SK_BUILD_FOR_MAC)
348 while (
flag !=
nullptr) {
360template <
typename Strings>
bool ShouldSkipImpl(
const Strings& strings,
const char*
name) {
361 int count = strings.size();
362 size_t testLen = strlen(
name);
363 bool anyExclude =
count == 0;
364 for (
int i = 0;
i < strings.size(); ++
i) {
365 const char* matchName = strings[
i];
366 size_t matchLen = strlen(matchName);
367 bool matchExclude, matchStart, matchEnd;
368 if ((matchExclude = matchName[0] ==
'~')) {
373 if ((matchStart = matchName[0] ==
'^')) {
377 if ((matchEnd = matchName[matchLen - 1] ==
'$')) {
381 ? (!matchEnd || matchLen == testLen) && strncmp(
name, matchName, matchLen) == 0
383 ? matchLen <= testLen &&
384 strncmp(
name + testLen - matchLen, matchName, matchLen) == 0
385 : strstr(
name, matchName) !=
nullptr) {
395 return ShouldSkipImpl(strings,
name);
398 return ShouldSkipImpl(strings,
name);
static void print_indented(const SkString &text)
static bool parse_bool_arg(const char *string, bool *result)
static void print_extended_help_for_flag(const SkFlagInfo *flag)
static void ignore_result(const T &)
static void print_help_for_flag(const SkFlagInfo *flag)
static bool string_is_in(const char *target, const char *set[], size_t len)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static float next(float f)
#define SkDEBUGFAIL(message)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool SkStrStartsWith(const char string[], const char prefixStr[])
static int SkStrFind(const char string[], const char substring[])
void SkTQSort(T *begin, T *end, const C &lessThan)
static bool ShouldSkip(const SkTDArray< const char * > &strings, const char *name)
static void Parse(int argc, const char *const *argv)
static void SetUsage(const char *usage)
FlagTypes getFlagType() const
const SkString & name() const
const SkString & shortName() const
static bool CreateStringFlag(const char *name, const char *shortName, CommandLineFlags::StringArray *pStrings, const char *defaultValue, const char *helpString, const char *extendedHelpString)
bool match(const char *string)
SkString defaultValue() const
void set(const SkString &src)
bool equals(const SkString &) const
const char * c_str() const
void push_back(const T &v)
void remove(int index, int count=1)
static const char * begin(const StringSlice &s)
FlutterSemanticsFlag flag
DEF_SWITCHES_START aot vmservice shared library name
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
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 set
static void usage(char *argv0)