#include <persistent_cache.h>
Classes | |
| struct | CacheObjectHeader |
| struct | SkSLCache |
Public Member Functions | |
| ~PersistentCache () override | |
| void | AddWorkerTaskRunner (const fml::RefPtr< fml::TaskRunner > &task_runner) |
| void | RemoveWorkerTaskRunner (const fml::RefPtr< fml::TaskRunner > &task_runner) |
| bool | StoredNewShaders () const |
| void | ResetStoredNewShaders () |
| void | DumpSkp (const SkData &data) |
| bool | IsDumpingSkp () const |
| void | SetIsDumpingSkp (bool value) |
| bool | Purge () |
| sk_sp< SkData > | load (const SkData &key) override |
| std::vector< SkSLCache > | LoadSkSLs () const |
| Load all the SkSL shader caches in the right directory. | |
| size_t | PrecompileKnownSkSLs (GrDirectContext *context) const |
| Precompile SkSLs packaged with the application and gathered during previous runs in the given context. | |
| std::vector< std::unique_ptr< fml::Mapping > > | GetSkpsFromAssetManager () const |
Static Public Member Functions | |
| static PersistentCache * | GetCacheForProcess () |
| static void | ResetCacheForProcess () |
| static void | SetCacheDirectoryPath (std::string path) |
| static std::string | SkKeyToFilePath (const SkData &key) |
| static std::unique_ptr< fml::MallocMapping > | BuildCacheObject (const SkData &key, const SkData &data) |
| static void | SetAssetManager (std::shared_ptr< AssetManager > value) |
| static std::shared_ptr< AssetManager > | asset_manager () |
| static bool | cache_sksl () |
| static void | SetCacheSkSL (bool value) |
| static void | MarkStrategySet () |
Static Public Attributes | |
| static bool | gIsReadOnly = false |
| static constexpr char | kSkSLSubdirName [] = "sksl" |
| static constexpr char | kAssetFileName [] = "io.flutter.shaders.json" |
Friends | |
| class | testing::ShellTest |
A cache of SkData that gets stored to disk.
This is mainly used for Shaders but is also written to by Dart. It is thread-safe for reading and writing from multiple threads.
Definition at line 32 of file persistent_cache.h.
|
overridedefault |
| void flutter::PersistentCache::AddWorkerTaskRunner | ( | const fml::RefPtr< fml::TaskRunner > & | task_runner | ) |
Definition at line 446 of file persistent_cache.cc.
|
inlinestatic |
Definition at line 124 of file persistent_cache.h.
|
static |
Definition at line 380 of file persistent_cache.cc.
References flutter::data, and key.
|
inlinestatic |
Definition at line 128 of file persistent_cache.h.
Referenced by flutter::MakeDefaultContextOptions().
| void flutter::PersistentCache::DumpSkp | ( | const SkData & | data | ) |
Definition at line 428 of file persistent_cache.cc.
References flutter::data, FML_LOG, fml::TimePoint::Now(), flutter::PersistentCacheStore(), fml::TimePoint::ToEpochDelta(), and fml::TimeDelta::ToNanoseconds().
|
static |
Definition at line 65 of file persistent_cache.cc.
References gIsReadOnly.
Referenced by flutter::testing::CheckTwoSkSLsAreLoaded(), flutter::Shell::GetSettings(), flutter::MakeDefaultContextOptions(), flutter::GPUSurfaceGLSkia::MakeGLContext(), flutter::testing::ResetAssetManager(), flutter::testing::TEST_F(), and flutter::testing::TEST_F().
| std::vector< std::unique_ptr< fml::Mapping > > flutter::PersistentCache::GetSkpsFromAssetManager | ( | ) | const |
Definition at line 478 of file persistent_cache.cc.
References FML_LOG.
|
inline |
Definition at line 85 of file persistent_cache.h.
|
override |
Definition at line 332 of file persistent_cache.cc.
References key, SkKeyToFilePath(), and TRACE_EVENT0.
| std::vector< PersistentCache::SkSLCache > flutter::PersistentCache::LoadSkSLs | ( | ) | const |
Load all the SkSL shader caches in the right directory.
Definition at line 223 of file persistent_cache.cc.
References FML_LOG, fml::UniqueObject< T, Traits >::is_valid(), flutter::PersistentCache::SkSLCache::key, key, fml::OpenDirectoryReadOnly(), flutter::ParseBase32(), flutter::ParseBase64(), TRACE_EVENT0, flutter::PersistentCache::SkSLCache::value, and fml::VisitFiles().
Referenced by flutter::testing::CheckTwoSkSLsAreLoaded(), and flutter::testing::TEST_F().
|
inlinestatic |
Definition at line 132 of file persistent_cache.h.
Referenced by flutter::MakeDefaultContextOptions().
| size_t flutter::PersistentCache::PrecompileKnownSkSLs | ( | GrDirectContext * | context | ) | const |
Precompile SkSLs packaged with the application and gathered during previous runs in the given context.
| context | The rendering context to precompile shaders in. |
Definition at line 196 of file persistent_cache.cc.
References FML_TRACE_COUNTER, FML_TRACE_EVENT, and TRACE_EVENT0.
Referenced by flutter::GPUSurfaceGLSkia::MakeGLContext().
| bool flutter::PersistentCache::Purge | ( | ) |
Definition at line 83 of file persistent_cache.cc.
References FML_CHECK, and fml::TaskRunner::PostTask().
Referenced by flutter::Shell::GetSettings().
| void flutter::PersistentCache::RemoveWorkerTaskRunner | ( | const fml::RefPtr< fml::TaskRunner > & | task_runner | ) |
Definition at line 452 of file persistent_cache.cc.
|
static |
Definition at line 73 of file persistent_cache.cc.
References gIsReadOnly.
Referenced by flutter::testing::TEST_F(), flutter::testing::TEST_F(), and flutter::testing::TEST_F().
|
inline |
Definition at line 83 of file persistent_cache.h.
|
static |
Set the asset manager from which PersistentCache can load SkLSs. A nullptr can be provided to clear the asset manager.
Definition at line 472 of file persistent_cache.cc.
References TRACE_EVENT_INSTANT0, and value.
Referenced by flutter::testing::ResetAssetManager(), flutter::RunConfiguration::RunConfiguration(), and flutter::RunConfiguration::RunConfiguration().
|
static |
Definition at line 79 of file persistent_cache.cc.
References flutter::path.
Referenced by FlutterEngineInitialize(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), and flutter::testing::TEST_F().
|
static |
Definition at line 56 of file persistent_cache.cc.
|
inline |
|
static |
Definition at line 38 of file persistent_cache.cc.
References fml::HexEncode(), key, and view.
Referenced by load(), and flutter::testing::TEST_F().
|
inline |
Definition at line 82 of file persistent_cache.h.
|
friend |
Definition at line 177 of file persistent_cache.h.
|
static |
Definition at line 39 of file persistent_cache.h.
Referenced by FlutterEngineInitialize(), GetCacheForProcess(), and ResetCacheForProcess().
|
staticconstexpr |
Definition at line 135 of file persistent_cache.h.
Referenced by flutter::testing::TEST_F().
|
staticconstexpr |
Definition at line 134 of file persistent_cache.h.