Flutter Engine
switches.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <string_view>
6 
7 #include "flutter/common/settings.h"
8 #include "flutter/fml/command_line.h"
9 
10 #ifndef SHELL_COMMON_SWITCHES_H_
11 #define SHELL_COMMON_SWITCHES_H_
12 
13 namespace flutter {
14 
15 // clang-format off
16 #ifndef DEF_SWITCHES_START
17 #define DEF_SWITCHES_START enum class Switch {
18 #endif
19 #ifndef DEF_SWITCH
20 #define DEF_SWITCH(swtch, flag, help) swtch,
21 #endif
22 #ifndef DEF_SWITCHES_END
23 #define DEF_SWITCHES_END Sentinel, } ;
24 #endif
25 // clang-format on
26 
28 DEF_SWITCH(AotSharedLibraryName,
29  "aot-shared-library-name",
30  "Name of the *.so containing AOT compiled Dart assets.")
31 DEF_SWITCH(SnapshotAssetPath,
32  "snapshot-asset-path",
33  "Path to the directory containing the four files specified by "
35  "VmSnapshotInstructions and IsolateSnapshotInstructions.")
36 DEF_SWITCH(VmSnapshotData,
37  "vm-snapshot-data",
38  "The VM snapshot data that will be memory mapped as read-only. "
39  "SnapshotAssetPath must be present.")
40 DEF_SWITCH(VmSnapshotInstructions,
41  "vm-snapshot-instr",
42  "The VM instructions snapshot that will be memory mapped as read "
43  "and executable. SnapshotAssetPath must be present.")
44 DEF_SWITCH(IsolateSnapshotData,
45  "isolate-snapshot-data",
46  "The isolate snapshot data that will be memory mapped as read-only. "
47  "SnapshotAssetPath must be present.")
48 DEF_SWITCH(IsolateSnapshotInstructions,
49  "isolate-snapshot-instr",
50  "The isolate instructions snapshot that will be memory mapped as "
51  "read and executable. SnapshotAssetPath must be present.")
52 DEF_SWITCH(CacheDirPath,
53  "cache-dir-path",
54  "Path to the cache directory. "
55  "This is different from the persistent_cache_path in embedder.h, "
56  "which is used for Skia shader cache.")
57 DEF_SWITCH(ICUDataFilePath, "icu-data-file-path", "Path to the ICU data file.")
58 DEF_SWITCH(ICUSymbolPrefix,
59  "icu-symbol-prefix",
60  "Prefix for the symbols representing ICU data linked into the "
61  "Flutter library.")
62 DEF_SWITCH(ICUNativeLibPath,
63  "icu-native-lib-path",
64  "Path to the library file that exports the ICU data.")
65 DEF_SWITCH(DartFlags,
67  "Flags passed directly to the Dart VM without being interpreted "
68  "by the Flutter shell.")
69 DEF_SWITCH(DeviceObservatoryHost,
70  "observatory-host",
71  "The hostname/IP address on which the Dart Observatory should "
72  "be served. If not set, defaults to 127.0.0.1 or ::1 depending on "
73  "whether --ipv6 is specified.")
74 DEF_SWITCH(DeviceObservatoryPort,
75  "observatory-port",
76  "A custom Dart Observatory port. The default is to pick a randomly "
77  "available open port.")
78 DEF_SWITCH(DisableObservatory,
79  "disable-observatory",
80  "Disable the Dart Observatory. The observatory is never available "
81  "in release mode.")
82 DEF_SWITCH(DisableObservatoryPublication,
83  "disable-observatory-publication",
84  "Disable mDNS Dart Observatory publication.")
85 DEF_SWITCH(IPv6,
86  "ipv6",
87  "Bind to the IPv6 localhost address for the Dart Observatory. "
88  "Ignored if --observatory-host is set.")
89 DEF_SWITCH(EnableDartProfiling,
90  "enable-dart-profiling",
91  "Enable Dart profiling. Profiling information can be viewed from "
92  "the observatory.")
93 DEF_SWITCH(EndlessTraceBuffer,
94  "endless-trace-buffer",
95  "Enable an endless trace buffer. The default is a ring buffer. "
96  "This is useful when very old events need to viewed. For example, "
97  "during application launch. Memory usage will continue to grow "
98  "indefinitely however.")
99 DEF_SWITCH(EnableSoftwareRendering,
100  "enable-software-rendering",
101  "Enable rendering using the Skia software backend. This is useful "
102  "when testing Flutter on emulators. By default, Flutter will "
103  "attempt to either use OpenGL, Metal, or Vulkan.")
104 DEF_SWITCH(SkiaDeterministicRendering,
105  "skia-deterministic-rendering",
106  "Skips the call to SkGraphics::Init(), thus avoiding swapping out "
107  "some Skia function pointers based on available CPU features. This "
108  "is used to obtain 100% deterministic behavior in Skia rendering.")
109 DEF_SWITCH(FlutterAssetsDir,
110  "flutter-assets-dir",
111  "Path to the Flutter assets directory.")
112 DEF_SWITCH(Help, "help", "Display this help text.")
113 DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.")
114 DEF_SWITCH(DisableServiceAuthCodes,
115  "disable-service-auth-codes",
116  "Disable the requirement for authentication codes for communicating"
117  " with the VM service.")
118 DEF_SWITCH(EnableServicePortFallback,
119  "enable-service-port-fallback",
120  "Allow the VM service to fallback to automatic port selection if"
121  " binding to a specified port fails.")
122 DEF_SWITCH(StartPaused,
123  "start-paused",
124  "Start the application paused in the Dart debugger.")
125 DEF_SWITCH(EnableCheckedMode, "enable-checked-mode", "Enable checked mode.")
126 DEF_SWITCH(TraceStartup,
127  "trace-startup",
128  "Trace early application lifecycle. Automatically switches to an "
129  "endless trace buffer.")
130 DEF_SWITCH(TraceSkia,
131  "trace-skia",
132  "Trace Skia calls. This is useful when debugging the GPU threed."
133  "By default, Skia tracing is not enabled to reduce the number of "
134  "traced events")
135 DEF_SWITCH(TraceWhitelist,
136  "trace-whitelist",
137  "(deprecated) Use --trace-allowlist instead.")
138 DEF_SWITCH(
139  TraceAllowlist,
140  "trace-allowlist",
141  "Filters out all trace events except those that are specified in this "
142  "comma separated list of allowed prefixes.")
143 DEF_SWITCH(DumpSkpOnShaderCompilation,
144  "dump-skp-on-shader-compilation",
145  "Automatically dump the skp that triggers new shader compilations. "
146  "This is useful for writing custom ShaderWarmUp to reduce jank. "
147  "By default, this is not enabled to reduce the overhead. ")
148 DEF_SWITCH(CacheSkSL,
149  "cache-sksl",
150  "Only cache the shader in SkSL instead of binary or GLSL. This "
151  "should only be used during development phases. The generated SkSLs "
152  "can later be used in the release build for shader precompilation "
153  "at launch in order to eliminate the shader-compile jank.")
154 DEF_SWITCH(PurgePersistentCache,
155  "purge-persistent-cache",
156  "Remove all existing persistent cache. This is mainly for debugging "
157  "purposes such as reproducing the shader compilation jank.")
158 DEF_SWITCH(
159  TraceSystrace,
160  "trace-systrace",
161  "Trace to the system tracer (instead of the timeline) on platforms where "
162  "such a tracer is available. Currently only supported on Android and "
163  "Fuchsia.")
164 DEF_SWITCH(UseTestFonts,
165  "use-test-fonts",
166  "Running tests that layout and measure text will not yield "
167  "consistent results across various platforms. Enabling this option "
168  "will make font resolution default to the Ahem test font on all "
169  "platforms (See https://www.w3.org/Style/CSS/Test/Fonts/Ahem/). "
170  "This option is only available on the desktop test shells.")
171 DEF_SWITCH(VerboseLogging,
172  "verbose-logging",
173  "By default, only errors are logged. This flag enabled logging at "
174  "all severity levels. This is NOT a per shell flag and affect log "
175  "levels for all shells in the process.")
176 DEF_SWITCH(RunForever,
177  "run-forever",
178  "In non-interactive mode, keep the shell running after the Dart "
179  "script has completed.")
180 DEF_SWITCH(DisableDartAsserts,
181  "disable-dart-asserts",
182  "Dart code runs with assertions enabled when the runtime mode is "
183  "debug. In profile and release product modes, assertions are "
184  "disabled. This flag may be specified if the user wishes to run "
185  "with assertions disabled in the debug product mode (i.e. with JIT "
186  "or DBC).")
187 DEF_SWITCH(DisallowInsecureConnections,
188  "disallow-insecure-connections",
189  "By default, dart:io allows all socket connections. If this switch "
190  "is set, all insecure connections are rejected.")
191 DEF_SWITCH(DomainNetworkPolicy,
192  "domain-network-policy",
193  "JSON encoded network policy per domain. This overrides the "
194  "DisallowInsecureConnections switch. Embedder can specify whether "
195  "to allow or disallow insecure connections at a domain level.")
196 DEF_SWITCH(
197  ForceMultithreading,
198  "force-multithreading",
199  "Uses separate threads for the platform, UI, GPU and IO task runners. "
200  "By default, a single thread is used for all task runners. Only available "
201  "in the flutter_tester.")
202 
204 
205 void PrintUsage(const std::string& executable_name);
206 
207 const std::string_view FlagForSwitch(Switch swtch);
208 
209 Settings SettingsFromCommandLine(const fml::CommandLine& command_line);
210 
211 } // namespace flutter
212 
213 #endif // SHELL_COMMON_SWITCHES_H_
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
#define DEF_SWITCHES_END
Definition: switches.h:23
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotData
Definition: switches.h:32
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol prefix
Definition: switches.h:59
DEF_SWITCHES_START DEF_SWITCH(AotSharedLibraryName, "aot-shared-library-name", "Name of the *.so containing AOT compiled Dart assets.") DEF_SWITCH(SnapshotAssetPath
Definition: ref_ptr.h:252
Dart_NativeFunction function
Definition: fuchsia.cc:51
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart Flags passed directly to the Dart VM without being interpreted by the Flutter shell observatory port
Definition: switches.h:75
Settings SettingsFromCommandLine(const fml::CommandLine &command_line)
Definition: switches.cc:216
const std::string_view FlagForSwitch(Switch swtch)
Definition: switches.cc:147
Definition: ascii_trie.cc:9
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot instr
Definition: switches.h:41
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart Flags passed directly to the Dart VM without being interpreted by the Flutter shell observatory A custom Dart Observatory port The default is to pick a randomly available open port disable observatory publication
Definition: switches.h:83
Definition: dart_vm.cc:38
switch(event->button)
Definition: fl_view.cc:64
void PrintUsage(const std::string &executable_name)
Definition: switches.cc:93
if(event->type==GDK_BUTTON_PRESS)
Definition: fl_view.cc:79
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart Flags passed directly to the Dart VM without being interpreted by the Flutter shell observatory A custom Dart Observatory port The default is to pick a randomly available open port disable observatory Disable mDNS Dart Observatory publication enable dart profiling
Definition: switches.h:90
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart Flags passed directly to the Dart VM without being interpreted by the Flutter shell observatory A custom Dart Observatory port The default is to pick a randomly available open port disable observatory Disable mDNS Dart Observatory publication enable dart Enable Dart profiling Profiling information can be viewed from the observatory enable software rendering
Definition: switches.h:100
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions
Definition: switches.h:32
#define DEF_SWITCHES_START
Definition: switches.h:17
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart flags
Definition: switches.h:66