Flutter Engine
flutter_project_bundle.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 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
7 
8 #include <filesystem>
9 #include <string>
10 #include <vector>
11 
12 #include "flutter/shell/platform/embedder/embedder.h"
13 #include "flutter/shell/platform/windows/public/flutter_windows.h"
14 
15 namespace flutter {
16 
20  }
21 };
22 using UniqueAotDataPtr = std::unique_ptr<_FlutterEngineAOTData, AotDataDeleter>;
23 
24 // The data associated with a Flutter project needed to run it in an engine.
26  public:
27  // Creates a new project bundle from the given properties.
28  //
29  // Treats any relative paths as relative to the directory of this executable.
30  explicit FlutterProjectBundle(
31  const FlutterDesktopEngineProperties& properties);
32 
34 
35  // Whether or not the bundle is valid. This does not check that the paths
36  // exist, or contain valid data, just that paths were able to be constructed.
37  bool HasValidPaths();
38 
39  // Returns the path to the assets directory.
40  const std::filesystem::path& assets_path() { return assets_path_; }
41 
42  // Returns the path to the ICU data file.
43  const std::filesystem::path& icu_path() { return icu_path_; }
44 
45  // Returns any switches that should be passed to the engine.
46  const std::vector<std::string> GetSwitches();
47 
48  // Attempts to load AOT data for this bundle. The returned data must be
49  // retained until any engine instance it is passed to has been shut down.
50  //
51  // Logs and returns nullptr on failure.
53 
54  private:
55  std::filesystem::path assets_path_;
56  std::filesystem::path icu_path_;
57 
58  // Path to the AOT library file, if any.
59  std::filesystem::path aot_library_path_;
60 };
61 
62 } // namespace flutter
63 
64 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
const std::filesystem::path & icu_path()
void operator()(FlutterEngineAOTData aot_data)
FlutterEngineResult FlutterEngineCollectAOTData(FlutterEngineAOTData data)
Collects the AOT data.
Definition: embedder.cc:651
const std::filesystem::path & assets_path()
UniqueAotDataPtr LoadAotData(std::filesystem::path aot_data_path)
std::unique_ptr< _FlutterEngineAOTData, AotDataDeleter > UniqueAotDataPtr