Bug 1441308 - Rename ForEach trait to AsyncForEach r=lsalzman
☠☠ backed out by 699a6b6bee44 ☠ ☠
authorDoug Thayer <dothayer@mozilla.com>
Fri, 22 Mar 2019 03:15:16 +0000
changeset 465586 baee8ada680f
parent 465585 c09a51622e98
child 465587 e2f83e4816dd
push id81167
push userdothayer@mozilla.com
push dateFri, 22 Mar 2019 06:31:43 +0000
treeherderautoland@1764701d11d1 [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);
             }
         });
     }