Remove unecessary webrender document from layout.

This commit is contained in:
Josh Matthews 2020-06-08 15:04:37 -04:00
parent 75efaa95f5
commit abc689e034
7 changed files with 20 additions and 67 deletions

View file

@ -587,10 +587,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
/// instance in the parent process. /// instance in the parent process.
fn handle_webrender_message(&mut self, msg: WebrenderMsg) { fn handle_webrender_message(&mut self, msg: WebrenderMsg) {
match msg { match msg {
WebrenderMsg::Layout(script_traits::WebrenderMsg::SendInitialTransaction( WebrenderMsg::Layout(script_traits::WebrenderMsg::SendInitialTransaction(pipeline)) => {
_doc,
pipeline,
)) => {
self.waiting_on_pending_frame = true; self.waiting_on_pending_frame = true;
let mut txn = webrender_api::Transaction::new(); let mut txn = webrender_api::Transaction::new();
txn.set_display_list( txn.set_display_list(
@ -605,7 +602,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
}, },
WebrenderMsg::Layout(script_traits::WebrenderMsg::SendScrollNode( WebrenderMsg::Layout(script_traits::WebrenderMsg::SendScrollNode(
_doc,
point, point,
scroll_id, scroll_id,
clamping, clamping,
@ -617,7 +613,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
}, },
WebrenderMsg::Layout(script_traits::WebrenderMsg::SendDisplayList( WebrenderMsg::Layout(script_traits::WebrenderMsg::SendDisplayList(
_doc,
epoch, epoch,
size, size,
pipeline, pipeline,
@ -644,7 +639,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
}, },
WebrenderMsg::Layout(script_traits::WebrenderMsg::HitTest( WebrenderMsg::Layout(script_traits::WebrenderMsg::HitTest(
_doc,
pipeline, pipeline,
point, point,
flags, flags,
@ -684,6 +678,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
self.webrender_api self.webrender_api
.send_transaction(self.webrender_document, txn); .send_transaction(self.webrender_document, txn);
}, },
WebrenderMsg::Font(WebrenderFontMsg::AddFontInstance(font_key, size, sender)) => { WebrenderMsg::Font(WebrenderFontMsg::AddFontInstance(font_key, size, sender)) => {
let key = self.webrender_api.generate_font_instance_key(); let key = self.webrender_api.generate_font_instance_key();
let mut txn = webrender_api::Transaction::new(); let mut txn = webrender_api::Transaction::new();
@ -692,6 +687,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.send_transaction(self.webrender_document, txn); .send_transaction(self.webrender_document, txn);
let _ = sender.send(key); let _ = sender.send(key);
}, },
WebrenderMsg::Font(WebrenderFontMsg::AddFont(data, sender)) => { WebrenderMsg::Font(WebrenderFontMsg::AddFont(data, sender)) => {
let font_key = self.webrender_api.generate_font_key(); let font_key = self.webrender_api.generate_font_key();
let mut txn = webrender_api::Transaction::new(); let mut txn = webrender_api::Transaction::new();
@ -703,9 +699,11 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
.send_transaction(self.webrender_document, txn); .send_transaction(self.webrender_document, txn);
let _ = sender.send(font_key); let _ = sender.send(font_key);
}, },
WebrenderMsg::Canvas(WebrenderCanvasMsg::GenerateKey(sender)) => { WebrenderMsg::Canvas(WebrenderCanvasMsg::GenerateKey(sender)) => {
let _ = sender.send(self.webrender_api.generate_image_key()); let _ = sender.send(self.webrender_api.generate_image_key());
}, },
WebrenderMsg::Canvas(WebrenderCanvasMsg::UpdateImages(updates)) => { WebrenderMsg::Canvas(WebrenderCanvasMsg::UpdateImages(updates)) => {
let mut txn = webrender_api::Transaction::new(); let mut txn = webrender_api::Transaction::new();
for update in updates { for update in updates {

View file

@ -606,7 +606,6 @@ impl UnprivilegedPipelineContent {
self.time_profiler_chan, self.time_profiler_chan,
self.mem_profiler_chan, self.mem_profiler_chan,
self.webrender_api_sender, self.webrender_api_sender,
self.webrender_document,
paint_time_metrics, paint_time_metrics,
layout_thread_busy_flag.clone(), layout_thread_busy_flag.clone(),
self.opts.load_webfonts_synchronously, self.opts.load_webfonts_synchronously,

View file

@ -212,9 +212,6 @@ pub struct LayoutThread {
/// Webrender interface. /// Webrender interface.
webrender_api: WebrenderIpcSender, webrender_api: WebrenderIpcSender,
/// Webrender document.
webrender_document: webrender_api::DocumentId,
/// Paint time metrics. /// Paint time metrics.
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
@ -276,7 +273,6 @@ impl LayoutThreadFactory for LayoutThread {
time_profiler_chan: profile_time::ProfilerChan, time_profiler_chan: profile_time::ProfilerChan,
mem_profiler_chan: profile_mem::ProfilerChan, mem_profiler_chan: profile_mem::ProfilerChan,
webrender_api_sender: WebrenderIpcSender, webrender_api_sender: WebrenderIpcSender,
webrender_document: webrender_api::DocumentId,
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>, busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool, load_webfonts_synchronously: bool,
@ -325,7 +321,6 @@ impl LayoutThreadFactory for LayoutThread {
time_profiler_chan, time_profiler_chan,
mem_profiler_chan.clone(), mem_profiler_chan.clone(),
webrender_api_sender, webrender_api_sender,
webrender_document,
paint_time_metrics, paint_time_metrics,
busy, busy,
load_webfonts_synchronously, load_webfonts_synchronously,
@ -495,7 +490,6 @@ impl LayoutThread {
time_profiler_chan: profile_time::ProfilerChan, time_profiler_chan: profile_time::ProfilerChan,
mem_profiler_chan: profile_mem::ProfilerChan, mem_profiler_chan: profile_mem::ProfilerChan,
webrender_api: WebrenderIpcSender, webrender_api: WebrenderIpcSender,
webrender_document: webrender_api::DocumentId,
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>, busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool, load_webfonts_synchronously: bool,
@ -510,7 +504,7 @@ impl LayoutThread {
dump_flow_tree: bool, dump_flow_tree: bool,
) -> LayoutThread { ) -> LayoutThread {
// Let webrender know about this pipeline by sending an empty display list. // Let webrender know about this pipeline by sending an empty display list.
webrender_api.send_initial_transaction(webrender_document, id.to_webrender()); webrender_api.send_initial_transaction(id.to_webrender());
let device = Device::new( let device = Device::new(
MediaType::screen(), MediaType::screen(),
@ -553,7 +547,6 @@ impl LayoutThread {
epoch: Cell::new(Epoch(1)), epoch: Cell::new(Epoch(1)),
viewport_size: Size2D::new(Au(0), Au(0)), viewport_size: Size2D::new(Au(0), Au(0)),
webrender_api, webrender_api,
webrender_document,
stylist: Stylist::new(device, QuirksMode::NoQuirks), stylist: Stylist::new(device, QuirksMode::NoQuirks),
rw_data: Arc::new(Mutex::new(LayoutThreadData { rw_data: Arc::new(Mutex::new(LayoutThreadData {
constellation_chan: constellation_chan, constellation_chan: constellation_chan,
@ -773,7 +766,6 @@ impl LayoutThread {
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y); let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
self.webrender_api.send_scroll_node( self.webrender_api.send_scroll_node(
self.webrender_document,
webrender_api::units::LayoutPoint::from_untyped(point), webrender_api::units::LayoutPoint::from_untyped(point),
state.scroll_id, state.scroll_id,
webrender_api::ScrollClamping::ToContentBounds, webrender_api::ScrollClamping::ToContentBounds,
@ -882,7 +874,6 @@ impl LayoutThread {
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
self.mem_profiler_chan.clone(), self.mem_profiler_chan.clone(),
self.webrender_api.clone(), self.webrender_api.clone(),
self.webrender_document,
info.paint_time_metrics, info.paint_time_metrics,
info.layout_is_busy, info.layout_is_busy,
self.load_webfonts_synchronously, self.load_webfonts_synchronously,
@ -1171,12 +1162,8 @@ impl LayoutThread {
self.paint_time_metrics self.paint_time_metrics
.maybe_observe_paint_time(self, epoch, is_contentful.0); .maybe_observe_paint_time(self, epoch, is_contentful.0);
self.webrender_api.send_display_list( self.webrender_api
self.webrender_document, .send_display_list(epoch, viewport_size, builder.finalize());
epoch,
viewport_size,
builder.finalize(),
);
}, },
); );
} }
@ -1578,7 +1565,6 @@ impl LayoutThread {
let client_point = webrender_api::units::WorldPoint::from_untyped(client_point); let client_point = webrender_api::units::WorldPoint::from_untyped(client_point);
let results = self.webrender_api.hit_test( let results = self.webrender_api.hit_test(
self.webrender_document,
Some(self.id.to_webrender()), Some(self.id.to_webrender()),
client_point, client_point,
flags, flags,

View file

@ -191,9 +191,6 @@ pub struct LayoutThread {
/// Webrender interface. /// Webrender interface.
webrender_api: WebrenderIpcSender, webrender_api: WebrenderIpcSender,
/// Webrender document.
webrender_document: webrender_api::DocumentId,
/// Paint time metrics. /// Paint time metrics.
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
@ -245,7 +242,6 @@ impl LayoutThreadFactory for LayoutThread {
time_profiler_chan: profile_time::ProfilerChan, time_profiler_chan: profile_time::ProfilerChan,
mem_profiler_chan: profile_mem::ProfilerChan, mem_profiler_chan: profile_mem::ProfilerChan,
webrender_api_sender: WebrenderIpcSender, webrender_api_sender: WebrenderIpcSender,
webrender_document: webrender_api::DocumentId,
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>, busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool, load_webfonts_synchronously: bool,
@ -294,7 +290,6 @@ impl LayoutThreadFactory for LayoutThread {
time_profiler_chan, time_profiler_chan,
mem_profiler_chan.clone(), mem_profiler_chan.clone(),
webrender_api_sender, webrender_api_sender,
webrender_document,
paint_time_metrics, paint_time_metrics,
busy, busy,
load_webfonts_synchronously, load_webfonts_synchronously,
@ -463,7 +458,6 @@ impl LayoutThread {
time_profiler_chan: profile_time::ProfilerChan, time_profiler_chan: profile_time::ProfilerChan,
mem_profiler_chan: profile_mem::ProfilerChan, mem_profiler_chan: profile_mem::ProfilerChan,
webrender_api_sender: WebrenderIpcSender, webrender_api_sender: WebrenderIpcSender,
webrender_document: webrender_api::DocumentId,
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>, busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool, load_webfonts_synchronously: bool,
@ -477,7 +471,7 @@ impl LayoutThread {
trace_layout: bool, trace_layout: bool,
) -> LayoutThread { ) -> LayoutThread {
// Let webrender know about this pipeline by sending an empty display list. // Let webrender know about this pipeline by sending an empty display list.
webrender_api_sender.send_initial_transaction(webrender_document, id.to_webrender()); webrender_api_sender.send_initial_transaction(id.to_webrender());
// The device pixel ratio is incorrect (it does not have the hidpi value), // The device pixel ratio is incorrect (it does not have the hidpi value),
// but it will be set correctly when the initial reflow takes place. // but it will be set correctly when the initial reflow takes place.
@ -521,7 +515,6 @@ impl LayoutThread {
epoch: Cell::new(Epoch(1)), epoch: Cell::new(Epoch(1)),
viewport_size: Size2D::new(Au(0), Au(0)), viewport_size: Size2D::new(Au(0), Au(0)),
webrender_api: webrender_api_sender, webrender_api: webrender_api_sender,
webrender_document,
stylist: Stylist::new(device, QuirksMode::NoQuirks), stylist: Stylist::new(device, QuirksMode::NoQuirks),
rw_data: Arc::new(Mutex::new(LayoutThreadData { rw_data: Arc::new(Mutex::new(LayoutThreadData {
constellation_chan: constellation_chan, constellation_chan: constellation_chan,
@ -737,7 +730,6 @@ impl LayoutThread {
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y); let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
self.webrender_api.send_scroll_node( self.webrender_api.send_scroll_node(
self.webrender_document,
webrender_api::units::LayoutPoint::from_untyped(point), webrender_api::units::LayoutPoint::from_untyped(point),
state.scroll_id, state.scroll_id,
webrender_api::ScrollClamping::ToContentBounds, webrender_api::ScrollClamping::ToContentBounds,
@ -823,7 +815,6 @@ impl LayoutThread {
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
self.mem_profiler_chan.clone(), self.mem_profiler_chan.clone(),
self.webrender_api.clone(), self.webrender_api.clone(),
self.webrender_document,
info.paint_time_metrics, info.paint_time_metrics,
info.layout_is_busy, info.layout_is_busy,
self.load_webfonts_synchronously, self.load_webfonts_synchronously,
@ -1231,7 +1222,6 @@ impl LayoutThread {
let client_point = webrender_api::units::WorldPoint::from_untyped(client_point); let client_point = webrender_api::units::WorldPoint::from_untyped(client_point);
let results = self.webrender_api.hit_test( let results = self.webrender_api.hit_test(
self.webrender_document,
Some(self.id.to_webrender()), Some(self.id.to_webrender()),
client_point, client_point,
flags, flags,
@ -1349,12 +1339,8 @@ impl LayoutThread {
self.viewport_size.width.to_f32_px(), self.viewport_size.width.to_f32_px(),
self.viewport_size.height.to_f32_px(), self.viewport_size.height.to_f32_px(),
)); ));
self.webrender_api.send_display_list( self.webrender_api
self.webrender_document, .send_display_list(epoch, viewport_size, display_list.wr.finalize());
epoch,
viewport_size,
display_list.wr.finalize(),
);
if self.trace_layout { if self.trace_layout {
layout_debug::end_trace(self.generation.get()); layout_debug::end_trace(self.generation.get());

View file

@ -44,7 +44,6 @@ pub trait LayoutThreadFactory {
time_profiler_chan: time::ProfilerChan, time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan, mem_profiler_chan: mem::ProfilerChan,
webrender_api_sender: WebrenderIpcSender, webrender_api_sender: WebrenderIpcSender,
webrender_document: webrender_api::DocumentId,
paint_time_metrics: PaintTimeMetrics, paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>, busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool, load_webfonts_synchronously: bool,

View file

@ -1100,12 +1100,11 @@ impl From<i32> for MediaSessionActionType {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub enum WebrenderMsg { pub enum WebrenderMsg {
/// Inform WebRender of the existence of this pipeline. /// Inform WebRender of the existence of this pipeline.
SendInitialTransaction(DocumentId, webrender_api::PipelineId), SendInitialTransaction(webrender_api::PipelineId),
/// Perform a scroll operation. /// Perform a scroll operation.
SendScrollNode(DocumentId, LayoutPoint, ExternalScrollId, ScrollClamping), SendScrollNode(LayoutPoint, ExternalScrollId, ScrollClamping),
/// Inform WebRender of a new display list for the given pipeline. /// Inform WebRender of a new display list for the given pipeline.
SendDisplayList( SendDisplayList(
DocumentId,
webrender_api::Epoch, webrender_api::Epoch,
LayoutSize, LayoutSize,
webrender_api::PipelineId, webrender_api::PipelineId,
@ -1116,7 +1115,6 @@ pub enum WebrenderMsg {
/// Perform a hit test operation. The result will be returned via /// Perform a hit test operation. The result will be returned via
/// the provided channel sender. /// the provided channel sender.
HitTest( HitTest(
DocumentId,
Option<webrender_api::PipelineId>, Option<webrender_api::PipelineId>,
WorldPoint, WorldPoint,
HitTestFlags, HitTestFlags,
@ -1140,15 +1138,8 @@ impl WebrenderIpcSender {
} }
/// Inform WebRender of the existence of this pipeline. /// Inform WebRender of the existence of this pipeline.
pub fn send_initial_transaction( pub fn send_initial_transaction(&self, pipeline: webrender_api::PipelineId) {
&self, if let Err(e) = self.0.send(WebrenderMsg::SendInitialTransaction(pipeline)) {
document: DocumentId,
pipeline: webrender_api::PipelineId,
) {
if let Err(e) = self
.0
.send(WebrenderMsg::SendInitialTransaction(document, pipeline))
{
warn!("Error sending initial transaction: {}", e); warn!("Error sending initial transaction: {}", e);
} }
} }
@ -1156,14 +1147,14 @@ impl WebrenderIpcSender {
/// Perform a scroll operation. /// Perform a scroll operation.
pub fn send_scroll_node( pub fn send_scroll_node(
&self, &self,
document: DocumentId,
point: LayoutPoint, point: LayoutPoint,
scroll_id: ExternalScrollId, scroll_id: ExternalScrollId,
clamping: ScrollClamping, clamping: ScrollClamping,
) { ) {
if let Err(e) = self.0.send(WebrenderMsg::SendScrollNode( if let Err(e) = self
document, point, scroll_id, clamping, .0
)) { .send(WebrenderMsg::SendScrollNode(point, scroll_id, clamping))
{
warn!("Error sending scroll node: {}", e); warn!("Error sending scroll node: {}", e);
} }
} }
@ -1171,14 +1162,12 @@ impl WebrenderIpcSender {
/// Inform WebRender of a new display list for the given pipeline. /// Inform WebRender of a new display list for the given pipeline.
pub fn send_display_list( pub fn send_display_list(
&self, &self,
document: DocumentId,
epoch: Epoch, epoch: Epoch,
size: LayoutSize, size: LayoutSize,
(pipeline, size2, list): (webrender_api::PipelineId, LayoutSize, BuiltDisplayList), (pipeline, size2, list): (webrender_api::PipelineId, LayoutSize, BuiltDisplayList),
) { ) {
let (data, descriptor) = list.into_data(); let (data, descriptor) = list.into_data();
if let Err(e) = self.0.send(WebrenderMsg::SendDisplayList( if let Err(e) = self.0.send(WebrenderMsg::SendDisplayList(
document,
webrender_api::Epoch(epoch.0), webrender_api::Epoch(epoch.0),
size, size,
pipeline, pipeline,
@ -1194,16 +1183,13 @@ impl WebrenderIpcSender {
/// and a result is available. /// and a result is available.
pub fn hit_test( pub fn hit_test(
&self, &self,
document: DocumentId,
pipeline: Option<webrender_api::PipelineId>, pipeline: Option<webrender_api::PipelineId>,
point: WorldPoint, point: WorldPoint,
flags: HitTestFlags, flags: HitTestFlags,
) -> HitTestResult { ) -> HitTestResult {
let (sender, receiver) = ipc::channel().unwrap(); let (sender, receiver) = ipc::channel().unwrap();
self.0 self.0
.send(WebrenderMsg::HitTest( .send(WebrenderMsg::HitTest(pipeline, point, flags, sender))
document, pipeline, point, flags, sender,
))
.expect("error sending hit test"); .expect("error sending hit test");
receiver.recv().expect("error receiving hit test result") receiver.recv().expect("error receiving hit test result")
} }

View file

@ -37,7 +37,6 @@ packages = [
"wayland-sys", "wayland-sys",
"parking_lot", "parking_lot",
"parking_lot_core", "parking_lot_core",
"ron",
# https://github.com/servo/servo/pull/23288#issuecomment-494687746 # https://github.com/servo/servo/pull/23288#issuecomment-494687746
"gl_generator", "gl_generator",