9#include "flutter/fml/paths.h"
17 : working_directory_(
std::move(working_directory)),
19 on_file_included_(
std::move(on_file_included)) {}
24std::unique_ptr<fml::FileMapping> Includer::TryOpenMapping(
26 const char* requested_source) {
27 if (!
dir.dir || !
dir.dir->is_valid()) {
31 if (requested_source ==
nullptr) {
35 std::string
source(requested_source);
41 if (!mapping || !mapping->IsValid()) {
50std::unique_ptr<fml::FileMapping> Includer::FindFirstMapping(
51 const char* requested_source) {
57 dir.dir = working_directory_;
58 if (
auto mapping = TryOpenMapping(
dir, requested_source)) {
63 for (
const auto& include_dir : include_dirs_) {
64 if (
auto mapping = TryOpenMapping(include_dir, requested_source)) {
72 shaderc_include_type
type,
73 const char* requesting_source,
74 size_t include_depth) {
75 auto result = std::make_unique<shaderc_include_result>();
79 result->source_name_length = 0;
81 constexpr const char* kFileNotFoundMessage =
"Included file not found.";
82 result->content = kFileNotFoundMessage;
83 result->content_length = ::strlen(kFileNotFoundMessage);
84 result->user_data =
nullptr;
86 if (!working_directory_ || !working_directory_->is_valid()) {
90 if (requested_source ==
nullptr) {
94 auto file = FindFirstMapping(requested_source);
96 if (!
file ||
file->GetMapping() ==
nullptr) {
101 std::make_unique<IncluderData>(requested_source, std::move(
file));
103 result->source_name = includer_data->file_name.c_str();
104 result->source_name_length = includer_data->file_name.length();
106 includer_data->mapping->GetMapping());
107 result->content_length = includer_data->mapping->GetSize();
108 result->user_data = includer_data.release();
static std::unique_ptr< FileMapping > CreateReadOnly(const std::string &path)
Includer(std::shared_ptr< fml::UniqueFD > working_directory, std::vector< IncludeDir > include_dirs, std::function< void(std::string)> on_file_included)
void ReleaseInclude(shaderc_include_result *data) override
shaderc_include_result * GetInclude(const char *requested_source, shaderc_include_type type, const char *requesting_source, size_t include_depth) override
Dart_NativeFunction function
union flutter::testing::@2836::KeyboardChange::@76 content
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
std::string JoinPaths(std::initializer_list< std::string > components)
std::shared_ptr< const fml::Mapping > data