Flutter Engine
directory_asset_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_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
6 #define FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
7 
8 #include <optional>
9 #include "flutter/assets/asset_resolver.h"
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/memory/ref_counted.h"
12 #include "flutter/fml/unique_fd.h"
13 
14 namespace flutter {
15 
17  public:
19  bool is_valid_after_asset_manager_change);
20 
21  ~DirectoryAssetBundle() override;
22 
23  private:
24  const fml::UniqueFD descriptor_;
25  bool is_valid_ = false;
26  bool is_valid_after_asset_manager_change_ = false;
27 
28  // |AssetResolver|
29  bool IsValid() const override;
30 
31  // |AssetResolver|
32  bool IsValidAfterAssetManagerChange() const override;
33 
34  // |AssetResolver|
35  AssetResolver::AssetResolverType GetType() const override;
36 
37  // |AssetResolver|
38  std::unique_ptr<fml::Mapping> GetAsMapping(
39  const std::string& asset_name) const override;
40 
41  // |AssetResolver|
42  std::vector<std::unique_ptr<fml::Mapping>> GetAsMappings(
43  const std::string& asset_pattern,
44  const std::optional<std::string>& subdir) const override;
45 
46  FML_DISALLOW_COPY_AND_ASSIGN(DirectoryAssetBundle);
47 };
48 
49 } // namespace flutter
50 
51 #endif // FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
DirectoryAssetBundle(fml::UniqueFD descriptor, bool is_valid_after_asset_manager_change)
AssetResolverType
Identifies the type of AssetResolver an instance is.