Bug 1584101 - Temporarily disable resource cache leak checks. r=jrmuizel
authorNicolas Silva <nsilva@mozilla.com>
Mon, 04 Nov 2019 14:11:22 +0000
changeset 500380 de9d244524e4be16623f91e9738517baaef75ad7
parent 500379 88d9d6ff69d74941cdb3347bf8900c0f45b9fa3c
child 500381 0e0afb29911a5a373119caf27b5b65d70a04a731
push id36763
push userrmaries@mozilla.com
push dateMon, 04 Nov 2019 21:44:06 +0000
treeherdermozilla-central@75a7a3400888 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1584101, 1593013
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1584101 - Temporarily disable resource cache leak checks. r=jrmuizel Bug 1593013 was filed to reenable them. Differential Revision: https://phabricator.services.mozilla.com/D51284
gfx/wr/webrender/Cargo.toml
gfx/wr/webrender/src/resource_cache.rs
gfx/wr/wrench/Cargo.toml
--- a/gfx/wr/webrender/Cargo.toml
+++ b/gfx/wr/webrender/Cargo.toml
@@ -13,16 +13,17 @@ default = ["freetype-lib"]
 freetype-lib = ["freetype/servo-freetype-sys"]
 profiler = ["thread_profiler/thread_profiler"]
 debugger = ["ws", "serde_json", "serde", "image_loader", "base64"]
 capture = ["api/serialize", "ron", "serde", "smallvec/serde"]
 replay = ["api/deserialize", "ron", "serde", "smallvec/serde"]
 display_list_stats = ["api/display_list_stats"]
 serialize_program = ["serde", "webrender_build/serialize_program"]
 no_static_freetype = []
+leak_checks = []
 
 [build-dependencies]
 webrender_build = { version = "0.0.1", path = "../webrender_build" }
 
 [dependencies]
 base64 = { optional = true, version = "0.10" }
 bincode = "1.0"
 bitflags = "1.0"
--- a/gfx/wr/webrender/src/resource_cache.rs
+++ b/gfx/wr/webrender/src/resource_cache.rs
@@ -1953,21 +1953,28 @@ impl ResourceCache {
     fn clear_images<F: Fn(&ImageKey) -> bool>(&mut self, f: F) {
         let keys = self.resources.image_templates.images.keys().filter(|k| f(*k))
             .cloned().collect::<SmallVec<[ImageKey; 16]>>();
 
         for key in keys {
             self.delete_image_template(key);
         }
 
-        let blob_f = |key: &BlobImageKey| { f(&key.as_image()) };
-        debug_assert!(!self.resources.image_templates.images.keys().any(&f));
-        debug_assert!(!self.cached_images.resources.keys().any(&f));
-        debug_assert!(!self.blob_image_templates.keys().any(&blob_f));
-        debug_assert!(!self.rasterized_blob_images.keys().any(&blob_f));
+        #[cfg(features="leak_checks")]
+        let check_leaks = true;
+        #[cfg(not(features="leak_checks"))]
+        let check_leaks = false;
+
+        if check_leaks {
+            let blob_f = |key: &BlobImageKey| { f(&key.as_image()) };
+            assert!(!self.resources.image_templates.images.keys().any(&f));
+            assert!(!self.cached_images.resources.keys().any(&f));
+            assert!(!self.blob_image_templates.keys().any(&blob_f));
+            assert!(!self.rasterized_blob_images.keys().any(&blob_f));
+        }
     }
 }
 
 impl Drop for ResourceCache {
     fn drop(&mut self) {
         self.clear_images(|_| true);
     }
 }
--- a/gfx/wr/wrench/Cargo.toml
+++ b/gfx/wr/wrench/Cargo.toml
@@ -20,17 +20,17 @@ lazy_static = "1"
 log = "0.4"
 yaml-rust = "0.4"
 serde_json = "1.0"
 ron = "0.1.5"
 time = "0.1"
 crossbeam = "0.2"
 osmesa-sys = { version = "0.1.2", optional = true }
 osmesa-src = { git = "https://github.com/servo/osmesa-src", optional = true }
-webrender = {path = "../webrender", features=["capture","replay","debugger","png","profiler","no_static_freetype"]}
+webrender = {path = "../webrender", features=["capture","replay","debugger","png","profiler","no_static_freetype", "leak_checks"]}
 webrender_api = {path = "../webrender_api", features=["serialize","deserialize"]}
 winit = "0.19"
 serde = {version = "1.0", features = ["derive"] }
 semver = "0.9.0"
 
 [dependencies.image]
 version = "0.22"
 default-features = false