Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.

This commit is contained in:
Josh Matthews 2015-01-15 13:26:44 -05:00 committed by Glenn Watson
parent ff8cbff810
commit 95fc29fa0d
255 changed files with 3550 additions and 3362 deletions

View file

@ -31,13 +31,13 @@ use servo_util::smallvec::SmallVec;
use servo_util::task::spawn_named_with_send_on_failure;
use servo_util::task_state;
use servo_util::time::{TimeProfilerChan, TimeProfilerCategory, profile};
use std::comm::{Receiver, Sender, channel};
use std::mem;
use std::task::TaskBuilder;
use std::thread::Builder;
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender, channel};
/// Information about a hardware graphics layer that layout sends to the painting task.
#[deriving(Clone)]
#[derive(Clone)]
pub struct PaintLayer {
/// A per-pipeline ID describing this layer that should be stable across reflows.
pub id: LayerId,
@ -74,7 +74,7 @@ pub enum Msg {
Exit(Option<Sender<()>>, PipelineExitType),
}
#[deriving(Clone)]
#[derive(Clone)]
pub struct PaintChan(Sender<Msg>);
impl PaintChan {
@ -84,13 +84,12 @@ impl PaintChan {
}
pub fn send(&self, msg: Msg) {
let &PaintChan(ref chan) = self;
assert!(chan.send_opt(msg).is_ok(), "PaintChan.send: paint port closed")
assert!(self.send_opt(msg).is_ok(), "PaintChan.send: paint port closed")
}
pub fn send_opt(&self, msg: Msg) -> Result<(), Msg> {
let &PaintChan(ref chan) = self;
chan.send_opt(msg)
chan.send(msg).map_err(|e| e.0)
}
}
@ -132,7 +131,7 @@ macro_rules! native_graphics_context(
($task:expr) => (
$task.native_graphics_context.as_ref().expect("Need a graphics context to do painting")
)
)
);
impl<C> PaintTask<C> where C: PaintListener + Send {
pub fn create(id: PipelineId,
@ -144,7 +143,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
time_profiler_chan: TimeProfilerChan,
shutdown_chan: Sender<()>) {
let ConstellationChan(c) = constellation_chan.clone();
spawn_named_with_send_on_failure("PaintTask", task_state::PAINT, proc() {
spawn_named_with_send_on_failure("PaintTask", task_state::PAINT, move |:| {
{
// Ensures that the paint task and graphics context are destroyed before the
// shutdown message.
@ -196,7 +195,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
let mut exit_response_channel : Option<Sender<()>> = None;
let mut waiting_for_compositor_buffers_to_exit = false;
loop {
match self.port.recv() {
match self.port.recv().unwrap() {
Msg::PaintInit(stacking_context) => {
self.root_stacking_context = Some(stacking_context.clone());
@ -226,7 +225,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
if self.epoch == epoch {
self.paint(&mut replies, buffer_requests, scale, layer_id);
} else {
debug!("painter epoch mismatch: {} != {}", self.epoch, epoch);
debug!("painter epoch mismatch: {:?} != {:?}", self.epoch, epoch);
}
}
@ -336,7 +335,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
mut tiles: Vec<BufferRequest>,
scale: f32,
layer_id: LayerId) {
profile(TimeProfilerCategory::Painting, None, self.time_profiler_chan.clone(), || {
profile(TimeProfilerCategory::Painting, None, self.time_profiler_chan.clone(), |:| {
// Bail out if there is no appropriate stacking context.
let stacking_context = if let Some(ref stacking_context) = self.root_stacking_context {
match display_list::find_stacking_context_with_layer_id(stacking_context,
@ -360,10 +359,10 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
stacking_context.clone(),
scale);
}
let new_buffers = Vec::from_fn(tile_count, |i| {
let new_buffers = (0..tile_count).map(|&mut :i| {
let thread_id = i % self.worker_threads.len();
self.worker_threads[thread_id].get_painted_tile_buffer()
});
}).collect();
let layer_buffer_set = box LayerBufferSet {
buffers: new_buffers,
@ -425,13 +424,13 @@ impl WorkerThreadProxy {
} else {
opts::get().layout_threads
};
Vec::from_fn(thread_count, |_| {
(0..thread_count).map(|&:_| {
let (from_worker_sender, from_worker_receiver) = channel();
let (to_worker_sender, to_worker_receiver) = channel();
let native_graphics_metadata = native_graphics_metadata.clone();
let font_cache_task = font_cache_task.clone();
let time_profiler_chan = time_profiler_chan.clone();
TaskBuilder::new().spawn(proc() {
Builder::new().spawn(move || {
let mut worker_thread = WorkerThread::new(from_worker_sender,
to_worker_receiver,
native_graphics_metadata,
@ -443,7 +442,7 @@ impl WorkerThreadProxy {
receiver: from_worker_receiver,
sender: to_worker_sender,
}
})
}).collect()
}
fn paint_tile(&mut self,
@ -451,17 +450,17 @@ impl WorkerThreadProxy {
layer_buffer: Option<Box<LayerBuffer>>,
stacking_context: Arc<StackingContext>,
scale: f32) {
self.sender.send(MsgToWorkerThread::PaintTile(tile, layer_buffer, stacking_context, scale))
self.sender.send(MsgToWorkerThread::PaintTile(tile, layer_buffer, stacking_context, scale)).unwrap()
}
fn get_painted_tile_buffer(&mut self) -> Box<LayerBuffer> {
match self.receiver.recv() {
match self.receiver.recv().unwrap() {
MsgFromWorkerThread::PaintedTile(layer_buffer) => layer_buffer,
}
}
fn exit(&mut self) {
self.sender.send(MsgToWorkerThread::Exit)
self.sender.send(MsgToWorkerThread::Exit).unwrap()
}
}
@ -493,7 +492,7 @@ impl WorkerThread {
fn main(&mut self) {
loop {
match self.receiver.recv() {
match self.receiver.recv().unwrap() {
MsgToWorkerThread::Exit => break,
MsgToWorkerThread::PaintTile(tile, layer_buffer, stacking_context, scale) => {
let draw_target = self.optimize_and_paint_tile(&tile, stacking_context, scale);
@ -501,7 +500,7 @@ impl WorkerThread {
layer_buffer,
draw_target,
scale);
self.sender.send(MsgFromWorkerThread::PaintedTile(buffer))
self.sender.send(MsgFromWorkerThread::PaintedTile(buffer)).unwrap()
}
}
}
@ -582,7 +581,7 @@ impl WorkerThread {
// GPU painting mode, so that it doesn't have to recreate it.
if !opts::get().gpu_painting {
let mut buffer = layer_buffer.unwrap();
draw_target.snapshot().get_data_surface().with_data(|data| {
draw_target.snapshot().get_data_surface().with_data(|&mut:data| {
buffer.native_surface.upload(native_graphics_context!(self), data);
debug!("painting worker thread uploading to native surface {}",
buffer.native_surface.get_id());