mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Remove constellation ChildProcess
.
This commit is contained in:
parent
8dfbfc2c48
commit
c11b333ae5
1 changed files with 9 additions and 19 deletions
|
@ -10,8 +10,6 @@ use constellation::ScriptChan;
|
|||
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use gaol;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx_traits::DevicePixel;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
|
@ -39,13 +37,6 @@ use util::opts::{self, Opts};
|
|||
use util::prefs::{PREFS, Pref};
|
||||
use webrender_traits;
|
||||
|
||||
pub enum ChildProcess {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
Sandboxed(gaol::platform::process::Process),
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
Unsandboxed(process::Child),
|
||||
}
|
||||
|
||||
/// A uniquely-identifiable pipeline of script thread, layout thread, and paint thread.
|
||||
pub struct Pipeline {
|
||||
pub id: PipelineId,
|
||||
|
@ -460,7 +451,7 @@ impl UnprivilegedPipelineContent {
|
|||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub fn spawn_multiprocess(self) -> Result<ChildProcess, IOError> {
|
||||
pub fn spawn_multiprocess(self) -> Result<(), IOError> {
|
||||
use gaol::sandbox::{self, Sandbox, SandboxMethods};
|
||||
use ipc_channel::ipc::IpcOneShotServer;
|
||||
use sandboxing::content_process_sandbox_profile;
|
||||
|
@ -485,31 +476,30 @@ impl UnprivilegedPipelineContent {
|
|||
.expect("Failed to create IPC one-shot server.");
|
||||
|
||||
// If there is a sandbox, use the `gaol` API to create the child process.
|
||||
let child_process = if opts::get().sandbox {
|
||||
if opts::get().sandbox {
|
||||
let mut command = sandbox::Command::me().expect("Failed to get current sandbox.");
|
||||
self.setup_common(&mut command, token);
|
||||
|
||||
let profile = content_process_sandbox_profile();
|
||||
ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command)
|
||||
.expect("Failed to start sandboxed child process!"))
|
||||
let _ = Sandbox::new(profile)
|
||||
.start(&mut command)
|
||||
.expect("Failed to start sandboxed child process!");
|
||||
} else {
|
||||
let path_to_self = env::current_exe()
|
||||
.expect("Failed to get current executor.");
|
||||
let mut child_process = process::Command::new(path_to_self);
|
||||
self.setup_common(&mut child_process, token);
|
||||
|
||||
ChildProcess::Unsandboxed(child_process.spawn()
|
||||
.expect("Failed to start unsandboxed child process!"))
|
||||
};
|
||||
let _ = child_process.spawn().expect("Failed to start unsandboxed child process!");
|
||||
}
|
||||
|
||||
let (_receiver, sender) = server.accept().expect("Server failed to accept.");
|
||||
try!(sender.send(self));
|
||||
|
||||
Ok(child_process)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn spawn_multiprocess(self) -> Result<ChildProcess, IOError> {
|
||||
pub fn spawn_multiprocess(self) -> Result<(), IOError> {
|
||||
error!("Multiprocess is not supported on Windows.");
|
||||
process::exit(1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue