Bug 1801767 - Remove fs::remove_dir_all usage in remove_disk_cache() r=gfx-reviewers,bradwerth

From Bug 1799442, fs::remove_dir_all is not stable on Windows.

Differential Revision: https://phabricator.services.mozilla.com/D162682
This commit is contained in:
sotaro 2022-11-22 05:35:25 +00:00
parent f5ed77ef10
commit 71a7be2831
3 changed files with 3 additions and 2 deletions

1
Cargo.lock generated
View file

@ -6178,6 +6178,7 @@ dependencies = [
"webrender",
"winapi",
"wr_malloc_size_of",
"remove_dir_all",
]
[[package]]

View file

@ -21,6 +21,7 @@ thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
swgl = { path = "../wr/swgl" }
wr_malloc_size_of = { path = "../wr/wr_malloc_size_of" }
gecko-profiler = { path = "../../tools/profiler/rust-api" }
remove_dir_all = "0.5.3"
[dependencies.webrender]
path = "../wr/webrender"

View file

@ -342,13 +342,12 @@ impl WrProgramCache {
}
pub fn remove_disk_cache(prof_path: &nsAString) -> Result<(), Error> {
use std::fs::remove_dir_all;
use std::time::Instant;
if let Some(cache_path) = get_cache_path_from_prof_path(prof_path) {
if cache_path.exists() {
let start = Instant::now();
remove_dir_all(&cache_path)?;
remove_dir_all::remove_dir_all(&cache_path)?;
info!("removed all disk cache shaders in {:?}", start.elapsed());
}
}