Remove old rendering backend.

This removes paint threads, rust-layers dependency, and changes
optional webrender types to be required.

The use_webrender option has been removed, however I've left
the "-w" command line option in place so that wpt
runner can continue to pass that. Once it's removed from there
we can also remove the -w option.

Once this stage is complete, it should be fine to change the
display list building code to generate webrender display
lists directly and avoid the conversion step.
This commit is contained in:
Glenn Watson 2016-10-12 10:13:27 +10:00
parent 4af21e3ae1
commit acfdfd2fa9
55 changed files with 422 additions and 3611 deletions

View file

@ -19,7 +19,6 @@ euclid = "0.10.1"
gfx = {path = "../gfx"}
gfx_traits = {path = "../gfx_traits"}
ipc-channel = "0.5"
layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]}
layout_traits = {path = "../layout_traits"}
log = "0.3.5"
msg = {path = "../msg"}

View file

@ -172,8 +172,8 @@ pub struct Constellation<Message, LTF, STF> {
/// Document states for loaded pipelines (used only when writing screenshots).
document_states: HashMap<PipelineId, DocumentState>,
// Webrender interface, if enabled.
webrender_api_sender: Option<webrender_traits::RenderApiSender>,
// Webrender interface.
webrender_api_sender: webrender_traits::RenderApiSender,
/// Are we shutting down?
shutting_down: bool,
@ -209,8 +209,8 @@ pub struct InitialConstellationState {
pub mem_profiler_chan: mem::ProfilerChan,
/// Whether the constellation supports the clipboard.
pub supports_clipboard: bool,
/// Optional webrender API reference (if enabled).
pub webrender_api_sender: Option<webrender_traits::RenderApiSender>,
/// Webrender API.
pub webrender_api_sender: webrender_traits::RenderApiSender,
}
#[derive(Debug, Clone)]
@ -971,9 +971,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.compositor_proxy.send(ToCompositorMsg::TouchEventProcessed(result))
}
FromScriptMsg::GetScrollOffset(pid, lid, send) => {
self.compositor_proxy.send(ToCompositorMsg::GetScrollOffset(pid, lid, send));
}
FromScriptMsg::RegisterServiceWorker(scope_things, scope) => {
debug!("constellation got store registration scope message");
self.handle_register_serviceworker(scope_things, scope);
@ -1852,8 +1849,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
// Set paint permissions correctly for the compositor layers.
self.revoke_paint_permission(prev_pipeline_id);
self.send_frame_tree_and_grant_paint_permission();
self.send_frame_tree();
// Update the owning iframe to point to the new pipeline id.
// This makes things like contentDocument work correctly.
@ -1910,12 +1906,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
}
}
if let Some(old_pipeline_id) = frame_change.old_pipeline_id {
// The new pipeline is replacing an old one.
// Remove paint permissions for the pipeline being replaced.
self.revoke_paint_permission(old_pipeline_id);
};
if self.frames.contains_key(&frame_change.frame_id) {
// Mature the new pipeline, and return frames evicted from history.
if let Some(ref mut pipeline) = self.pipelines.get_mut(&frame_change.new_pipeline_id) {
@ -1958,8 +1948,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
self.clear_joint_session_future(top_level_frame_id);
}
// Build frame tree and send permission
self.send_frame_tree_and_grant_paint_permission();
// Build frame tree
self.send_frame_tree();
}
fn handle_activate_document_msg(&mut self, pipeline_id: PipelineId) {
@ -2339,20 +2329,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
})
}
// Revoke paint permission from a pipeline, and all children.
fn revoke_paint_permission(&self, pipeline_id: PipelineId) {
if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
for frame in self.current_frame_tree_iter(pipeline.frame_id) {
if let Some(pipeline) = self.pipelines.get(&frame.current.pipeline_id) {
pipeline.revoke_paint_permission();
}
}
}
}
// Send the current frame tree to compositor, and grant paint
// permission to each pipeline in the current frame tree.
fn send_frame_tree_and_grant_paint_permission(&mut self) {
// Send the current frame tree to compositor
fn send_frame_tree(&mut self) {
// Note that this function can panic, due to ipc-channel creation failure.
// avoiding this panic would require a mechanism for dealing
// with low-resource scenarios.
@ -2365,10 +2343,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
return; // Our message has been discarded, probably shutting down.
}
}
for frame in self.current_frame_tree_iter(self.root_frame_id) {
self.pipelines.get(&frame.current.pipeline_id).map(|pipeline| pipeline.grant_paint_permission());
}
}
/// For a given pipeline, determine the mozbrowser iframe that transitively contains

View file

@ -22,7 +22,6 @@ extern crate gaol;
extern crate gfx;
extern crate gfx_traits;
extern crate ipc_channel;
extern crate layers;
extern crate layout_traits;
#[macro_use]
extern crate log;

View file

