Open a fresh dir during LoadSkSLs (flutter/engine#21050)

Fixes https://github.com/flutter/flutter/issues/65258

The following devicelab tests should pass after this patch:

- flutter_gallery_sksl_warmup__transition_perf_e2e_ios32
- flutter_gallery_sksl_warmup_ios32__transition_perf
This commit is contained in:
Yuqian Li
2020-09-09 15:33:33 -07:00
committed by GitHub
parent abeffd6fcb
commit 9aba102005

View File

@@ -190,7 +190,11 @@ std::vector<PersistentCache::SkSLCache> PersistentCache::LoadSkSLs() {
// However, we'd like to continue visit the asset dir even if this persistent
// cache is invalid.
if (IsValid()) {
fml::VisitFiles(*sksl_cache_directory_, visitor);
// In case `rewinddir` doesn't work reliably, load SkSLs from a freshly
// opened directory (https://github.com/flutter/flutter/issues/65258).
fml::UniqueFD fresh_dir =
fml::OpenDirectoryReadOnly(*cache_directory_, kSkSLSubdirName);
fml::VisitFiles(fresh_dir, visitor);
}
std::unique_ptr<fml::Mapping> mapping = nullptr;