mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Replaces the (temporary) compile-time option to pass engine switches with the ability to pass them temporarily at runtime via environment variables. This is enabled only for debug/profile to avoid potential issues with tampering with released applicaitons, but if there is a need for that in the future it could be added (potentially with a whitelist, as is currently used for Dart VM flags). Windows portion of: https://github.com/flutter/flutter/issues/38569 https://github.com/flutter/flutter/issues/60393
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
|
|
#define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "flutter/shell/platform/embedder/embedder.h"
|
|
#include "flutter/shell/platform/windows/public/flutter_windows.h"
|
|
|
|
namespace flutter {
|
|
|
|
struct AotDataDeleter {
|
|
void operator()(FlutterEngineAOTData aot_data) {
|
|
FlutterEngineCollectAOTData(aot_data);
|
|
}
|
|
};
|
|
using UniqueAotDataPtr = std::unique_ptr<_FlutterEngineAOTData, AotDataDeleter>;
|
|
|
|
// The data associated with a Flutter project needed to run it in an engine.
|
|
class FlutterProjectBundle {
|
|
public:
|
|
// Creates a new project bundle from the given properties.
|
|
//
|
|
// Treats any relative paths as relative to the directory of this executable.
|
|
explicit FlutterProjectBundle(
|
|
const FlutterDesktopEngineProperties& properties);
|
|
|
|
~FlutterProjectBundle();
|
|
|
|
// Whether or not the bundle is valid. This does not check that the paths
|
|
// exist, or contain valid data, just that paths were able to be constructed.
|
|
bool HasValidPaths();
|
|
|
|
// Returns the path to the assets directory.
|
|
const std::filesystem::path& assets_path() { return assets_path_; }
|
|
|
|
// Returns the path to the ICU data file.
|
|
const std::filesystem::path& icu_path() { return icu_path_; }
|
|
|
|
// Returns any switches that should be passed to the engine.
|
|
const std::vector<std::string> GetSwitches();
|
|
|
|
// Attempts to load AOT data for this bundle. The returned data must be
|
|
// retained until any engine instance it is passed to has been shut down.
|
|
//
|
|
// Logs and returns nullptr on failure.
|
|
UniqueAotDataPtr LoadAotData();
|
|
|
|
private:
|
|
std::filesystem::path assets_path_;
|
|
std::filesystem::path icu_path_;
|
|
|
|
// Path to the AOT library file, if any.
|
|
std::filesystem::path aot_library_path_;
|
|
};
|
|
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
|