Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b732f95

Browse files
committed
Load AOT compiled Dart assets only from ELF libraries
Previously AOT compiled Dart code would be packaged as a group of assets within the APK. This has been replaced by a single ELF library containing the same data.
1 parent 2d0103a commit b732f95

File tree

3 files changed

+80
-257
lines changed

3 files changed

+80
-257
lines changed

shell/common/switches.cc

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -234,42 +234,42 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
234234
command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir),
235235
&settings.assets_path);
236236

237-
std::string aot_shared_library_path;
238-
command_line.GetOptionValue(FlagForSwitch(Switch::AotSharedLibraryPath),
239-
&aot_shared_library_path);
237+
std::string aot_shared_library_name;
238+
command_line.GetOptionValue(FlagForSwitch(Switch::AotSharedLibraryName),
239+
&aot_shared_library_name);
240240

241-
std::string aot_snapshot_path;
242-
command_line.GetOptionValue(FlagForSwitch(Switch::AotSnapshotPath),
243-
&aot_snapshot_path);
241+
std::string snapshot_asset_path;
242+
command_line.GetOptionValue(FlagForSwitch(Switch::SnapshotAssetPath),
243+
&snapshot_asset_path);
244244

245-
std::string aot_vm_snapshot_data_filename;
246-
command_line.GetOptionValue(FlagForSwitch(Switch::AotVmSnapshotData),
247-
&aot_vm_snapshot_data_filename);
245+
std::string vm_snapshot_data_filename;
246+
command_line.GetOptionValue(FlagForSwitch(Switch::VmSnapshotData),
247+
&vm_snapshot_data_filename);
248248

249-
std::string aot_vm_snapshot_instr_filename;
250-
command_line.GetOptionValue(FlagForSwitch(Switch::AotVmSnapshotInstructions),
251-
&aot_vm_snapshot_instr_filename);
249+
std::string vm_snapshot_instr_filename;
250+
command_line.GetOptionValue(FlagForSwitch(Switch::VmSnapshotInstructions),
251+
&vm_snapshot_instr_filename);
252252

253-
std::string aot_isolate_snapshot_data_filename;
254-
command_line.GetOptionValue(FlagForSwitch(Switch::AotIsolateSnapshotData),
255-
&aot_isolate_snapshot_data_filename);
253+
std::string isolate_snapshot_data_filename;
254+
command_line.GetOptionValue(FlagForSwitch(Switch::IsolateSnapshotData),
255+
&isolate_snapshot_data_filename);
256256

257-
std::string aot_isolate_snapshot_instr_filename;
257+
std::string isolate_snapshot_instr_filename;
258258
command_line.GetOptionValue(
259-
FlagForSwitch(Switch::AotIsolateSnapshotInstructions),
260-
&aot_isolate_snapshot_instr_filename);
261-
262-
if (aot_shared_library_path.size() > 0) {
263-
settings.application_library_path = aot_shared_library_path;
264-
} else if (aot_snapshot_path.size() > 0) {
265-
settings.vm_snapshot_data_path = fml::paths::JoinPaths(
266-
{aot_snapshot_path, aot_vm_snapshot_data_filename});
259+
FlagForSwitch(Switch::IsolateSnapshotInstructions),
260+
&isolate_snapshot_instr_filename);
261+
262+
if (aot_shared_library_name.size() > 0) {
263+
settings.application_library_path = aot_shared_library_name;
264+
} else if (snapshot_asset_path.size() > 0) {
265+
settings.vm_snapshot_data_path =
266+
fml::paths::JoinPaths({snapshot_asset_path, vm_snapshot_data_filename});
267267
settings.vm_snapshot_instr_path = fml::paths::JoinPaths(
268-
{aot_snapshot_path, aot_vm_snapshot_instr_filename});
268+
{snapshot_asset_path, vm_snapshot_instr_filename});
269269
settings.isolate_snapshot_data_path = fml::paths::JoinPaths(
270-
{aot_snapshot_path, aot_isolate_snapshot_data_filename});
270+
{snapshot_asset_path, isolate_snapshot_data_filename});
271271
settings.isolate_snapshot_instr_path = fml::paths::JoinPaths(
272-
{aot_snapshot_path, aot_isolate_snapshot_instr_filename});
272+
{snapshot_asset_path, isolate_snapshot_instr_filename});
273273
}
274274

275275
command_line.GetOptionValue(FlagForSwitch(Switch::CacheDirPath),

shell/common/switches.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,30 @@ namespace flutter {
2424
// clang-format on
2525

2626
DEF_SWITCHES_START
27-
DEF_SWITCH(AotSharedLibraryPath, "aot-shared-library-path", "Path to the *.so.")
28-
DEF_SWITCH(AotSnapshotPath,
29-
"aot-snapshot-path",
27+
DEF_SWITCH(AotSharedLibraryName,
28+
"aot-shared-library-name",
29+
"Name of the *.so containing AOT compiled Dart assets.")
30+
DEF_SWITCH(SnapshotAssetPath,
31+
"snapshot-asset-path",
3032
"Path to the directory containing the four files specified by "
31-
"AotVmSnapshotData, AotVmSnapshotInstructions, "
32-
"AotVmSnapshotInstructions and AotIsolateSnapshotInstructions.")
33-
DEF_SWITCH(AotVmSnapshotData,
33+
"VmSnapshotData, VmSnapshotInstructions, "
34+
"VmSnapshotInstructions and IsolateSnapshotInstructions.")
35+
DEF_SWITCH(VmSnapshotData,
3436
"vm-snapshot-data",
3537
"The VM snapshot data that will be memory mapped as read-only. "
36-
"AotSnapshotPath must be present.")
37-
DEF_SWITCH(AotVmSnapshotInstructions,
38+
"SnapshotAssetPath must be present.")
39+
DEF_SWITCH(VmSnapshotInstructions,
3840
"vm-snapshot-instr",
3941
"The VM instructions snapshot that will be memory mapped as read "
40-
"and executable. AotSnapshotPath must be present.")
41-
DEF_SWITCH(AotIsolateSnapshotData,
42+
"and executable. SnapshotAssetPath must be present.")
43+
DEF_SWITCH(IsolateSnapshotData,
4244
"isolate-snapshot-data",
4345
"The isolate snapshot data that will be memory mapped as read-only. "
44-
"AotSnapshotPath must be present.")
45-
DEF_SWITCH(AotIsolateSnapshotInstructions,
46+
"SnapshotAssetPath must be present.")
47+
DEF_SWITCH(IsolateSnapshotInstructions,
4648
"isolate-snapshot-instr",
4749
"The isolate instructions snapshot that will be memory mapped as "
48-
"read and executable. AotSnapshotPath must be present.")
50+
"read and executable. SnapshotAssetPath must be present.")
4951
DEF_SWITCH(CacheDirPath, "cache-dir-path", "Path to the cache directory.")
5052
DEF_SWITCH(ICUDataFilePath, "icu-data-file-path", "Path to the ICU data file.")
5153
DEF_SWITCH(ICUSymbolPrefix,

0 commit comments

Comments
 (0)