Flutter Engine
 
Loading...
Searching...
No Matches
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
14
15namespace flutter {
16
18 std::unique_ptr<_FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr>;
19
24
30
31// The data associated with a Flutter project needed to run it in an engine.
33 public:
34 // Creates a new project bundle from the given properties.
35 //
36 // Treats any relative paths as relative to the directory of this executable.
37 explicit FlutterProjectBundle(
38 const FlutterDesktopEngineProperties& properties);
39
41
42 // Whether or not the bundle is valid. This does not check that the paths
43 // exist, or contain valid data, just that paths were able to be constructed.
44 bool HasValidPaths();
45
46 // Returns the path to the assets directory.
47 const std::filesystem::path& assets_path() { return assets_path_; }
48
49 // Returns the path to the ICU data file.
50 const std::filesystem::path& icu_path() { return icu_path_; }
51
52 // Returns any switches that should be passed to the engine.
53 const std::vector<std::string> GetSwitches();
54
55 // Sets engine switches.
56 void SetSwitches(const std::vector<std::string>& switches);
57
58 // Attempts to load AOT data for this bundle. The returned data must be
59 // retained until any engine instance it is passed to has been shut down.
60 //
61 // Logs and returns nullptr on failure.
63
64 // Returns the Dart entrypoint.
65 const std::string& dart_entrypoint() const { return dart_entrypoint_; }
66
67 // Returns the command line arguments to be passed through to the Dart
68 // entrypoint.
69 const std::vector<std::string>& dart_entrypoint_arguments() const {
70 return dart_entrypoint_arguments_;
71 }
72
73 // Returns the app's GPU preference.
74 FlutterGpuPreference gpu_preference() const { return gpu_preference_; }
75
76 // Returns thread policy for running the UI isolate.
77 FlutterUIThreadPolicy ui_thread_policy() { return ui_thread_policy_; }
78
79 private:
80 std::filesystem::path assets_path_;
81 std::filesystem::path icu_path_;
82
83 // Path to the AOT library file, if any.
84 std::filesystem::path aot_library_path_;
85
86 // The Dart entrypoint to launch.
87 std::string dart_entrypoint_;
88
89 // Dart entrypoint arguments.
90 std::vector<std::string> dart_entrypoint_arguments_;
91
92 // Engine switches.
93 std::vector<std::string> engine_switches_;
94
95 // App's GPU preference.
96 FlutterGpuPreference gpu_preference_;
97
98 // Thread policy for running the UI isolate.
99 FlutterUIThreadPolicy ui_thread_policy_;
100};
101
102} // namespace flutter
103
104#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
const std::filesystem::path & assets_path()
FlutterGpuPreference gpu_preference() const
const std::vector< std::string > GetSwitches()
const std::string & dart_entrypoint() const
const std::vector< std::string > & dart_entrypoint_arguments() const
UniqueAotDataPtr LoadAotData(const FlutterEngineProcTable &engine_procs)
const std::filesystem::path & icu_path()
FlutterUIThreadPolicy ui_thread_policy()
void SetSwitches(const std::vector< std::string > &switches)
std::unique_ptr< _FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr > UniqueAotDataPtr
Function-pointer-based versions of the APIs above.
Definition embedder.h:3704