mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #8385 - frewsxcv:compositing-iterators, r=Manishearth
Use more iterators in compositing component <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8385) <!-- Reviewable:end -->
This commit is contained in:
commit
3510cec3e5
2 changed files with 8 additions and 8 deletions
|
@ -2031,13 +2031,11 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cache_unused_buffers(&mut self, buffers: Vec<Box<LayerBuffer>>) {
|
pub fn cache_unused_buffers<B>(&mut self, buffers: B)
|
||||||
if !buffers.is_empty() {
|
where B: IntoIterator<Item=Box<LayerBuffer>>
|
||||||
let surfaces = buffers.into_iter().map(|buffer| {
|
{
|
||||||
buffer.native_surface
|
let surfaces = buffers.into_iter().map(|buffer| buffer.native_surface);
|
||||||
}).collect();
|
self.surface_map.insert_surfaces(&self.native_display, surfaces);
|
||||||
self.surface_map.insert_surfaces(&self.native_display, surfaces);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
|
@ -68,7 +68,9 @@ impl SurfaceMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_surfaces(&mut self, display: &NativeDisplay, surfaces: Vec<NativeSurface>) {
|
pub fn insert_surfaces<I>(&mut self, display: &NativeDisplay, surfaces: I)
|
||||||
|
where I: IntoIterator<Item=NativeSurface>
|
||||||
|
{
|
||||||
for surface in surfaces {
|
for surface in surfaces {
|
||||||
self.insert(display, surface);
|
self.insert(display, surface);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue