5#include "flutter/shell/common/run_configuration.h"
10#include "flutter/assets/directory_asset_bundle.h"
11#include "flutter/common/graphics/persistent_cache.h"
12#include "flutter/fml/file.h"
13#include "flutter/fml/unique_fd.h"
14#include "flutter/runtime/dart_vm.h"
15#include "flutter/runtime/isolate_configuration.h"
23 auto asset_manager = std::make_shared<AssetManager>();
26 asset_manager->PushBack(std::make_unique<DirectoryAssetBundle>(
30 asset_manager->PushBack(std::make_unique<DirectoryAssetBundle>(
36 io_worker, launch_type),
41 std::unique_ptr<IsolateConfiguration> configuration)
50 std::unique_ptr<IsolateConfiguration> configuration,
51 std::shared_ptr<AssetManager> asset_manager)
52 : isolate_configuration_(
std::move(configuration)),
53 asset_manager_(
std::move(asset_manager)) {
64 return asset_manager_ && isolate_configuration_;
68 std::unique_ptr<AssetResolver> resolver) {
69 if (!resolver || !resolver->IsValid()) {
73 asset_manager_->PushBack(std::move(resolver));
78 entrypoint_ = std::move(entrypoint);
82 std::string library) {
84 entrypoint_library_ = std::move(library);
88 std::vector<std::string> entrypoint_args) {
89 entrypoint_args_ = std::move(entrypoint_args);
93 return asset_manager_;
101 return entrypoint_library_;
105 return entrypoint_args_;
108std::unique_ptr<IsolateConfiguration>
110 return std::move(isolate_configuration_);
static std::unique_ptr< IsolateConfiguration > InferFromSettings(const Settings &settings, const std::shared_ptr< AssetManager > &asset_manager=nullptr, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer the isolate configuration from the Settings object. If the VM is configured for AOT...
static void SetAssetManager(std::shared_ptr< AssetManager > value)
Specifies all the configuration required by the runtime library to launch the root isolate....
std::unique_ptr< IsolateConfiguration > TakeIsolateConfiguration()
The engine uses this to take the isolate configuration from the run configuration....
std::shared_ptr< AssetManager > GetAssetManager() const
const std::string & GetEntrypoint() const
void SetEntrypointArgs(std::vector< std::string > entrypoint_args)
Updates the main application entrypoint arguments.
const std::vector< std::string > & GetEntrypointArgs() const
void SetEntrypointAndLibrary(std::string entrypoint, std::string library)
Specifies the main Dart entrypoint and the library to find that entrypoint in. By default,...
bool AddAssetResolver(std::unique_ptr< AssetResolver > resolver)
Asset managers maintain a list of resolvers that are checked in order when attempting to locate an as...
bool IsValid() const
A valid run configuration only guarantees that the engine should be able to find the assets and the i...
void SetEntrypoint(std::string entrypoint)
Updates the main application entrypoint. If this is not set, the "main" method is used as the entrypo...
RunConfiguration(std::unique_ptr< IsolateConfiguration > configuration)
Creates a run configuration with only an isolate configuration. There is no asset manager and default...
~RunConfiguration()
There are no threading restrictions on the destruction of the run configuration.
const std::string & GetEntrypointLibrary() const
static RunConfiguration InferFromSettings(const Settings &settings, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer a run configuration from the settings object. This tries to create a run configurat...
fml::UniqueFD Duplicate(fml::UniqueFD::element_type descriptor)
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
static bool IsValid(int value)