Remove Constellation::child_processes.

Fixes https://github.com/servo/servo/issues/11459.
This commit is contained in:
Corey Farwell 2016-12-09 11:00:24 -10:00
parent 120b003195
commit 8dfbfc2c48
2 changed files with 15 additions and 28 deletions

View file

@ -35,7 +35,7 @@ use net_traits::image_cache_thread::ImageCacheThread;
use net_traits::pub_domains::reg_suffix; use net_traits::pub_domains::reg_suffix;
use net_traits::storage_thread::{StorageThreadMsg, StorageType}; use net_traits::storage_thread::{StorageThreadMsg, StorageType};
use offscreen_gl_context::{GLContextAttributes, GLLimits}; use offscreen_gl_context::{GLContextAttributes, GLLimits};
use pipeline::{ChildProcess, InitialPipelineState, Pipeline}; use pipeline::{InitialPipelineState, Pipeline};
use profile_traits::mem; use profile_traits::mem;
use profile_traits::time; use profile_traits::time;
use rand::{Rng, SeedableRng, StdRng, random}; use rand::{Rng, SeedableRng, StdRng, random};
@ -175,10 +175,6 @@ pub struct Constellation<Message, LTF, STF> {
scheduler_chan: IpcSender<TimerEventRequest>, scheduler_chan: IpcSender<TimerEventRequest>,
/// A list of child content processes.
#[cfg_attr(target_os = "windows", allow(dead_code))]
child_processes: Vec<ChildProcess>,
/// Document states for loaded pipelines (used only when writing screenshots). /// Document states for loaded pipelines (used only when writing screenshots).
document_states: HashMap<PipelineId, DocumentState>, document_states: HashMap<PipelineId, DocumentState>,
@ -558,7 +554,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
phantom: PhantomData, phantom: PhantomData,
webdriver: WebDriverData::new(), webdriver: WebDriverData::new(),
scheduler_chan: TimerScheduler::start(), scheduler_chan: TimerScheduler::start(),
child_processes: Vec::new(),
document_states: HashMap::new(), document_states: HashMap::new(),
webrender_api_sender: state.webrender_api_sender, webrender_api_sender: state.webrender_api_sender,
shutting_down: false, shutting_down: false,
@ -679,15 +674,11 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
is_private: is_private, is_private: is_private,
}); });
let (pipeline, child_process) = match result { let pipeline = match result {
Ok(result) => result, Ok(result) => result,
Err(e) => return self.handle_send_error(pipeline_id, e), Err(e) => return self.handle_send_error(pipeline_id, e),
}; };
if let Some(child_process) = child_process {
self.child_processes.push(child_process);
}
if let Some(host) = host { if let Some(host) = host {
self.script_channels.entry(top_level_frame_id) self.script_channels.entry(top_level_frame_id)
.or_insert_with(HashMap::new) .or_insert_with(HashMap::new)

View file

@ -134,15 +134,14 @@ pub struct InitialPipelineState {
impl Pipeline { impl Pipeline {
/// Starts a paint thread, layout thread, and possibly a script thread, in /// Starts a paint thread, layout thread, and possibly a script thread, in
/// a new process if requested. /// a new process if requested.
pub fn spawn<Message, LTF, STF>(state: InitialPipelineState) pub fn spawn<Message, LTF, STF>(state: InitialPipelineState) -> Result<Pipeline, IOError>
-> Result<(Pipeline, Option<ChildProcess>), IOError>
where LTF: LayoutThreadFactory<Message=Message>, where LTF: LayoutThreadFactory<Message=Message>,
STF: ScriptThreadFactory<Message=Message> STF: ScriptThreadFactory<Message=Message>
{ {
// 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 (pipeline_chan, pipeline_port) = ipc::channel() let (pipeline_chan, pipeline_port) = ipc::channel()
.expect("Pipeline main chan");; .expect("Pipeline main chan");
let (layout_content_process_shutdown_chan, layout_content_process_shutdown_port) = let (layout_content_process_shutdown_chan, layout_content_process_shutdown_port) =
ipc::channel().expect("Pipeline layout content shutdown chan"); ipc::channel().expect("Pipeline layout content shutdown chan");
@ -180,7 +179,6 @@ impl Pipeline {
} }
}; };
let mut child_process = None;
if let Some((script_port, pipeline_port)) = content_ports { if let Some((script_port, pipeline_port)) = content_ports {
// Route messages coming from content to devtools as appropriate. // Route messages coming from content to devtools as appropriate.
let script_to_devtools_chan = state.devtools_chan.as_ref().map(|devtools_chan| { let script_to_devtools_chan = state.devtools_chan.as_ref().map(|devtools_chan| {
@ -236,13 +234,13 @@ impl Pipeline {
// //
// Yes, that's all there is to it! // Yes, that's all there is to it!
if opts::multiprocess() { if opts::multiprocess() {
child_process = Some(try!(unprivileged_pipeline_content.spawn_multiprocess())); let _ = try!(unprivileged_pipeline_content.spawn_multiprocess());
} else { } else {
unprivileged_pipeline_content.start_all::<Message, LTF, STF>(false); unprivileged_pipeline_content.start_all::<Message, LTF, STF>(false);
} }
} }
let pipeline = Pipeline::new(state.id, Ok(Pipeline::new(state.id,
state.frame_id, state.frame_id,
state.parent_info, state.parent_info,
script_chan, script_chan,
@ -251,9 +249,7 @@ impl Pipeline {
state.is_private, state.is_private,
state.load_data.url, state.load_data.url,
state.window_size, state.window_size,
state.prev_visibility.unwrap_or(true)); state.prev_visibility.unwrap_or(true)))
Ok((pipeline, child_process))
} }
/// Creates a new `Pipeline`, after the script and layout threads have been /// Creates a new `Pipeline`, after the script and layout threads have been