Auto merge of #9385 - larsbergstrom:win32, r=frewsxcv,pcwalton,jdm,ecoal95

Win32 support

r? @frewsxcv for python stuff
r? @pcwalton for the "remove usage of Gaol" stuff for Win32
r? anybody else for misc cargo.lock updates, etc.

This replaces #7878.

This works best with https://github.com/servo/mozjs/pull/71, too, to enable static linking, but can be run without (via some PATH hackery).

The instructions are here, and will be added to a .md file in the repo once the mozjs changes also land:
https://hackpad.com/Servo-on-Windows-C1LPcI2bP25

I'd like to get these changes landed because I've been rebasing them for months, they're otherwise quite stable, and don't affect our other platforms and targets.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9385)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-01-23 07:27:27 +05:30
commit 525e77f64f
25 changed files with 431 additions and 288 deletions

View file

@ -63,7 +63,22 @@ git = "https://github.com/servo/ipc-channel"
[dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
[dependencies.gaol]
[target.arm-linux-androideabi.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.x86_64-apple-darwin.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.x86_64-unknown-linux-gnu.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.i686-unknown-linux-gnu.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.arm-unknown-linux-gnueabihf.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.aarch64-unknown-linux-gnueabihf.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[dependencies]

View file

@ -19,7 +19,9 @@ use compositor_thread::Msg as ToCompositorMsg;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D};
#[cfg(not(target_os = "windows"))]
use gaol;
#[cfg(not(target_os = "windows"))]
use gaol::sandbox::{self, Sandbox, SandboxMethods};
use gfx::font_cache_thread::FontCacheThread;
use gfx_traits::{Epoch, PaintMsg as FromPaintMsg};
@ -40,6 +42,7 @@ use offscreen_gl_context::GLContextAttributes;
use pipeline::{CompositionPipeline, InitialPipelineState, Pipeline, UnprivilegedPipelineContent};
use profile_traits::mem;
use profile_traits::time;
#[cfg(not(target_os = "windows"))]
use sandboxing;
use script_traits::{AnimationState, CompositorEvent, ConstellationControlMsg};
use script_traits::{DocumentState, LayoutControlMsg};
@ -282,6 +285,7 @@ enum ExitPipelineMode {
}
enum ChildProcess {
#[cfg(not(target_os = "windows"))]
Sandboxed(gaol::platform::process::Process),
Unsandboxed(process::Child),
}
@ -406,27 +410,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
//
// Yes, that's all there is to it!
if opts::multiprocess() {
let (server, token) =
IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap();
// If there is a sandbox, use the `gaol` API to create the child process.
let child_process = if opts::get().sandbox {
let mut command = sandbox::Command::me().unwrap();
command.arg("--content-process").arg(token);
let profile = sandboxing::content_process_sandbox_profile();
ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command).expect(
"Failed to start sandboxed child process!"))
} else {
let path_to_self = env::current_exe().unwrap();
let mut child_process = process::Command::new(path_to_self);
child_process.arg("--content-process");
child_process.arg(token);
ChildProcess::Unsandboxed(child_process.spawn().unwrap())
};
self.child_processes.push(child_process);
let (_receiver, sender) = server.accept().unwrap();
sender.send(unprivileged_pipeline_content).unwrap();
self.spawn_multiprocess(unprivileged_pipeline_content);
} else {
unprivileged_pipeline_content.start_all::<LTF, STF>(false);
}
@ -436,6 +420,36 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
self.pipelines.insert(pipeline_id, pipeline);
}
#[cfg(not(target_os = "windows"))]
fn spawn_multiprocess(&mut self, unprivileged_pipeline_content: UnprivilegedPipelineContent) {
let (server, token) =
IpcOneShotServer::<IpcSender<UnprivilegedPipelineContent>>::new().unwrap();
// If there is a sandbox, use the `gaol` API to create the child process.
let child_process = if opts::get().sandbox {
let mut command = sandbox::Command::me().unwrap();
command.arg("--content-process").arg(token);
let profile = sandboxing::content_process_sandbox_profile();
ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command).expect(
"Failed to start sandboxed child process!"))
} else {
let path_to_self = env::current_exe().unwrap();
let mut child_process = process::Command::new(path_to_self);
child_process.arg("--content-process");
child_process.arg(token);
ChildProcess::Unsandboxed(child_process.spawn().unwrap())
};
self.child_processes.push(child_process);
let (_receiver, sender) = server.accept().unwrap();
sender.send(unprivileged_pipeline_content).unwrap();
}
#[cfg(target_os = "windows")]
fn spawn_multiprocess(&mut self, _: UnprivilegedPipelineContent) {
panic!("Multiprocess is not supported on Windows.");
}
// Push a new (loading) pipeline to the list of pending frame changes
fn push_pending_frame(&mut self, new_pipeline_id: PipelineId,
old_pipeline_id: Option<PipelineId>) {

View file

@ -25,6 +25,7 @@ extern crate core_graphics;
extern crate core_text;
extern crate devtools_traits;
extern crate euclid;
#[cfg(not(target_os = "windows"))]
extern crate gaol;
extern crate gfx;
extern crate gfx_traits;
@ -66,6 +67,7 @@ pub mod compositor_thread;
pub mod constellation;
mod headless;
pub mod pipeline;
#[cfg(not(target_os = "windows"))]
pub mod sandboxing;
mod scrolling;
mod surface_map;

View file

@ -84,6 +84,9 @@ servo-fontconfig = "0.2"
[target.arm-linux-androideabi.dependencies]
servo-fontconfig = "0.2"
[target.x86_64-pc-windows-gnu.dependencies]
servo-fontconfig = "0.2"
[target.i686-unknown-linux-gnu.dependencies.freetype]
git = "https://github.com/servo/rust-freetype"
@ -99,6 +102,9 @@ git = "https://github.com/servo/rust-freetype"
[target.arm-linux-androideabi.dependencies.freetype]
git = "https://github.com/servo/rust-freetype"
[target.x86_64-pc-windows-gnu.dependencies.freetype]
git = "https://github.com/servo/rust-freetype"
[target.x86_64-unknown-linux-gnu.dependencies.simd]
git = "https://github.com/huonw/simd"

View file

@ -4,7 +4,7 @@
use app_units::Au;
use azure::azure_hl::BackendType;
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
use azure::scaled_font::FontInfo;
use azure::scaled_font::ScaledFont;
use fnv::FnvHasher;
@ -30,7 +30,7 @@ use style::computed_values::{font_style, font_variant};
use util::cache::HashCache;
use util::mem::HeapSizeOf;
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes),
pt_size.to_f32_px())

View file

@ -4,7 +4,7 @@
// For simd (currently x86_64/aarch64)
#![cfg_attr(any(target_arch = "x86_64", target_arch = "aarch64"), feature(convert))]
#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(heap_api))]
#![cfg_attr(any(target_os = "linux", target_os = "android", target_os = "windows"), feature(heap_api))]
#![feature(alloc)]
#![feature(box_syntax)]
@ -34,10 +34,10 @@ extern crate canvas_traits;
extern crate euclid;
extern crate fnv;
// Linux and Android-specific library dependencies
#[cfg(any(target_os = "linux", target_os = "android"))]
// Platforms that use Freetype/Fontconfig library dependencies
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
extern crate fontconfig;
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
extern crate freetype;
extern crate gfx_traits;
@ -75,7 +75,6 @@ extern crate url;
#[macro_use]
extern crate util;
pub use paint_context::PaintContext;
// Misc.

View file

@ -150,3 +150,10 @@ pub fn last_resort_font_families() -> Vec<String> {
pub fn last_resort_font_families() -> Vec<String> {
vec!("Roboto".to_owned())
}
#[cfg(target_os = "windows")]
pub fn last_resort_font_families() -> Vec<String> {
vec!(
"Arial".to_owned()
)
}

View file

@ -2,13 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
pub use platform::freetype::{font, font_context, font_list, font_template};
#[cfg(target_os = "macos")]
pub use platform::macos::{font, font_context, font_list, font_template};
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
pub mod freetype {
pub mod font;
pub mod font_context;

View file

@ -20,7 +20,7 @@ dependencies = [
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net 0.0.1",
@ -67,9 +67,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "angle"
version = "0.1.0"
source = "git+https://github.com/ecoal95/angle?branch=servo#2c14c35cdc223eb95efcaf6830d339db5b535d76"
source = "git+https://github.com/ecoal95/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -100,7 +100,7 @@ dependencies = [
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -195,7 +195,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -227,7 +227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -290,7 +290,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -298,7 +298,7 @@ name = "core-foundation-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -307,7 +307,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -318,7 +318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -406,7 +406,7 @@ name = "dylib"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -478,7 +478,7 @@ source = "git+https://github.com/energymon/energymon-rust.git#637e537934cdfc2142
dependencies = [
"energy-monitor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"energymon-default-sys 0.1.0 (git+https://github.com/energymon/energymon-sys.git)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -487,7 +487,7 @@ version = "0.1.0"
source = "git+https://github.com/energymon/energymon-sys.git#199cd11b36f14768a6a379843400c6a6671ffe5e"
dependencies = [
"energymon-sys 0.1.0 (git+https://github.com/energymon/energymon-sys.git)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -496,7 +496,7 @@ name = "energymon-sys"
version = "0.1.0"
source = "git+https://github.com/energymon/energymon-sys.git#199cd11b36f14768a6a379843400c6a6671ffe5e"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -545,7 +545,7 @@ name = "flate2"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -559,7 +559,7 @@ name = "freetype"
version = "0.1.0"
source = "git+https://github.com/servo/rust-freetype#d564ff90a3c69d987f5c015d7ec034cfaee21aff"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -568,7 +568,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -586,7 +586,7 @@ name = "gaol"
version = "0.0.1"
source = "git+https://github.com/pcwalton/gaol#e1349d8d3d933b3a90f9c86baa390261c510e019"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -632,7 +632,7 @@ dependencies = [
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -738,7 +738,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -746,7 +746,7 @@ name = "harfbuzz-sys"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -755,7 +755,7 @@ name = "hbs-common-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -764,7 +764,7 @@ version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-rust.git#0f46659b465927a88b23b69b66602ded43dd37b7"
dependencies = [
"hbs-pow-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -773,7 +773,7 @@ version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
dependencies = [
"hbs-common-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -782,7 +782,7 @@ name = "heapsize"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -868,7 +868,7 @@ dependencies = [
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -879,7 +879,7 @@ dependencies = [
"bincode 0.4.0 (git+https://github.com/TyOverby/bincode)",
"byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -889,10 +889,10 @@ dependencies = [
[[package]]
name = "js"
version = "0.1.1"
source = "git+https://github.com/servo/rust-mozjs#63bb31db39b0112d1d2604e8f731159b63f7d34c"
source = "git+https://github.com/servo/rust-mozjs#b96675b217534c7742cbfda8150ea0536aedbdfb"
dependencies = [
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs_sys 0.0.0 (git+https://github.com/servo/mozjs)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
@ -930,7 +930,7 @@ dependencies = [
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -954,7 +954,7 @@ dependencies = [
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"layout_traits 0.0.1",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net_traits 0.0.1",
@ -1005,7 +1005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.2"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -1032,7 +1032,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1041,7 +1041,7 @@ name = "log"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1064,7 +1064,7 @@ name = "malloc_buf"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1077,7 +1077,7 @@ name = "memchr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1087,7 +1087,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fs2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1113,15 +1113,15 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mozjs_sys"
version = "0.0.0"
source = "git+https://github.com/servo/mozjs#9cd5629500dec858956d39c757954782671f3052"
source = "git+https://github.com/servo/mozjs#5ac99916d4b9c1d1c2ffc896619f1daaf8fc84c4"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1174,7 +1174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ws2_32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1237,7 +1237,7 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1246,7 +1246,7 @@ name = "objc"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1293,7 +1293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys-extras 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1303,7 +1303,7 @@ name = "openssl-sys"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1314,7 +1314,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1323,7 +1323,7 @@ name = "osmesa-sys"
version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"shared_library 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1396,7 +1396,7 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"inflate 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1406,7 +1406,7 @@ version = "0.0.1"
dependencies = [
"hbs-pow 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-rust.git)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"profile_traits 0.0.1",
@ -1465,7 +1465,7 @@ version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1520,7 +1520,7 @@ dependencies = [
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net_traits 0.0.1",
@ -1566,7 +1566,7 @@ dependencies = [
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net_traits 0.0.1",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -1634,7 +1634,7 @@ name = "servo-egl"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1642,7 +1642,7 @@ name = "servo-fontconfig"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-fontconfig-sys 2.11.2-really.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1680,7 +1680,7 @@ dependencies = [
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"osmesa-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"shared_library 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1704,7 +1704,7 @@ dependencies = [
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1718,7 +1718,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1754,7 +1754,7 @@ name = "stb_image"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1852,7 +1852,7 @@ version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1878,7 +1878,7 @@ version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1961,9 +1961,10 @@ dependencies = [
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1985,7 +1986,7 @@ version = "0.0.1"
dependencies = [
"app_units 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"util 0.0.1",
]
@ -2012,7 +2013,7 @@ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"dlib 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-scanner 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
"wayland-sys 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2127,7 +2128,7 @@ name = "x11"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2137,7 +2138,7 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"dylib 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]

View file

@ -125,7 +125,22 @@ optional = true
version = "0.3"
features = ["release_max_level_info"]
[dependencies.gaol]
[target.arm-linux-androideabi.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.x86_64-apple-darwin.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.x86_64-unknown-linux-gnu.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.i686-unknown-linux-gnu.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.arm-unknown-linux-gnueabihf.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[target.aarch64-unknown-linux-gnueabihf.dependencies.gaol]
git = "https://github.com/pcwalton/gaol"
[dependencies.ipc-channel]

View file

@ -17,6 +17,7 @@
//! The `Browser` is fed events from a generic type that implements the
//! `WindowMethods` trait.
#[cfg(not(target_os = "windows"))]
extern crate gaol;
#[macro_use]
extern crate util as _util;
@ -60,10 +61,12 @@ use compositing::CompositorMsg as ConstellationMsg;
use compositing::compositor_thread::InitialCompositorState;
use compositing::constellation::InitialConstellationState;
use compositing::pipeline::UnprivilegedPipelineContent;
#[cfg(not(target_os = "windows"))]
use compositing::sandboxing;
use compositing::windowing::WindowEvent;
use compositing::windowing::WindowMethods;
use compositing::{CompositorProxy, CompositorThread, Constellation};
#[cfg(not(target_os = "windows"))]
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
use gfx::font_cache_thread::FontCacheThread;
use ipc_channel::ipc::{self, IpcSender};
@ -243,7 +246,7 @@ pub fn run_content_process(token: String) {
// Enter the sandbox if necessary.
if opts::get().sandbox {
ChildSandbox::new(sandboxing::content_process_sandbox_profile()).activate().unwrap();
create_sandbox();
}
script::init();
@ -261,3 +264,13 @@ pub unsafe extern fn __errno_location() -> *mut i32 {
extern { fn __errno() -> *mut i32; }
__errno()
}
#[cfg(not(target_os = "windows"))]
fn create_sandbox() {
ChildSandbox::new(sandboxing::content_process_sandbox_profile()).activate().unwrap();
}
#[cfg(target_os = "windows")]
fn create_sandbox() {
panic!("Sandboxing is not supported on Windows.");
}

View file

@ -8,12 +8,32 @@ use std::io::Write;
use std::path::Path;
use std::process::{Command, Stdio, exit};
#[cfg(windows)]
fn find_python() -> String {
if Command::new("python27.exe").arg("--version").output().is_ok() {
return "python27.exe".to_owned();
}
fn main() {
let python = if Command::new("python2.7").arg("--version").output().unwrap().status.success() {
if Command::new("python.exe").arg("--version").output().is_ok() {
return "python.exe".to_owned();
}
panic!("Can't find python (tried python27.exe and python.exe)! Try fixing PATH or setting the PYTHON env var");
}
#[cfg(not(windows))]
fn find_python() -> String {
if Command::new("python2.7").arg("--version").output().unwrap().status.success() {
"python2.7"
} else {
"python"
}.to_owned()
}
fn main() {
let python = match env::var("PYTHON") {
Ok(python_path) => python_path,
Err(_) => find_python(),
};
let style = Path::new(file!()).parent().unwrap();
let mako = style.join("Mako-0.9.1.zip");

View file

@ -66,3 +66,6 @@ getopts = "0.2.11"
hyper = { version = "0.7", optional = true }
url = {version = "0.5.2", features = ["serde_serialization"]}
uuid = "0.1.17"
[target.x86_64-pc-windows-gnu.dependencies]
kernel32-sys = "0.2"

View file

@ -7,7 +7,11 @@
//! Data associated with queues is simply a pair of unsigned integers. It is expected that a
//! higher-level API on top of this could allow safe fork-join parallelism.
#[cfg(windows)]
extern crate kernel32;
use deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
#[cfg(not(windows))]
use libc::usleep;
use rand::{Rng, XorShiftRng, weak_rng};
use std::sync::atomic::{AtomicUsize, Ordering};
@ -92,6 +96,20 @@ fn next_power_of_two(mut v: u32) -> u32 {
v
}
#[cfg(not(windows))]
fn sleep_microseconds(usec: u32) {
unsafe {
usleep(usec);
}
}
#[cfg(windows)]
fn sleep_microseconds(_: u32) {
unsafe {
kernel32::Sleep(0);
}
}
impl<QueueData: Sync, WorkData: Send> WorkerThread<QueueData, WorkData> {
/// The main logic. This function starts up the worker and listens for
/// messages.
@ -151,9 +169,8 @@ impl<QueueData: Sync, WorkData: Send> WorkerThread<QueueData, WorkData> {
}
}
unsafe {
usleep(back_off_sleep as u32);
}
sleep_microseconds(back_off_sleep);
back_off_sleep += BACKOFF_INCREMENT_IN_US;
i = 0
} else {