Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Rust #5935

Merged
merged 1 commit into from May 5, 2015
Merged

Upgrade Rust #5935

Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8.

  • Loading branch information
SimonSapin authored and jdm committed May 5, 2015
commit ef8edd4e87aeb3cc71dfd9da2f69437080f5410e
@@ -1 +1 @@
2015-03-11
2015-04-14
@@ -10,9 +10,6 @@ path = "lib.rs"
[dependencies.azure]
git = "https://github.com/servo/rust-azure"

[dependencies.cssparser]
git = "https://github.com/servo/rust-cssparser"

[dependencies.geom]
git = "https://github.com/servo/rust-geom"

@@ -31,4 +28,8 @@ branch = "servo"
features = ["headless"]

[dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
git = "https://github.com/servo/rust-offscreen-rendering-context"

[dependencies]
cssparser = "0.3.1"
num = "0.1.24"
@@ -13,13 +13,13 @@ use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
use gfx::color;
use num::ToPrimitive;
use util::task::spawn_named;
use util::vec::byte_swap;

use cssparser::RGBA;
use std::borrow::ToOwned;
use std::mem;
use std::num::{Float, ToPrimitive};
use std::sync::mpsc::{channel, Sender};

impl<'a> CanvasPaintTask<'a> {
@@ -2,9 +2,8 @@
* 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/. */

#![feature(collections)]
#![feature(core)]
#![feature(std_misc)]
#![feature(collections)]
#![feature(rustc_private)]

extern crate azure;
@@ -13,6 +12,7 @@ extern crate geom;
extern crate gfx;
extern crate util;
extern crate gleam;
extern crate num;
extern crate offscreen_gl_context;
extern crate glutin;

@@ -163,7 +163,7 @@ impl WebGLPaintTask {
}

fn get_attrib_location(&self, program_id: u32, name: String, chan: Sender<i32> ) {
let attrib_location = gl::get_attrib_location(program_id, name.as_slice());
let attrib_location = gl::get_attrib_location(program_id, &name);
chan.send(attrib_location).unwrap();
}

@@ -178,7 +178,7 @@ impl WebGLPaintTask {
}

fn get_uniform_location(&self, program_id: u32, name: String, chan: Sender<u32>) {
let uniform_location = gl::get_uniform_location(program_id, name.as_slice());
let uniform_location = gl::get_uniform_location(program_id, &name);
chan.send(uniform_location as u32).unwrap();
}

@@ -202,8 +202,7 @@ impl WebGLPaintTask {
let dst_start = y * stride;
let src_start = (height - y - 1) * stride;
let src_slice = &orig_pixels[src_start .. src_start + stride];
copy_memory(&mut pixels[dst_start .. dst_start + stride],
&src_slice[..stride]);
copy_memory(&src_slice[..stride], &mut pixels[dst_start .. dst_start + stride]);
}

// rgba -> bgra
@@ -213,7 +212,7 @@ impl WebGLPaintTask {

fn shader_source(&self, shader_id: u32, source_lines: Vec<String>) {
let mut lines: Vec<&[u8]> = source_lines.iter().map(|line| line.as_bytes()).collect();
gl::shader_source(shader_id, lines.as_mut_slice());
gl::shader_source(shader_id, &mut lines);
}

fn uniform_4fv(&self, uniform_id: u32, data: Vec<f32>) {
@@ -59,7 +59,7 @@ git = "https://github.com/servo/rust-core-text"
git = "https://github.com/servo/gleam"

[dependencies.clipboard]
git = "https://github.com/aweinstock314/rust-x11-clipboard"
git = "https://github.com/servo/rust-x11-clipboard"

[dependencies]
url = "0.2.16"
@@ -39,7 +39,6 @@ use std::cmp;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::mem as std_mem;
use std::num::Float;
use std::rc::Rc;
use std::slice::bytes::copy_memory;
use std::sync::mpsc::Sender;
@@ -1189,8 +1188,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let dst_start = y * stride;
let src_start = (height - y - 1) * stride;
let src_slice = &orig_pixels[src_start .. src_start + stride];
copy_memory(&mut pixels[dst_start .. dst_start + stride],
&src_slice[..stride]);
copy_memory(&src_slice[..stride],
&mut pixels[dst_start .. dst_start + stride]);
}
let mut img = png::Image {
width: width as u32,
@@ -20,7 +20,6 @@ use script_traits::CompositorEvent::{ClickEvent, MouseDownEvent, MouseMoveEvent,
use script_traits::{ScriptControlChan, ConstellationControlMsg};
use msg::compositor_msg::{Epoch, LayerId, ScrollPolicy};
use msg::constellation_msg::PipelineId;
use std::num::Float;
use std::rc::Rc;

pub struct CompositorData {
@@ -63,6 +62,7 @@ impl CompositorData {
Rc::new(Layer::new(Rect::from_untyped(&layer_properties.rect),
tile_size,
to_layers_color(&layer_properties.background_color),
1.0,
new_compositor_data))
}
}
@@ -4,10 +4,7 @@

#![feature(box_syntax)]
#![feature(core)]
#![feature(io)]
#![feature(old_io)]
#![feature(rustc_private)]
#![feature(std_misc)]

#[macro_use]
extern crate log;
@@ -6,10 +6,8 @@

use compositor_task::{CompositorProxy, Msg};

use std::old_io::timer;
use std::sync::mpsc::{Receiver, Sender, channel};
use std::thread::Builder;
use std::time::duration::Duration;
use std::thread::{Builder, sleep_ms};
use time;

/// The amount of time in nanoseconds that we give to the painting thread to paint new tiles upon
@@ -61,8 +59,8 @@ impl ScrollingTimer {
match self.receiver.recv() {
Ok(ToScrollingTimerMsg::ScrollEventProcessedMsg(timestamp)) => {
let target = timestamp as i64 + TIMEOUT;
let delta = target - (time::precise_time_ns() as i64);
timer::sleep(Duration::nanoseconds(delta));
let delta_ns = target - (time::precise_time_ns() as i64);
sleep_ms((delta_ns / 1000) as u32);
self.compositor_proxy.send(Msg::ScrollTimeout(timestamp));
}
Ok(ToScrollingTimerMsg::ExitMsg) | Err(_) => break,
@@ -8,6 +8,7 @@ use rustc_serialize::json;
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::cell::{Cell, RefCell};
use std::marker::Reflect;
use std::mem::{replace, transmute};
use std::net::TcpStream;
use std::raw::TraitObject;
@@ -26,10 +27,10 @@ pub trait Actor: Any {
fn name(&self) -> String;
}

impl Actor {
impl Actor + Send {
/// Returns true if the boxed type is the same as `T`
#[inline]
pub fn is<T: 'static>(&self) -> bool {
pub fn is<T: Reflect + 'static>(&self) -> bool {
// Get TypeId of the type this function is instantiated with
let t = TypeId::of::<T>();

@@ -43,7 +44,7 @@ impl Actor {
/// Returns some reference to the boxed value if it is of type `T`, or
/// `None` if it isn't.
#[inline]
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> {
pub fn downcast_ref<T: Reflect + 'static>(&self) -> Option<&T> {
if self.is::<T>() {
unsafe {
// Get the raw representation of the trait object
@@ -60,7 +61,7 @@ impl Actor {
/// Returns some mutable reference to the boxed value if it is of type `T`, or
/// `None` if it isn't.
#[inline]
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
pub fn downcast_mut<T: Reflect + 'static>(&mut self) -> Option<&mut T> {
if self.is::<T>() {
unsafe {
// Get the raw representation of the trait object
@@ -168,13 +169,13 @@ impl ActorRegistry {
}

/// Find an actor by registered name
pub fn find<'a, T: 'static>(&'a self, name: &str) -> &'a T {
pub fn find<'a, T: Reflect + 'static>(&'a self, name: &str) -> &'a T {
let actor = self.actors.get(&name.to_string()).unwrap();
actor.downcast_ref::<T>().unwrap()
}

/// Find an actor by registered name
pub fn find_mut<'a, T: 'static>(&'a mut self, name: &str) -> &'a mut T {
pub fn find_mut<'a, T: Reflect + 'static>(&'a mut self, name: &str) -> &'a mut T {
let actor = self.actors.get_mut(&name.to_string()).unwrap();
actor.downcast_mut::<T>().unwrap()
}
@@ -18,7 +18,6 @@ use collections::BTreeMap;
use core::cell::RefCell;
use rustc_serialize::json::{self, Json, ToJson};
use std::net::TcpStream;
use std::num::Float;
use std::sync::mpsc::{channel, Sender};

#[derive(RustcEncodable)]
@@ -251,7 +250,7 @@ impl Actor for ConsoleActor {
m.insert("type".to_string(), "Infinity".to_string().to_json());
}
Json::Object(m)
} else if val == Float::neg_zero() {
} else if val == 0. && val.is_sign_negative() {
let mut m = BTreeMap::new();
m.insert("type".to_string(), "-0".to_string().to_json());
Json::Object(m)
@@ -16,7 +16,6 @@ use msg::constellation_msg::PipelineId;
use rustc_serialize::json::{self, Json, ToJson};
use std::cell::RefCell;
use std::net::TcpStream;
use std::num::Float;
use std::sync::mpsc::{channel, Sender};

pub struct InspectorActor {
@@ -2,15 +2,14 @@
* 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/. */

use core::iter::FromIterator;
use msg::constellation_msg::PipelineId;
use rustc_serialize::{json, Encoder, Encodable};
use std::cell::RefCell;
use std::collections::{HashMap, VecDeque};
use std::mem;
use std::net::TcpStream;
use std::old_io::timer::sleep;
use std::thread::sleep_ms;
use std::sync::{Arc, Mutex};
use std::time::duration::Duration;
use std::sync::mpsc::{channel, Sender, Receiver};
use time::PreciseTime;

@@ -117,7 +116,7 @@ impl Encodable for HighResolutionStamp {
}
}

static DEFAULT_TIMELINE_DATA_PULL_TIMEOUT: usize = 200; //ms
static DEFAULT_TIMELINE_DATA_PULL_TIMEOUT: u32 = 200; //ms

impl TimelineActor {
pub fn new(name: String,
@@ -214,7 +213,7 @@ impl TimelineActor {
}
emitter.send();

sleep(Duration::milliseconds(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT as i64));
sleep_ms(DEFAULT_TIMELINE_DATA_PULL_TIMEOUT);
}
});
}
@@ -344,7 +343,7 @@ impl Emitter {
let end_time = PreciseTime::now();
let reply = MarkersEmitterReply {
__type__: "markers".to_string(),
markers: Vec::from_iter(self.markers.drain()),
markers: mem::replace(&mut self.markers, Vec::new()),
from: self.from.clone(),
endTime: HighResolutionStamp::new(self.start_stamp, end_time),
};
@@ -11,10 +11,7 @@
#![crate_type = "rlib"]

#![feature(box_syntax, core, rustc_private)]
#![feature(collections, std_misc)]
#![feature(io)]
#![feature(net)]
#![feature(old_io)]
#![feature(collections)]

#![allow(non_snake_case)]

@@ -24,7 +21,7 @@ extern crate log;
extern crate collections;
extern crate core;
extern crate devtools_traits;
extern crate "rustc-serialize" as rustc_serialize;
extern crate rustc_serialize;
extern crate msg;
extern crate time;
extern crate util;
@@ -46,6 +43,7 @@ use util::task::spawn_named;
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::collections::HashMap;
use std::error::Error;
use std::sync::mpsc::{channel, Receiver, Sender, RecvError};
use std::net::{TcpListener, TcpStream, Shutdown};
use std::sync::{Arc, Mutex};
@@ -128,7 +126,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,

'outer: loop {
match stream.read_json_packet() {
Ok(json_packet) => {
Ok(Some(json_packet)) => {
match actors.lock().unwrap().handle_message(json_packet.as_object().unwrap(),
&mut stream) {
Ok(()) => {},
@@ -139,6 +137,10 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
}
}
}
Ok(None) => {
println!("error: EOF");
break 'outer
}
Err(e) => {
println!("error: {}", e.description());
break 'outer
@@ -244,7 +246,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
id: PipelineId,
actor_pipelines: &HashMap<PipelineId, String>) -> String {
let actors = actors.lock().unwrap();
let ref tab_actor_name = (*actor_pipelines)[id];
let ref tab_actor_name = (*actor_pipelines)[&id];
let tab_actor = actors.find::<TabActor>(tab_actor_name);
let console_actor_name = tab_actor.console.clone();
return console_actor_name;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.