Inline Pipeline::create() into Pipeline::spawn().

This commit is contained in:
Ms2ger 2016-05-26 10:31:18 +02:00
parent 739e091e8b
commit 88a36e6947

View file

@ -120,11 +120,15 @@ pub struct InitialPipelineState {
} }
impl Pipeline { impl Pipeline {
fn create<LTF, STF>(state: InitialPipelineState) /// Starts a paint thread, layout thread, and possibly a script thread, in
-> (Pipeline, UnprivilegedPipelineContent, PrivilegedPipelineContent) /// a new process if requested.
where LTF: LayoutThreadFactory, pub fn spawn<Message, LTF, STF>(state: InitialPipelineState)
STF: ScriptThreadFactory -> Result<(Pipeline, Option<ChildProcess>), IOError>
where LTF: LayoutThreadFactory<Message=Message>,
STF: ScriptThreadFactory<Message=Message>
{ {
let spawning_content = state.script_chan.is_none();
// Note: we allow channel creation to panic, since recovering from this // Note: we allow channel creation to panic, since recovering from this
// probably requires a general low-memory strategy. // probably requires a general low-memory strategy.
let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel(); let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel();
@ -251,20 +255,6 @@ impl Pipeline {
paint_shutdown_chan: paint_shutdown_chan, paint_shutdown_chan: paint_shutdown_chan,
}; };
(pipeline, unprivileged_pipeline_content, privileged_pipeline_content)
}
/// Starts a paint thread, layout thread, and possibly a script thread, in
/// a new process if requested.
pub fn spawn<Message, LTF, STF>(state: InitialPipelineState)
-> Result<(Pipeline, Option<ChildProcess>), IOError>
where LTF: LayoutThreadFactory<Message=Message>,
STF: ScriptThreadFactory<Message=Message>
{
let spawning_content = state.script_chan.is_none();
let (pipeline, unprivileged_pipeline_content, privileged_pipeline_content) =
Pipeline::create::<LTF, STF>(state);
privileged_pipeline_content.start(); privileged_pipeline_content.start();
let mut child_process = None; let mut child_process = None;