Flutter Engine
The Flutter Engine
includer.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_IMPELLER_COMPILER_INCLUDER_H_
6#define FLUTTER_IMPELLER_COMPILER_INCLUDER_H_
7
8#include <string>
9
10#include "flutter/fml/mapping.h"
12#include "shaderc/shaderc.hpp"
13
14namespace impeller {
15namespace compiler {
16
18 std::string file_name;
19 std::unique_ptr<fml::Mapping> mapping;
20
21 IncluderData(std::string p_file_name, std::unique_ptr<fml::Mapping> p_mapping)
22 : file_name(std::move(p_file_name)), mapping(std::move(p_mapping)) {}
23};
24
25class Includer final : public shaderc::CompileOptions::IncluderInterface {
26 public:
27 Includer(std::shared_ptr<fml::UniqueFD> working_directory,
28 std::vector<IncludeDir> include_dirs,
29 std::function<void(std::string)> on_file_included);
30
31 // |shaderc::CompileOptions::IncluderInterface|
32 ~Includer() override;
33
34 // |shaderc::CompileOptions::IncluderInterface|
35 shaderc_include_result* GetInclude(const char* requested_source,
36 shaderc_include_type type,
37 const char* requesting_source,
38 size_t include_depth) override;
39
40 // |shaderc::CompileOptions::IncluderInterface|
41 void ReleaseInclude(shaderc_include_result* data) override;
42
43 private:
44 std::shared_ptr<fml::UniqueFD> working_directory_;
45 std::vector<IncludeDir> include_dirs_;
46 std::function<void(std::string)> on_file_included_;
47
48 std::unique_ptr<fml::FileMapping> TryOpenMapping(
49 const IncludeDir& dir,
50 const char* requested_source);
51
52 std::unique_ptr<fml::FileMapping> FindFirstMapping(
53 const char* requested_source);
54
55 Includer(const Includer&) = delete;
56
57 Includer& operator=(const Includer&) = delete;
58};
59
60} // namespace compiler
61} // namespace impeller
62
63#endif // FLUTTER_IMPELLER_COMPILER_INCLUDER_H_
GLenum type
Includer(std::shared_ptr< fml::UniqueFD > working_directory, std::vector< IncludeDir > include_dirs, std::function< void(std::string)> on_file_included)
Definition: includer.cc:14
void ReleaseInclude(shaderc_include_result *data) override
Definition: includer.cc:113
shaderc_include_result * GetInclude(const char *requested_source, shaderc_include_type type, const char *requesting_source, size_t include_depth) override
Definition: includer.cc:71
Dart_NativeFunction function
Definition: fuchsia.cc:51
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
Definition: switches.h:145
Definition: ref_ptr.h:256
std::unique_ptr< fml::Mapping > mapping
Definition: includer.h:19
IncluderData(std::string p_file_name, std::unique_ptr< fml::Mapping > p_mapping)
Definition: includer.h:21
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63