Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.

This commit is contained in:
Ms2ger 2015-01-02 12:45:28 +01:00 committed by Josh Matthews
parent cf616b90a2
commit 16c7060bc8
153 changed files with 2095 additions and 1298 deletions

View file

@ -29,9 +29,9 @@ use png;
use gleam::gl::types::{GLint, GLsizei};
use gleam::gl;
use script_traits::{ConstellationControlMsg, ScriptControlChan};
use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, LayerId};
use servo_msg::compositor_msg::{ReadyState, PaintState, Scrollable};
use servo_msg::constellation_msg::{mod, ConstellationChan};
use servo_msg::compositor_msg::{Epoch, LayerId};
use servo_msg::compositor_msg::{ReadyState, PaintState, ScrollPolicy};
use servo_msg::constellation_msg::{ConstellationChan, NavigationDirection};
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use servo_msg::constellation_msg::{PipelineId, WindowSizeData};
@ -147,7 +147,7 @@ enum CompositionRequest {
CompositeNow,
}
#[deriving(PartialEq, Show)]
#[deriving(Copy, PartialEq, Show)]
enum ShutdownState {
NotShuttingDown,
ShuttingDown,
@ -380,9 +380,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn get_earliest_pipeline_ready_state(&self) -> ReadyState {
if self.ready_states.len() == 0 {
return Blank;
return ReadyState::Blank;
}
return self.ready_states.values().fold(FinishedLoading, |a, &b| cmp::min(a, b));
return self.ready_states.values().fold(ReadyState::FinishedLoading,
|a, &b| cmp::min(a, b));
}
@ -477,7 +478,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
id: LayerId::null(),
rect: Rect::zero(),
background_color: azure_hl::Color::new(0., 0., 0., 0.),
scroll_policy: Scrollable,
scroll_policy: ScrollPolicy::Scrollable,
};
let root_layer = CompositorData::new_layer(pipeline.clone(),
@ -504,7 +505,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
frame_rect: Option<TypedRect<PagePx, f32>>)
-> Rc<Layer<CompositorData>> {
// Initialize the ReadyState and PaintState for this pipeline.
self.ready_states.insert(frame_tree.pipeline.id, Blank);
self.ready_states.insert(frame_tree.pipeline.id, ReadyState::Blank);
self.paint_states.insert(frame_tree.pipeline.id, PaintState::Painting);
let root_layer = self.create_root_layer_for_pipeline_and_rect(&frame_tree.pipeline,
@ -907,8 +908,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn on_navigation_window_event(&self, direction: WindowNavigateMsg) {
let direction = match direction {
windowing::WindowNavigateMsg::Forward => constellation_msg::Forward,
windowing::WindowNavigateMsg::Back => constellation_msg::Back,
windowing::WindowNavigateMsg::Forward => NavigationDirection::Forward,
windowing::WindowNavigateMsg::Back => NavigationDirection::Back,
};
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::Navigate(direction))
@ -916,7 +917,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn on_key_event(&self, key: Key, state: KeyState, modifiers: KeyModifiers) {
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(constellation_msg::KeyEvent(key, state, modifiers))
chan.send(ConstellationMsg::KeyEvent(key, state, modifiers))
}
fn convert_buffer_requests_to_pipeline_requests_map(&self,
@ -1025,7 +1026,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
return false;
}
if self.get_earliest_pipeline_ready_state() != FinishedLoading {
if self.get_earliest_pipeline_ready_state() != ReadyState::FinishedLoading {
return false;
}
@ -1123,7 +1124,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let mut img = png::Image {
width: width as u32,
height: height as u32,
pixels: png::RGB8(pixels),
pixels: png::PixelsByColorType::RGB8(pixels),
};
let res = png::store_png(&mut img, &path);
assert!(res.is_ok());

View file

@ -17,9 +17,9 @@ use layers::color::Color;
use layers::geometry::LayerPixel;
use layers::layers::{Layer, LayerBufferSet};
use layers::platform::surface::NativeSurfaceMethods;
use script_traits::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
use script_traits::CompositorEvent::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
use script_traits::{ScriptControlChan, ConstellationControlMsg};
use servo_msg::compositor_msg::{Epoch, FixedPosition, LayerId, ScrollPolicy};
use servo_msg::compositor_msg::{Epoch, LayerId, ScrollPolicy};
use std::num::Float;
use std::num::FloatMath;
use std::rc::Rc;
@ -122,7 +122,7 @@ pub trait CompositorLayer {
fn wants_scroll_events(&self) -> WantsScrollEventsFlag;
}
#[deriving(PartialEq, Clone)]
#[deriving(Copy, PartialEq, Clone)]
pub enum WantsScrollEventsFlag {
WantsScrollEvents,
DoesntWantScrollEvents,
@ -343,7 +343,7 @@ impl CompositorLayer for Layer<CompositorData> {
let mut result = false;
// Only scroll this layer if it's not fixed-positioned.
if self.extra_data.borrow().scroll_policy != FixedPosition {
if self.extra_data.borrow().scroll_policy != ScrollPolicy::FixedPosition {
let new_offset = new_offset.to_untyped();
*self.transform.borrow_mut() = identity().translate(new_offset.x, new_offset.y, 0.0);
*self.content_offset.borrow_mut() = Point2D::from_untyped(&new_offset);

View file

@ -20,12 +20,12 @@ use layers::layers::LayerBufferSet;
use servo_msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState};
use servo_msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy};
use servo_msg::constellation_msg::{ConstellationChan, LoadData, PipelineId};
use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers, Pressed};
use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers};
use servo_util::cursor::Cursor;
use servo_util::memory::MemoryProfilerChan;
use servo_util::time::TimeProfilerChan;
use std::comm::{channel, Sender, Receiver};
use std::fmt::{FormatError, Formatter, Show};
use std::fmt::{Error, Formatter, Show};
use std::rc::Rc;
/// Sends messages to the compositor. This is a trait supplied by the port because the method used
@ -89,13 +89,14 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> {
}
fn send_key_event(&mut self, key: Key, state: KeyState, modifiers: KeyModifiers) {
if state == Pressed {
if state == KeyState::Pressed {
self.send(Msg::KeyEvent(key, modifiers));
}
}
}
/// Information about each layer that the compositor keeps.
#[deriving(Copy)]
pub struct LayerProperties {
pub pipeline_id: PipelineId,
pub epoch: Epoch,
@ -221,7 +222,7 @@ pub enum Msg {
}
impl Show for Msg {
fn fmt(&self, f: &mut Formatter) -> Result<(),FormatError> {
fn fmt(&self, f: &mut Formatter) -> Result<(),Error> {
match *self {
Msg::Exit(..) => write!(f, "Exit"),
Msg::ShutdownComplete(..) => write!(f, "ShutdownComplete"),

View file

@ -14,12 +14,12 @@ use gfx::font_cache_task::FontCacheTask;
use layers::geometry::DevicePixel;
use layout_traits::LayoutTaskFactory;
use libc;
use script_traits::{mod, ConstellationControlMsg};
use script_traits::{CompositorEvent, ConstellationControlMsg};
use script_traits::{ScriptControlChan, ScriptTaskFactory};
use servo_msg::compositor_msg::LayerId;
use servo_msg::constellation_msg::{mod, ConstellationChan, Failure};
use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed};
use servo_msg::constellation_msg::{KeyEvent, Key, KeyState, KeyModifiers};
use servo_msg::constellation_msg::{IFrameSandboxState, NavigationDirection};
use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers};
use servo_msg::constellation_msg::{LoadData, NavigationType};
use servo_msg::constellation_msg::{PipelineExitType, PipelineId};
use servo_msg::constellation_msg::{SubpageId, WindowSizeData};
@ -27,8 +27,7 @@ use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task;
use servo_net::storage_task::StorageTask;
use servo_net::storage_task;
use servo_net::storage_task::{StorageTask, StorageTaskMsg};
use servo_util::cursor::Cursor;
use servo_util::geometry::{PagePx, ViewportPx};
use servo_util::opts;
@ -91,6 +90,7 @@ pub struct Constellation<LTF, STF> {
}
/// A unique ID used to identify a frame.
#[deriving(Copy)]
pub struct FrameId(u32);
/// One frame in the hierarchy.
@ -515,11 +515,11 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
pipeline.exit(PipelineExitType::Complete);
}
self.image_cache_task.exit();
self.resource_task.send(resource_task::Exit);
self.resource_task.send(resource_task::ControlMsg::Exit);
self.devtools_chan.as_ref().map(|chan| {
chan.send(devtools_traits::ServerExitMsg);
});
self.storage_task.send(storage_task::Exit);
self.storage_task.send(StorageTaskMsg::Exit);
self.font_cache_task.exit();
self.compositor_proxy.send(CompositorMsg::ShutdownComplete);
}
@ -571,7 +571,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.browse(Some(pipeline_id),
Rc::new(FrameTree::new(new_frame_id, pipeline.clone(), None)),
constellation_msg::Load);
NavigationType::Load);
self.pipelines.insert(new_id, pipeline);
}
@ -596,7 +596,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let pipeline = self.new_pipeline(next_pipeline_id, None, None, LoadData::new(url));
self.browse(None,
Rc::new(FrameTree::new(next_frame_id, pipeline.clone(), None)),
constellation_msg::Load);
NavigationType::Load);
self.pipelines.insert(pipeline.id, pipeline);
}
@ -718,7 +718,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let source_url = source_pipeline.load_data.url.clone();
let same_script = (source_url.host() == url.host() &&
source_url.port() == url.port()) && sandbox == IFrameUnsandboxed;
source_url.port() == url.port()) &&
sandbox == IFrameSandboxState::IFrameUnsandboxed;
// FIXME(tkuehn): Need to follow the standardized spec for checking same-origin
// Reuse the script task if the URL is same-origin
let script_pipeline = if same_script {
@ -785,7 +786,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
Rc::new(FrameTree::new(next_frame_id,
pipeline.clone(),
parent.borrow().clone())),
constellation_msg::Load);
NavigationType::Load);
self.pipelines.insert(pipeline.id, pipeline);
}
@ -797,7 +798,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// navigation always has navigation priority, and after that new page loading is
// first come, first served.
let destination_frame = match direction {
constellation_msg::Forward => {
NavigationDirection::Forward => {
if self.navigation_context.next.is_empty() {
debug!("no next page to navigate to");
return;
@ -809,7 +810,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
self.navigation_context.forward(&mut *self.compositor_proxy)
}
constellation_msg::Back => {
NavigationDirection::Back => {
if self.navigation_context.previous.is_empty() {
debug!("no previous page to navigate to");
return;
@ -826,7 +827,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
for frame in destination_frame.iter() {
frame.pipeline.load();
}
self.grant_paint_permission(destination_frame, constellation_msg::Navigate);
self.grant_paint_permission(destination_frame, NavigationType::Navigate);
}
@ -838,7 +839,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) {
self.current_frame().as_ref().map(|frame| {
let ScriptControlChan(ref chan) = frame.pipeline.script_chan;
chan.send(ConstellationControlMsg::SendEvent(frame.pipeline.id, script_traits::KeyEvent(key, state, mods)));
chan.send(ConstellationControlMsg::SendEvent(
frame.pipeline.id, CompositorEvent::KeyEvent(key, state, mods)));
});
}
@ -1005,7 +1007,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// Don't call navigation_context.load() on a Navigate type (or None, as in the case of
// parsed iframes that finish loading)
match navigation_type {
constellation_msg::Load => {
NavigationType::Load => {
debug!("evicting old frames due to load");
let evicted = self.navigation_context.load(frame_tree,
&mut *self.compositor_proxy);

View file

@ -3,13 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use CompositorProxy;
use layout_traits::{ExitNowMsg, LayoutTaskFactory, LayoutControlChan};
use layout_traits::{LayoutControlMsg, LayoutTaskFactory, LayoutControlChan};
use script_traits::{ScriptControlChan, ScriptTaskFactory};
use script_traits::{NewLayoutInfo, ConstellationControlMsg};
use devtools_traits::DevtoolsControlChan;
use gfx::paint_task::Msg as PaintMsg;
use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked};
use gfx::paint_task::{PaintChan, PaintTask};
use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
@ -166,12 +165,12 @@ impl Pipeline {
}
pub fn grant_paint_permission(&self) {
let _ = self.paint_chan.send_opt(PaintPermissionGranted);
let _ = self.paint_chan.send_opt(PaintMsg::PaintPermissionGranted);
}
pub fn revoke_paint_permission(&self) {
debug!("pipeline revoking paint channel paint permission");
let _ = self.paint_chan.send_opt(PaintPermissionRevoked);
let _ = self.paint_chan.send_opt(PaintMsg::PaintPermissionRevoked);
}
pub fn exit(&self, exit_type: PipelineExitType) {
@ -196,7 +195,7 @@ impl Pipeline {
PipelineExitType::PipelineOnly));
let _ = self.paint_chan.send_opt(PaintMsg::Exit(None, PipelineExitType::PipelineOnly));
let LayoutControlChan(ref layout_channel) = self.layout_chan;
let _ = layout_channel.send_opt(ExitNowMsg(PipelineExitType::PipelineOnly));
let _ = layout_channel.send_opt(LayoutControlMsg::ExitNowMsg(PipelineExitType::PipelineOnly));
}
pub fn to_sendable(&self) -> CompositionPipeline {

View file

@ -15,21 +15,24 @@ use servo_msg::compositor_msg::{PaintState, ReadyState};
use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
use servo_util::cursor::Cursor;
use servo_util::geometry::ScreenPx;
use std::fmt::{FormatError, Formatter, Show};
use std::fmt::{Error, Formatter, Show};
use std::rc::Rc;
#[deriving(Clone)]
pub enum MouseWindowEvent {
Click(uint, TypedPoint2D<DevicePixel, f32>),
MouseDown(uint, TypedPoint2D<DevicePixel, f32>),
MouseUp(uint, TypedPoint2D<DevicePixel, f32>),
}
#[deriving(Clone)]
pub enum WindowNavigateMsg {
Forward,
Back,
}
/// Events that the windowing system sends to Servo.
#[deriving(Clone)]
pub enum WindowEvent {
/// Sent when no message has arrived, but the event loop was kicked for some reason (perhaps
/// by another Servo subsystem).
@ -68,7 +71,7 @@ pub enum WindowEvent {
}
impl Show for WindowEvent {
fn fmt(&self, f: &mut Formatter) -> Result<(),FormatError> {
fn fmt(&self, f: &mut Formatter) -> Result<(),Error> {
match *self {
WindowEvent::Idle => write!(f, "Idle"),
WindowEvent::Refresh => write!(f, "Refresh"),