From 9aba102005bb2a2b56ab44b870cb92e485608899 Mon Sep 17 00:00:00 2001 From: Yuqian Li Date: Wed, 9 Sep 2020 15:33:33 -0700 Subject: [PATCH] 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 --- engine/src/flutter/shell/common/persistent_cache.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/common/persistent_cache.cc b/engine/src/flutter/shell/common/persistent_cache.cc index c1ec498398..3b1d33d137 100644 --- a/engine/src/flutter/shell/common/persistent_cache.cc +++ b/engine/src/flutter/shell/common/persistent_cache.cc @@ -190,7 +190,11 @@ std::vector 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 mapping = nullptr;