@ -11,11 +11,9 @@ use euclid::size::TypedSize2D;
#[cfg(not(target_os = "windows"))]
use gaol;
use gfx::font_cache_thread::FontCacheThread;
use gfx::paint_thread::{LayoutToPaintMsg, PaintThread};
use gfx_traits::ChromeToPaintMsg;
use gfx_traits::DevicePixel;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layers::geometry::DevicePixel;
use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::{FrameId, FrameType, LoadData, PipelineId, PipelineNamespaceId};
use net_traits::{IpcSend, ResourceThreads};
@ -31,11 +29,9 @@ use std::env;
use std::ffi::OsStr;
use std::io::Error as IOError;
use std::process;
use std::sync::mpsc::{Sender, channel};
use std::sync::mpsc::Sender;
use style_traits::{PagePx, ViewportPx};
use url::Url;
use util;
use util::ipc::OptionalIpcSender;
use util::opts::{self, Opts};
use util::prefs::{PREFS, Pref};
use webrender_traits;
@ -58,7 +54,6 @@ pub struct Pipeline {
pub layout_chan: IpcSender<LayoutControlMsg>,
/// A channel to the compositor.
pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
pub chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
/// URL corresponding to the most recently-loaded page.
pub url: Url,
/// The title of the most recently-loaded page.
@ -127,8 +122,8 @@ pub struct InitialPipelineState {
pub pipeline_namespace_id: PipelineNamespaceId,
/// Pipeline visibility to be inherited
pub prev_visibility: Option<bool>,
/// Optional webrender api (if enabled).
pub webrender_api_sender: Option<webrender_traits::RenderApiSender>,
/// Webrender api.
pub webrender_api_sender: webrender_traits::RenderApiSender,
/// Whether this pipeline is considered private.
pub is_private: bool,
}
@ -143,8 +138,6 @@ impl Pipeline {
{
// Note: we allow channel creation to panic, since recovering from this
// probably requires a general low-memory strategy.
let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel();
let (chrome_to_paint_chan, chrome_to_paint_port) = channel();
let (pipeline_chan, pipeline_port) = ipc::channel()
.expect("Pipeline main chan");;
@ -160,7 +153,6 @@ impl Pipeline {
new_pipeline_id: state.id,
frame_type: frame_type,
load_data: state.load_data.clone(),
paint_chan: layout_to_paint_chan.clone().to_opaque(),
pipeline_port: pipeline_port,
layout_to_constellation_chan: state.layout_to_constellation_chan.clone(),
content_process_shutdown_chan: layout_content_process_shutdown_chan.clone(),
@ -178,16 +170,6 @@ impl Pipeline {
}
};
PaintThread::create(state.id,
state.load_data.url.clone(),
chrome_to_paint_chan.clone(),
layout_to_paint_port,
chrome_to_paint_port,
state.compositor_proxy.clone_compositor_proxy(),
state.font_cache_thread.clone(),
state.time_profiler_chan.clone(),
state.mem_profiler_chan.clone());
let mut child_process = None;
if let Some((script_port, pipeline_port)) = content_ports {
// Route messages coming from content to devtools as appropriate.
@ -238,7 +220,6 @@ impl Pipeline {
script_port: script_port,
opts: (*opts::get()).clone(),
prefs: PREFS.cloned(),
layout_to_paint_chan: layout_to_paint_chan,
pipeline_port: pipeline_port,
pipeline_namespace_id: state.pipeline_namespace_id,
layout_content_process_shutdown_chan: layout_content_process_shutdown_chan,
@ -264,7 +245,6 @@ impl Pipeline {
script_chan,
pipeline_chan,
state.compositor_proxy,
chrome_to_paint_chan,
state.is_private,
state.load_data.url,
state.window_size,
@ -281,7 +261,6 @@ impl Pipeline {
script_chan: IpcSender<ConstellationControlMsg>,
layout_chan: IpcSender<LayoutControlMsg>,
compositor_proxy: Box<CompositorProxy + 'static + Send>,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
is_private: bool,
url: Url,
size: Option<TypedSize2D<f32, PagePx>>,
@ -294,7 +273,6 @@ impl Pipeline {
script_chan: script_chan,
layout_chan: layout_chan,
compositor_proxy: compositor_proxy,
chrome_to_paint_chan: chrome_to_paint_chan,
url: url,
title: None,
children: vec!(),
@ -306,15 +284,6 @@ impl Pipeline {
}
}
pub fn grant_paint_permission(&self) {
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionGranted);
}
pub fn revoke_paint_permission(&self) {
debug!("pipeline revoking paint channel paint permission");
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionRevoked);
}
pub fn exit(&self) {
debug!("pipeline {:?} exiting", self.id);
@ -353,9 +322,6 @@ impl Pipeline {
if let Err(e) = self.script_chan.send(ConstellationControlMsg::ExitPipeline(self.id)) {
warn!("Sending script exit message failed ({}).", e);
}
if let Err(e) = self.chrome_to_paint_chan.send(ChromeToPaintMsg::Exit) {
warn!("Sending paint exit message failed ({}).", e);
}
if let Err(e) = self.layout_chan.send(LayoutControlMsg::ExitNow) {
warn!("Sending layout exit message failed ({}).", e);
}
@ -366,7 +332,6 @@ impl Pipeline {
id: self.id.clone(),
script_chan: self.script_chan.clone(),
layout_chan: self.layout_chan.clone(),
chrome_to_paint_chan: self.chrome_to_paint_chan.clone(),
}
}
@ -430,7 +395,6 @@ pub struct UnprivilegedPipelineContent {
script_chan: IpcSender<ConstellationControlMsg>,
load_data: LoadData,
script_port: IpcReceiver<ConstellationControlMsg>,
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
opts: Opts,
prefs: HashMap<String, Pref>,
pipeline_port: IpcReceiver<LayoutControlMsg>,
@ -439,7 +403,7 @@ pub struct UnprivilegedPipelineContent {
layout_content_process_shutdown_port: IpcReceiver<()>,
script_content_process_shutdown_chan: IpcSender<()>,
script_content_process_shutdown_port: IpcReceiver<()>,
webrender_api_sender: Option<webrender_traits::RenderApiSender>,
webrender_api_sender: webrender_traits::RenderApiSender,
}
impl UnprivilegedPipelineContent {
@ -472,7 +436,6 @@ impl UnprivilegedPipelineContent {
self.pipeline_port,
self.layout_to_constellation_chan,
self.script_chan,
self.layout_to_paint_chan,
self.image_cache_thread,
self.font_cache_thread,
self.time_profiler_chan,