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 27 DEF_SWITCHES_START 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 " 34 "VmSnapshotData, VmSnapshotInstructions, " 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, 66 "dart-flags", 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(IPv6, 83 "ipv6", 84 "Bind to the IPv6 localhost address for the Dart Observatory. " 85 "Ignored if --observatory-host is set.") 86 DEF_SWITCH(EnableDartProfiling, 87 "enable-dart-profiling", 88 "Enable Dart profiling. Profiling information can be viewed from " 89 "the observatory.") 90 DEF_SWITCH(EndlessTraceBuffer, 91 "endless-trace-buffer", 92 "Enable an endless trace buffer. The default is a ring buffer. " 93 "This is useful when very old events need to viewed. For example, " 94 "during application launch. Memory usage will continue to grow " 95 "indefinitely however.") 96 DEF_SWITCH(EnableSoftwareRendering, 97 "enable-software-rendering", 98 "Enable rendering using the Skia software backend. This is useful" 99 "when testing Flutter on emulators. By default, Flutter will" 100 "attempt to either use OpenGL or Vulkan.") 101 DEF_SWITCH(SkiaDeterministicRendering, 102 "skia-deterministic-rendering", 103 "Skips the call to SkGraphics::Init(), thus avoiding swapping out" 104 "some Skia function pointers based on available CPU features. This" 105 "is used to obtain 100% deterministic behavior in Skia rendering.") 106 DEF_SWITCH(FlutterAssetsDir, 107 "flutter-assets-dir", 108 "Path to the Flutter assets directory.") 109 DEF_SWITCH(Help, "help", "Display this help text.") 110 DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.") 111 DEF_SWITCH(DisableServiceAuthCodes, 112 "disable-service-auth-codes", 113 "Disable the requirement for authentication codes for communicating" 114 " with the VM service.") 115 DEF_SWITCH(StartPaused, 116 "start-paused", 117 "Start the application paused in the Dart debugger.") 118 DEF_SWITCH(EnableCheckedMode, "enable-checked-mode", "Enable checked mode.") 119 DEF_SWITCH(TraceStartup, 120 "trace-startup", 121 "Trace early application lifecycle. Automatically switches to an " 122 "endless trace buffer.") 123 DEF_SWITCH(TraceSkia, 124 "trace-skia", 125 "Trace Skia calls. This is useful when debugging the GPU threed." 126 "By default, Skia tracing is not enabled to reduce the number of " 127 "traced events") 128 DEF_SWITCH(DumpSkpOnShaderCompilation, 129 "dump-skp-on-shader-compilation", 130 "Automatically dump the skp that triggers new shader compilations. " 131 "This is useful for writing custom ShaderWarmUp to reduce jank. " 132 "By default, this is not enabled to reduce the overhead. ") 133 DEF_SWITCH( 134 TraceSystrace, 135 "trace-systrace", 136 "Trace to the system tracer (instead of the timeline) on platforms where " 137 "such a tracer is available. Currently only supported on Android and " 138 "Fuchsia.") 139 DEF_SWITCH(UseTestFonts, 140 "use-test-fonts", 141 "Running tests that layout and measure text will not yield " 142 "consistent results across various platforms. Enabling this option " 143 "will make font resolution default to the Ahem test font on all " 144 "platforms (See https://www.w3.org/Style/CSS/Test/Fonts/Ahem/). " 145 "This option is only available on the desktop test shells.") 146 DEF_SWITCH(VerboseLogging, 147 "verbose-logging", 148 "By default, only errors are logged. This flag enabled logging at " 149 "all severity levels. This is NOT a per shell flag and affect log " 150 "levels for all shells in the process.") 151 DEF_SWITCH(RunForever, 152 "run-forever", 153 "In non-interactive mode, keep the shell running after the Dart " 154 "script has completed.") 155 DEF_SWITCH(DisableDartAsserts, 156 "disable-dart-asserts", 157 "Dart code runs with assertions enabled when the runtime mode is " 158 "debug. In profile and release product modes, assertions are " 159 "disabled. This flag may be specified if the user wishes to run " 160 "with assertions disabled in the debug product mode (i.e. with JIT " 161 "or DBC).") 162 DEF_SWITCHES_END 163 164 void PrintUsage(const std::string& executable_name); 165 166 const std::string_view FlagForSwitch(Switch swtch); 167 168 Settings SettingsFromCommandLine(const fml::CommandLine& command_line); 169 170 } // namespace flutter 171 172 #endif // SHELL_COMMON_SWITCHES_H_ 173