Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
flutter::APKAssetProvider Class Referencefinal

#include <apk_asset_provider.h>

Inheritance diagram for flutter::APKAssetProvider:
flutter::AssetResolver

Public Member Functions

 APKAssetProvider (JNIEnv *env, jobject assetManager, std::string directory)
 
 APKAssetProvider (std::shared_ptr< APKAssetProviderInternal > impl)
 
 ~APKAssetProvider ()=default
 
std::unique_ptr< APKAssetProviderClone () const
 
APKAssetProviderInternalGetImpl () const
 
bool operator== (const AssetResolver &other) const override
 
- Public Member Functions inherited from flutter::AssetResolver
 AssetResolver ()=default
 
virtual ~AssetResolver ()=default
 
virtual const AssetManageras_asset_manager () const
 
virtual const DirectoryAssetBundleas_directory_asset_bundle () const
 
virtual std::vector< std::unique_ptr< fml::Mapping > > GetAsMappings (const std::string &asset_pattern, const std::optional< std::string > &subdir) const
 Same as GetAsMapping() but returns mappings for all files who's name matches a given pattern. Returns empty vector if no matching assets are found.
 
bool operator!= (const AssetResolver &other) const
 

Private Member Functions

bool IsValid () const override
 
bool IsValidAfterAssetManagerChange () const override
 Certain asset resolvers are still valid after the asset manager is replaced before a hot reload, or after a new run configuration is created during a hot restart. By preserving these resolvers and re-inserting them into the new resolver or run configuration, the tooling can avoid needing to sync all application assets through the Dart devFS upon connecting to the VM Service. Besides improving the startup performance of running a Flutter application, it also reduces the occurrence of tool failures due to repeated network flakes caused by damaged cables or hereto unknown bugs in the Dart HTTP server implementation.
 
AssetResolver::AssetResolverType GetType () const override
 Gets the type of AssetResolver this is. Types are defined in AssetResolverType.
 
std::unique_ptr< fml::MappingGetAsMapping (const std::string &asset_name) const override
 
const APKAssetProvideras_apk_asset_provider () const override
 

Additional Inherited Members

- Public Types inherited from flutter::AssetResolver
enum  AssetResolverType { kAssetManager , kApkAssetProvider , kDirectoryAssetBundle }
 Identifies the type of AssetResolver an instance is. More...
 

Detailed Description

Definition at line 26 of file apk_asset_provider.h.

Constructor & Destructor Documentation

◆ APKAssetProvider() [1/2]

flutter::APKAssetProvider::APKAssetProvider ( JNIEnv *  env,
jobject  assetManager,
std::string  directory 
)
explicit

Definition at line 71 of file apk_asset_provider.cc.

74 : impl_(std::make_shared<APKAssetProviderImpl>(env,
75 assetManager,
76 std::move(directory))) {}
Definition __init__.py:1

◆ APKAssetProvider() [2/2]

flutter::APKAssetProvider::APKAssetProvider ( std::shared_ptr< APKAssetProviderInternal impl)
explicit

Definition at line 78 of file apk_asset_provider.cc.

80 : impl_(std::move(impl)) {}

◆ ~APKAssetProvider()

flutter::APKAssetProvider::~APKAssetProvider ( )
default

Member Function Documentation

◆ as_apk_asset_provider()

const APKAssetProvider * flutter::APKAssetProvider::as_apk_asset_provider ( ) const
inlineoverrideprivatevirtual

Reimplemented from flutter::AssetResolver.

Definition at line 65 of file apk_asset_provider.h.

65 {
66 return this;
67 }

◆ Clone()

std::unique_ptr< APKAssetProvider > flutter::APKAssetProvider::Clone ( ) const

Definition at line 103 of file apk_asset_provider.cc.

103 {
104 return std::make_unique<APKAssetProvider>(impl_);
105}

◆ GetAsMapping()

std::unique_ptr< fml::Mapping > flutter::APKAssetProvider::GetAsMapping ( const std::string &  asset_name) const
overrideprivatevirtual

Implements flutter::AssetResolver.

Definition at line 98 of file apk_asset_provider.cc.

99 {
100 return impl_->GetAsMapping(asset_name);
101}

◆ GetImpl()

APKAssetProviderInternal * flutter::APKAssetProvider::GetImpl ( ) const
inline

Definition at line 44 of file apk_asset_provider.h.

44{ return impl_.get(); }

◆ GetType()

AssetResolver::AssetResolverType flutter::APKAssetProvider::GetType ( ) const
overrideprivatevirtual

Gets the type of AssetResolver this is. Types are defined in AssetResolverType.

Returns
Returns the AssetResolverType that this resolver is.

Implements flutter::AssetResolver.

Definition at line 93 of file apk_asset_provider.cc.

◆ IsValid()

bool flutter::APKAssetProvider::IsValid ( ) const
overrideprivatevirtual

Implements flutter::AssetResolver.

Definition at line 83 of file apk_asset_provider.cc.

83 {
84 return true;
85}

◆ IsValidAfterAssetManagerChange()

bool flutter::APKAssetProvider::IsValidAfterAssetManagerChange ( ) const
overrideprivatevirtual

Certain asset resolvers are still valid after the asset manager is replaced before a hot reload, or after a new run configuration is created during a hot restart. By preserving these resolvers and re-inserting them into the new resolver or run configuration, the tooling can avoid needing to sync all application assets through the Dart devFS upon connecting to the VM Service. Besides improving the startup performance of running a Flutter application, it also reduces the occurrence of tool failures due to repeated network flakes caused by damaged cables or hereto unknown bugs in the Dart HTTP server implementation.

Returns
Returns whether this resolver is valid after the asset manager or run configuration is updated.

Implements flutter::AssetResolver.

Definition at line 88 of file apk_asset_provider.cc.

88 {
89 return true;
90}

◆ operator==()

bool flutter::APKAssetProvider::operator== ( const AssetResolver other) const
overridevirtual

Implements flutter::AssetResolver.

Definition at line 107 of file apk_asset_provider.cc.

107 {
108 auto other_provider = other.as_apk_asset_provider();
109 if (!other_provider) {
110 return false;
111 }
112 return impl_ == other_provider->impl_;
113}

The documentation for this class was generated from the following files: