mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Move LayerBuffer cache to the compositor
Now that NativeDisplay can be shared between the compositor and the paint task, we can move the LayerBuffer cache to the compositor. This allows surfaces to be potentially reused between different paint tasks and will eventually allow OpenGL contexts to be preserved between instances of GL rasterization.
This commit is contained in:
parent
2e1c9785dc
commit
e115c3d3c4
12 changed files with 174 additions and 226 deletions
|
@ -14,7 +14,7 @@ use windowing::{WindowEvent, WindowMethods};
|
|||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use layers::platform::surface::NativeDisplay;
|
||||
use layers::layers::LayerBufferSet;
|
||||
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
|
||||
use msg::compositor_msg::{Epoch, LayerId, LayerProperties, FrameTreeId};
|
||||
use msg::compositor_msg::{PaintListener, ScriptListener};
|
||||
use msg::constellation_msg::{AnimationState, ConstellationChan, PipelineId};
|
||||
|
@ -111,6 +111,18 @@ impl PaintListener for Box<CompositorProxy+'static+Send> {
|
|||
self.send(Msg::AssignPaintedBuffers(pipeline_id, epoch, replies, frame_tree_id));
|
||||
}
|
||||
|
||||
fn ignore_buffer_requests(&mut self, buffer_requests: Vec<BufferRequest>) {
|
||||
let mut layer_buffers = Vec::new();
|
||||
for request in buffer_requests.into_iter() {
|
||||
if let Some(layer_buffer) = request.layer_buffer {
|
||||
layer_buffers.push(layer_buffer);
|
||||
}
|
||||
}
|
||||
if !layer_buffers.is_empty() {
|
||||
self.send(Msg::ReturnUnusedLayerBuffers(layer_buffers));
|
||||
}
|
||||
}
|
||||
|
||||
fn initialize_layers_for_pipeline(&mut self,
|
||||
pipeline_id: PipelineId,
|
||||
properties: Vec<LayerProperties>,
|
||||
|
@ -184,6 +196,9 @@ pub enum Msg {
|
|||
NewFavicon(Url),
|
||||
/// <head> tag finished parsing
|
||||
HeadParsed,
|
||||
/// Signal that the paint task ignored the paint requests that carried
|
||||
/// these layer buffers, so that they can be re-added to the surface cache.
|
||||
ReturnUnusedLayerBuffers(Vec<Box<LayerBuffer>>),
|
||||
}
|
||||
|
||||
impl Debug for Msg {
|
||||
|
@ -212,6 +227,7 @@ impl Debug for Msg {
|
|||
Msg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
|
||||
Msg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||
Msg::HeadParsed => write!(f, "HeadParsed"),
|
||||
Msg::ReturnUnusedLayerBuffers(..) => write!(f, "ReturnUnusedLayerBuffers"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue