mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
auto merge of #4924 : servo/servo/warnings, r=jdm
This commit is contained in:
commit
9c476a290a
10 changed files with 46 additions and 35 deletions
|
@ -8,9 +8,9 @@
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
#![feature(hash)]
|
#![feature(hash)]
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(io)]
|
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(io))]
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(path)]
|
#![cfg_attr(any(target_os="linux", target_os = "android"), feature(path))]
|
||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
#![feature(std_misc)]
|
#![feature(std_misc)]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
|
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
|
||||||
//! Use this for structs that correspond to a DOM type
|
//! Use this for structs that correspond to a DOM type
|
||||||
|
|
||||||
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core)]
|
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, core, unicode)]
|
||||||
|
|
||||||
#![allow(missing_copy_implementations)]
|
#![allow(missing_copy_implementations)]
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use glutin_app;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell, BorrowState};
|
||||||
use std::sync::atomic::{AtomicInt, Ordering};
|
use std::sync::atomic::{AtomicInt, Ordering};
|
||||||
|
|
||||||
thread_local!(pub static ID_COUNTER: AtomicInt = AtomicInt::new(0));
|
thread_local!(pub static ID_COUNTER: AtomicInt = AtomicInt::new(0));
|
||||||
|
@ -144,19 +144,19 @@ impl ServoCefBrowserExtensions for CefBrowser {
|
||||||
self.downcast().message_queue.borrow_mut().push(event);
|
self.downcast().message_queue.borrow_mut().push(event);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match self.downcast().servo_browser.try_borrow_mut() {
|
match self.downcast().servo_browser.borrow_state() {
|
||||||
None => {
|
BorrowState::Unused => {
|
||||||
// We're trying to send an event while processing another one. This will
|
|
||||||
// cause general badness, so queue up that event instead of immediately
|
|
||||||
// processing it.
|
|
||||||
break
|
|
||||||
}
|
|
||||||
Some(ref mut browser) => {
|
|
||||||
let event = match self.downcast().message_queue.borrow_mut().pop() {
|
let event = match self.downcast().message_queue.borrow_mut().pop() {
|
||||||
None => return,
|
None => return,
|
||||||
Some(event) => event,
|
Some(event) => event,
|
||||||
};
|
};
|
||||||
browser.handle_event(event);
|
self.downcast().servo_browser.borrow_mut().handle_event(event);
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
// We're trying to send an event while processing another one. This will
|
||||||
|
// cause general badness, so queue up that event instead of immediately
|
||||||
|
// processing it.
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ fn command_line_new() -> *mut command_line_t {
|
||||||
pub fn command_line_init(argc: c_int, argv: *const *const u8) {
|
pub fn command_line_init(argc: c_int, argv: *const *const u8) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut a: Vec<String> = vec!();
|
let mut a: Vec<String> = vec!();
|
||||||
for i in range(0u, argc as uint) {
|
for i in 0u..(argc as uint) {
|
||||||
let offset = *argv.offset(i as int) as *const c_char;
|
let offset = *argv.offset(i as int) as *const c_char;
|
||||||
let slice = ffi::c_str_to_bytes(&offset);
|
let slice = ffi::c_str_to_bytes(&offset);
|
||||||
let s = str::from_utf8(slice).unwrap();
|
let s = str::from_utf8(slice).unwrap();
|
||||||
|
@ -58,7 +58,7 @@ pub extern "C" fn command_line_get_switch_value(cmd: *mut cef_command_line_t, na
|
||||||
let cl: *mut command_line_t = mem::transmute(cmd);
|
let cl: *mut command_line_t = mem::transmute(cmd);
|
||||||
let cs: *const cef_string_utf16_t = mem::transmute(name);
|
let cs: *const cef_string_utf16_t = mem::transmute(name);
|
||||||
let buf = (*cs).str as *const _;
|
let buf = (*cs).str as *const _;
|
||||||
let slice = slice::from_raw_buf(&buf, (*cs).length as usize);
|
let slice = slice::from_raw_parts(buf, (*cs).length as usize);
|
||||||
let opt = String::from_utf16(slice).unwrap();
|
let opt = String::from_utf16(slice).unwrap();
|
||||||
//debug!("opt: {}", opt);
|
//debug!("opt: {}", opt);
|
||||||
for s in (*cl).argv.iter() {
|
for s in (*cl).argv.iter() {
|
||||||
|
@ -66,7 +66,7 @@ pub extern "C" fn command_line_get_switch_value(cmd: *mut cef_command_line_t, na
|
||||||
//debug!("arg: {}", o);
|
//debug!("arg: {}", o);
|
||||||
if o.as_slice().starts_with(opt.as_slice()) {
|
if o.as_slice().starts_with(opt.as_slice()) {
|
||||||
let mut string = mem::uninitialized();
|
let mut string = mem::uninitialized();
|
||||||
let arg = o.slice_from(opt.len() + 1).as_bytes();
|
let arg = o[opt.len() + 1..].as_bytes();
|
||||||
let c_str = ffi::CString::from_slice(arg);
|
let c_str = ffi::CString::from_slice(arg);
|
||||||
cef_string_utf16_set(c_str.as_bytes().as_ptr() as *const _,
|
cef_string_utf16_set(c_str.as_bytes().as_ptr() as *const _,
|
||||||
arg.len() as size_t,
|
arg.len() as size_t,
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub trait Downcast<Class> {
|
||||||
|
|
||||||
pub fn slice_to_str<F>(s: *const u8, l: uint, f: F) -> c_int where F: FnOnce(&str) -> c_int {
|
pub fn slice_to_str<F>(s: *const u8, l: uint, f: F) -> c_int where F: FnOnce(&str) -> c_int {
|
||||||
unsafe {
|
unsafe {
|
||||||
let s = slice::from_raw_buf(&s, l);
|
let s = slice::from_raw_parts(s, l);
|
||||||
str::from_utf8(s).map(f).unwrap_or(0)
|
str::from_utf8(s).map(f).unwrap_or(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,19 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#![feature(thread_local, link_args, plugin, box_syntax, int_uint)]
|
#![feature(int_uint)]
|
||||||
|
#![feature(box_syntax)]
|
||||||
|
#![feature(plugin)]
|
||||||
|
#![feature(link_args)]
|
||||||
|
#![feature(thread_local)]
|
||||||
|
#![feature(libc)]
|
||||||
|
#![feature(unicode)]
|
||||||
|
#![feature(core)]
|
||||||
|
#![feature(std_misc)]
|
||||||
|
#![feature(rustc_private)]
|
||||||
|
#![feature(collections)]
|
||||||
|
|
||||||
#![allow(experimental, non_camel_case_types, unstable)]
|
#![allow(non_camel_case_types)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
|
@ -18,6 +18,7 @@ use types::{cef_string_userfree_utf16_t, cef_string_userfree_utf8_t, cef_string_
|
||||||
//cef_string
|
//cef_string
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
#[allow(private_no_mangle_fns)]
|
||||||
extern "C" fn string_wide_dtor(str: *mut wchar_t) {
|
extern "C" fn string_wide_dtor(str: *mut wchar_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::free(str as *mut c_void)
|
libc::free(str as *mut c_void)
|
||||||
|
@ -25,6 +26,7 @@ extern "C" fn string_wide_dtor(str: *mut wchar_t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
#[allow(private_no_mangle_fns)]
|
||||||
extern "C" fn string_utf8_dtor(str: *mut u8) {
|
extern "C" fn string_utf8_dtor(str: *mut u8) {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::free(str as *mut c_void)
|
libc::free(str as *mut c_void)
|
||||||
|
@ -32,6 +34,7 @@ extern "C" fn string_utf8_dtor(str: *mut u8) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
#[allow(private_no_mangle_fns)]
|
||||||
extern "C" fn string_utf16_dtor(str: *mut c_ushort) {
|
extern "C" fn string_utf16_dtor(str: *mut c_ushort) {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::free(str as *mut c_void)
|
libc::free(str as *mut c_void)
|
||||||
|
@ -109,8 +112,8 @@ pub extern "C" fn cef_string_utf8_cmp(a: *const cef_string_utf8_t, b: *const cef
|
||||||
unsafe {
|
unsafe {
|
||||||
let astr = (*a).str as *const u8;
|
let astr = (*a).str as *const u8;
|
||||||
let bstr = (*b).str as *const u8;
|
let bstr = (*b).str as *const u8;
|
||||||
let astr = slice::from_raw_buf(&astr, (*a).length as uint);
|
let astr = slice::from_raw_parts(astr, (*a).length as uint);
|
||||||
let bstr = slice::from_raw_buf(&bstr, (*b).length as uint);
|
let bstr = slice::from_raw_parts(bstr, (*b).length as uint);
|
||||||
match astr.cmp(bstr) {
|
match astr.cmp(bstr) {
|
||||||
Ordering::Less => -1,
|
Ordering::Less => -1,
|
||||||
Ordering::Equal => 0,
|
Ordering::Equal => 0,
|
||||||
|
@ -131,7 +134,7 @@ pub extern "C" fn cef_string_utf8_to_utf16(src: *const u8, src_len: size_t, outp
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn cef_string_utf16_to_utf8(src: *const u16, src_len: size_t, output: *mut cef_string_utf8_t) -> c_int {
|
pub extern "C" fn cef_string_utf16_to_utf8(src: *const u16, src_len: size_t, output: *mut cef_string_utf8_t) -> c_int {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ustr = slice::from_raw_buf(&src, src_len as uint);
|
let ustr = slice::from_raw_parts(src, src_len as uint);
|
||||||
match string::String::from_utf16(ustr) {
|
match string::String::from_utf16(ustr) {
|
||||||
Ok(str) => {
|
Ok(str) => {
|
||||||
cef_string_utf8_set(str.as_bytes().as_ptr(), str.len() as size_t, output, 1);
|
cef_string_utf8_set(str.as_bytes().as_ptr(), str.len() as size_t, output, 1);
|
||||||
|
@ -190,8 +193,8 @@ pub extern "C" fn cef_string_utf16_cmp(a: *const cef_string_utf16_t, b: *const c
|
||||||
unsafe {
|
unsafe {
|
||||||
let astr = (*a).str as *const _;
|
let astr = (*a).str as *const _;
|
||||||
let bstr = (*b).str as *const _;
|
let bstr = (*b).str as *const _;
|
||||||
let astr: &[u16] = slice::from_raw_buf(&astr, (*a).length as uint);
|
let astr: &[u16] = slice::from_raw_parts(astr, (*a).length as uint);
|
||||||
let bstr: &[u16] = slice::from_raw_buf(&bstr, (*b).length as uint);
|
let bstr: &[u16] = slice::from_raw_parts(bstr, (*b).length as uint);
|
||||||
match astr.cmp(bstr) {
|
match astr.cmp(bstr) {
|
||||||
Ordering::Less => -1,
|
Ordering::Less => -1,
|
||||||
Ordering::Equal => 0,
|
Ordering::Equal => 0,
|
||||||
|
@ -248,8 +251,8 @@ pub extern "C" fn cef_string_wide_cmp(a: *const cef_string_wide_t, b: *const cef
|
||||||
unsafe {
|
unsafe {
|
||||||
let astr = (*a).str as *const wchar_t;
|
let astr = (*a).str as *const wchar_t;
|
||||||
let bstr = (*b).str as *const wchar_t;
|
let bstr = (*b).str as *const wchar_t;
|
||||||
let astr = slice::from_raw_buf(&astr, (*a).length as uint);
|
let astr = slice::from_raw_parts(astr, (*a).length as uint);
|
||||||
let bstr = slice::from_raw_buf(&bstr, (*b).length as uint);
|
let bstr = slice::from_raw_parts(bstr, (*b).length as uint);
|
||||||
match astr.cmp(bstr) {
|
match astr.cmp(bstr) {
|
||||||
Ordering::Less => -1,
|
Ordering::Less => -1,
|
||||||
Ordering::Equal => 0,
|
Ordering::Equal => 0,
|
||||||
|
@ -275,7 +278,7 @@ pub extern "C" fn cef_string_wide_to_utf8(src: *const wchar_t, src_len: size_t,
|
||||||
return cef_string_utf16_to_utf8(src as *const u16, src_len, output);
|
return cef_string_utf16_to_utf8(src as *const u16, src_len, output);
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let ustr = slice::from_raw_buf(&src, src_len as uint);
|
let ustr = slice::from_raw_parts(src, src_len as uint);
|
||||||
let conv = ustr.iter().map(|&c| char::from_u32(c as u32).unwrap_or('\u{FFFD}')).collect::<String>();
|
let conv = ustr.iter().map(|&c| char::from_u32(c as u32).unwrap_or('\u{FFFD}')).collect::<String>();
|
||||||
cef_string_utf8_set(conv.as_bytes().as_ptr(), conv.len() as size_t, output, 1)
|
cef_string_utf8_set(conv.as_bytes().as_ptr(), conv.len() as size_t, output, 1)
|
||||||
}
|
}
|
||||||
|
@ -292,7 +295,7 @@ pub extern "C" fn cef_string_ascii_to_utf16(src: *const u8, src_len: size_t, out
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn cef_string_ascii_to_wide(src: *const u8, src_len: size_t, output: *mut cef_string_wide_t) -> c_int {
|
pub extern "C" fn cef_string_ascii_to_wide(src: *const u8, src_len: size_t, output: *mut cef_string_wide_t) -> c_int {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ustr = slice::from_raw_buf(&src, src_len as uint);
|
let ustr = slice::from_raw_parts(src, src_len as uint);
|
||||||
let conv = ustr.iter().map(|&c| c as u8).collect::<Vec<u8>>();
|
let conv = ustr.iter().map(|&c| c as u8).collect::<Vec<u8>>();
|
||||||
cef_string_wide_set(conv.as_ptr() as *const wchar_t, conv.len() as size_t, output, 1)
|
cef_string_wide_set(conv.as_ptr() as *const wchar_t, conv.len() as size_t, output, 1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,6 @@ use std::ffi::CString;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::{Sender, channel};
|
use std::sync::mpsc::{Sender, channel};
|
||||||
|
|
||||||
#[cfg(target_os="macos")]
|
|
||||||
use std::ptr;
|
|
||||||
|
|
||||||
/// The type of an off-screen window.
|
/// The type of an off-screen window.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
|
@ -355,7 +352,7 @@ impl CompositorProxy for CefCompositorProxy {
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
fn send(&mut self, msg: compositor_task::Msg) {
|
fn send(&mut self, msg: compositor_task::Msg) {
|
||||||
// FIXME(pcwalton): Kick the GTK event loop awake?
|
// FIXME(pcwalton): Kick the GTK event loop awake?
|
||||||
self.sender.send(msg);
|
self.sender.send(msg).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone_compositor_proxy(&self) -> Box<CompositorProxy+Send> {
|
fn clone_compositor_proxy(&self) -> Box<CompositorProxy+Send> {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
#![feature(hash)]
|
#![cfg_attr(feature = "window", feature(hash))]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#![feature(env)]
|
||||||
#![feature(io)]
|
#![feature(io)]
|
||||||
|
|
||||||
use std::old_io::process::{Command, ProcessExit, StdioContainer};
|
use std::old_io::process::{Command, ProcessExit, StdioContainer};
|
||||||
use std::os;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let out_dir = os::getenv("OUT_DIR").unwrap();
|
let out_dir = env::var_string("OUT_DIR").unwrap();
|
||||||
let result = Command::new("make")
|
let result = Command::new("make")
|
||||||
.args(&["-f", "makefile.cargo"])
|
.args(&["-f", "makefile.cargo"])
|
||||||
.stdout(StdioContainer::InheritFd(1))
|
.stdout(StdioContainer::InheritFd(1))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue