mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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,14 +2031,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn cache_unused_buffers(&mut self, buffers: Vec<Box<LayerBuffer>>) {
|
||||
if !buffers.is_empty() {
|
||||
let surfaces = buffers.into_iter().map(|buffer| {
|
||||
buffer.native_surface
|
||||
}).collect();
|
||||
pub fn cache_unused_buffers<B>(&mut self, buffers: B)
|
||||
where B: IntoIterator<Item=Box<LayerBuffer>>
|
||||
{
|
||||
let surfaces = buffers.into_iter().map(|buffer| buffer.native_surface);
|
||||
self.surface_map.insert_surfaces(&self.native_display, surfaces);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn dump_layer_tree(&self) {
|
||||
|
|
|
@ -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 {
|
||||
self.insert(display, surface);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue