Bug 1476368 - Avoid moving texture cache entries when evicting them. r=gw
authorNicolas Silva <nsilva@mozilla.com>
Wed, 20 Feb 2019 09:16:44 +0100
changeset 518591 d0c93c9acd660e67bcbcd9d64921b7815452d25c
parent 518590 932ab91a896e6a5ec9383cbf7554dfde26c9bb31
child 518592 659354cec17d666e115e76e64ba2d4c93a259dab
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1476368
milestone67.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 1476368 - Avoid moving texture cache entries when evicting them. r=gw
gfx/wr/webrender/src/texture_cache.rs
--- a/gfx/wr/webrender/src/texture_cache.rs
+++ b/gfx/wr/webrender/src/texture_cache.rs
@@ -605,17 +605,17 @@ impl TextureCache {
             let entry_handles = mem::replace(
                 doc_data.handles.select(kind),
                 Vec::new(),
             );
 
             for handle in entry_handles {
                 let entry = self.entries.free(handle);
                 entry.evict();
-                self.free(entry);
+                self.free(&entry);
             }
         }
         self.per_doc_data = per_doc_data;
     }
 
     fn clear_standalone(&mut self) {
         debug_assert!(!self.now.is_valid());
         self.clear_kind(EntryKind::Standalone);
@@ -968,17 +968,17 @@ impl TextureCache {
                         entry_frame_id < self.now.frame_id()
                     }
                 }
             };
             if evict {
                 let handle = self.doc_data.handles.select(kind).swap_remove(i);
                 let entry = self.entries.free(handle);
                 entry.evict();
-                self.free(entry);
+                self.free(&entry);
             }
         }
     }
 
     /// Expires old shared entries, if we haven't done so this frame.
     ///
     /// Returns true if any entries were expired.
     fn maybe_expire_old_shared_entries(&mut self, threshold: EvictionThreshold) -> bool {
@@ -987,17 +987,17 @@ impl TextureCache {
         if self.doc_data.last_shared_cache_expiration.frame_id() < self.now.frame_id() {
             self.expire_old_entries(EntryKind::Shared, threshold);
             self.doc_data.last_shared_cache_expiration = self.now;
         }
         self.doc_data.handles.shared.len() != old_len
     }
 
     // Free a cache entry from the standalone list or shared cache.
-    fn free(&mut self, entry: CacheEntry) {
+    fn free(&mut self, entry: &CacheEntry) {
         match entry.details {
             EntryDetails::Standalone => {
                 // This is a standalone texture allocation. Free it directly.
                 self.pending_updates.push_free(entry.texture_id);
             }
             EntryDetails::Picture { layer_index } => {
                 self.picture_texture.slices[layer_index].uv_rect_handle = None;
                 if self.debug_flags.contains(
@@ -1233,17 +1233,17 @@ impl TextureCache {
                             (&mut self.doc_data.handles.shared, &mut self.doc_data.handles.standalone),
                         EntryKind::Picture => unreachable!(),
                         EntryKind::Shared =>
                             (&mut self.doc_data.handles.standalone, &mut self.doc_data.handles.shared),
                     };
                     let idx = from.iter().position(|h| h.weak() == *handle).unwrap();
                     to.push(from.remove(idx));
                 }
-                self.free(old_entry);
+                self.free(&old_entry);
             }
             UpsertResult::Inserted(new_handle) => {
                 *handle = new_handle.weak();
                 self.doc_data.handles.select(new_kind).push(new_handle);
             }
         }
     }