Bug 1441308 - Rename ForEach trait to AsyncForEach r=lsalzman
authorDoug Thayer <dothayer@mozilla.com>
Fri, 22 Mar 2019 18:28:38 +0000
changeset 465756 e36670b15dd6
parent 465755 96da9d241051
child 465757 31eb0acf3a1d
push id35746
push usershindli@mozilla.com
push dateSat, 23 Mar 2019 09:46:24 +0000
treeherdermozilla-central@02b7484f316b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1441308
milestone68.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 1441308 - Rename ForEach trait to AsyncForEach r=lsalzman Just a little rename for clarity - I ended up scratching my head at something for a little more time than I should have because I assumed this was synchronous without looking at the implementation. Differential Revision: https://phabricator.services.mozilla.com/D21584
gfx/wr/webrender/src/glyph_rasterizer/mod.rs
--- a/gfx/wr/webrender/src/glyph_rasterizer/mod.rs
+++ b/gfx/wr/webrender/src/glyph_rasterizer/mod.rs
@@ -602,22 +602,22 @@ impl FontContexts {
     }
 
     // number of contexts associated to workers
     pub fn num_worker_contexts(&self) -> usize {
         self.worker_contexts.len()
     }
 }
 
-pub trait ForEach<T> {
-    fn for_each<F: Fn(MutexGuard<T>) + Send + 'static>(&self, f: F);
+pub trait AsyncForEach<T> {
+    fn async_for_each<F: Fn(MutexGuard<T>) + Send + 'static>(&self, f: F);
 }
 
-impl ForEach<FontContext> for Arc<FontContexts> {
-    fn for_each<F: Fn(MutexGuard<FontContext>) + Send + 'static>(&self, f: F) {
+impl AsyncForEach<FontContext> for Arc<FontContexts> {
+    fn async_for_each<F: Fn(MutexGuard<FontContext>) + Send + 'static>(&self, f: F) {
         // Reset the locked condition.
         let mut locked = self.locked_mutex.lock().unwrap();
         *locked = false;
 
         // Arc that can be safely moved into a spawn closure.
         let font_contexts = self.clone();
         // Spawn a new thread on which to run the for-each off the main thread.
         self.workers.spawn(move || {
@@ -713,17 +713,17 @@ impl GlyphRasterizer {
             next_gpu_glyph_cache_key: GpuGlyphCacheKey(0),
         })
     }
 
     pub fn add_font(&mut self, font_key: FontKey, template: FontTemplate) {
         #[cfg(feature = "pathfinder")]
         self.add_font_to_pathfinder(&font_key, &template);
 
-        self.font_contexts.for_each(move |mut context| {
+        self.font_contexts.async_for_each(move |mut context| {
             context.add_font(&font_key, &template);
         });
     }
 
     pub fn delete_font(&mut self, font_key: FontKey) {
         self.fonts_to_remove.push(font_key);
     }
 
@@ -766,17 +766,17 @@ impl GlyphRasterizer {
 
     fn remove_dead_fonts(&mut self) {
         if self.fonts_to_remove.is_empty() && self.font_instances_to_remove.is_empty() {
             return
         }
 
         let fonts_to_remove = mem::replace(&mut self.fonts_to_remove, Vec::new());
         let font_instances_to_remove = mem::replace(& mut self.font_instances_to_remove, Vec::new());
-        self.font_contexts.for_each(move |mut context| {
+        self.font_contexts.async_for_each(move |mut context| {
             for font_key in &fonts_to_remove {
                 context.delete_font(font_key);
             }
             for instance in &font_instances_to_remove {
                 context.delete_font_instance(instance);
             }
         });
     }