auto merge of #4820 : servo/servo/send-recv, r=Ms2ger

This commit is contained in:
bors-servo 2015-02-03 11:24:53 -07:00
commit 8e6dcc7c26
30 changed files with 100 additions and 100 deletions

View file

@ -45,7 +45,7 @@ pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, r
//FIXME: jsvals don't have an is_int32/is_number yet
assert!(rval.is_object());
panic!("object values unimplemented")
});
}).unwrap();
}
pub fn handle_get_root_node(page: &Rc<Page>, pipeline: PipelineId, reply: Sender<NodeInfo>) {
@ -54,7 +54,7 @@ pub fn handle_get_root_node(page: &Rc<Page>, pipeline: PipelineId, reply: Sender
let document = frame.as_ref().unwrap().document.root();
let node: JSRef<Node> = NodeCast::from_ref(document.r());
reply.send(node.summarize());
reply.send(node.summarize()).unwrap();
}
pub fn handle_get_document_element(page: &Rc<Page>, pipeline: PipelineId, reply: Sender<NodeInfo>) {
@ -64,7 +64,7 @@ pub fn handle_get_document_element(page: &Rc<Page>, pipeline: PipelineId, reply:
let document_element = document.r().GetDocumentElement().root().unwrap();
let node: JSRef<Node> = NodeCast::from_ref(document_element.r());
reply.send(node.summarize());
reply.send(node.summarize()).unwrap();
}
fn find_node_by_unique_id(page: &Rc<Page>, pipeline: PipelineId, node_id: String) -> Temporary<Node> {
@ -85,14 +85,14 @@ fn find_node_by_unique_id(page: &Rc<Page>, pipeline: PipelineId, node_id: String
pub fn handle_get_children(page: &Rc<Page>, pipeline: PipelineId, node_id: String, reply: Sender<Vec<NodeInfo>>) {
let parent = find_node_by_unique_id(&*page, pipeline, node_id).root();
let children = parent.r().children().map(|child| child.summarize()).collect();
reply.send(children);
reply.send(children).unwrap();
}
pub fn handle_get_layout(page: &Rc<Page>, pipeline: PipelineId, node_id: String, reply: Sender<(f32, f32)>) {
let node = find_node_by_unique_id(&*page, pipeline, node_id).root();
let elem: JSRef<Element> = ElementCast::to_ref(node.r()).expect("should be getting layout of element");
let rect = elem.GetBoundingClientRect().root();
reply.send((rect.r().Width(), rect.r().Height()));
reply.send((rect.r().Width(), rect.r().Height())).unwrap();
}
pub fn handle_modify_attribute(page: &Rc<Page>, pipeline: PipelineId, node_id: String, modifications: Vec<Modification>) {

View file

@ -42,7 +42,7 @@ impl CanvasRenderingContext2D {
}
pub fn recreate(&self, size: Size2D<i32>) {
self.renderer.send(Recreate(size));
self.renderer.send(Recreate(size)).unwrap();
}
}
@ -63,23 +63,23 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
fn FillRect(self, x: f64, y: f64, width: f64, height: f64) {
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
self.renderer.send(FillRect(rect));
self.renderer.send(FillRect(rect)).unwrap();
}
fn ClearRect(self, x: f64, y: f64, width: f64, height: f64) {
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
self.renderer.send(ClearRect(rect));
self.renderer.send(ClearRect(rect)).unwrap();
}
fn StrokeRect(self, x: f64, y: f64, width: f64, height: f64) {
let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32));
self.renderer.send(StrokeRect(rect));
self.renderer.send(StrokeRect(rect)).unwrap();
}
}
#[unsafe_destructor]
impl Drop for CanvasRenderingContext2D {
fn drop(&mut self) {
self.renderer.send(Close);
self.renderer.send(Close).unwrap();
}
}

View file

@ -47,7 +47,7 @@ pub struct SendableWorkerScriptChan {
impl ScriptChan for SendableWorkerScriptChan {
fn send(&self, msg: ScriptMsg) {
self.sender.send((self.worker.clone(), msg));
self.sender.send((self.worker.clone(), msg)).unwrap();
}
fn clone(&self) -> Box<ScriptChan + Send> {

View file

@ -223,7 +223,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
let window = self.window.root();
let window = window.r();
let LayoutChan(ref layout_chan) = window.page().layout_chan;
layout_chan.send(Msg::SetQuirksMode);
layout_chan.send(Msg::SetQuirksMode).unwrap();
}
NoQuirks | LimitedQuirks => {}
}

View file

@ -113,7 +113,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
page.id,
new_subpage_id,
old_subpage_id,
sandboxed));
sandboxed)).unwrap();
}
}

View file

@ -133,7 +133,7 @@ impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
match UrlParser::new().base_url(&window.page().get_url()).parse(href) {
Ok(url) => {
let LayoutChan(ref layout_chan) = window.page().layout_chan;
layout_chan.send(Msg::LoadStylesheet(url));
layout_chan.send(Msg::LoadStylesheet(url)).unwrap();
}
Err(e) => debug!("Parsing url {} failed: {}", href, e)
}

View file

@ -57,7 +57,7 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
let data = node.GetTextContent().expect("Element.textContent must be a string");
let sheet = Stylesheet::from_str(data.as_slice(), url, Origin::Author);
let LayoutChan(ref layout_chan) = win.page().layout_chan;
layout_chan.send(Msg::AddStylesheet(sheet));
layout_chan.send(Msg::AddStylesheet(sheet)).unwrap();
}
}

View file

@ -54,21 +54,21 @@ impl<'a> StorageMethods for JSRef<'a, Storage> {
fn Length(self) -> u32 {
let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::Length(sender, self.get_url()));
self.get_storage_task().send(StorageTaskMsg::Length(sender, self.get_url())).unwrap();
receiver.recv().unwrap()
}
fn Key(self, index: u32) -> Option<DOMString> {
let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::Key(sender, self.get_url(), index));
self.get_storage_task().send(StorageTaskMsg::Key(sender, self.get_url(), index)).unwrap();
receiver.recv().unwrap()
}
fn GetItem(self, name: DOMString) -> Option<DOMString> {
let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::GetItem(sender, self.get_url(), name));
self.get_storage_task().send(StorageTaskMsg::GetItem(sender, self.get_url(), name)).unwrap();
receiver.recv().unwrap()
}
@ -81,7 +81,7 @@ impl<'a> StorageMethods for JSRef<'a, Storage> {
fn SetItem(self, name: DOMString, value: DOMString) {
let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::SetItem(sender, self.get_url(), name, value));
self.get_storage_task().send(StorageTaskMsg::SetItem(sender, self.get_url(), name, value)).unwrap();
if receiver.recv().unwrap() {
//TODO send notification
}
@ -98,7 +98,7 @@ impl<'a> StorageMethods for JSRef<'a, Storage> {
fn RemoveItem(self, name: DOMString) {
let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::RemoveItem(sender, self.get_url(), name));
self.get_storage_task().send(StorageTaskMsg::RemoveItem(sender, self.get_url(), name)).unwrap();
if receiver.recv().unwrap() {
//TODO send notification
}
@ -111,7 +111,7 @@ impl<'a> StorageMethods for JSRef<'a, Storage> {
fn Clear(self) {
let (sender, receiver) = channel();
self.get_storage_task().send(StorageTaskMsg::Clear(sender, self.get_url()));
self.get_storage_task().send(StorageTaskMsg::Clear(sender, self.get_url())).unwrap();
if receiver.recv().unwrap() {
//TODO send notification
}

View file

@ -94,7 +94,7 @@ impl<'a> WorkerMethods for JSRef<'a, Worker> {
fn PostMessage(self, cx: *mut JSContext, message: JSVal) -> ErrorResult {
let data = try!(StructuredCloneData::write(cx, message));
let address = Trusted::new(cx, self, self.global.root().r().script_chan().clone());
self.sender.send((address, ScriptMsg::DOMMessage(data)));
self.sender.send((address, ScriptMsg::DOMMessage(data))).unwrap();
Ok(())
}

View file

@ -260,7 +260,7 @@ impl XMLHttpRequest {
// perhaps should be handled by the resource_loader?
spawn_named("XHR:Cors".to_owned(), move || {
let response = req2.http_fetch();
chan.send(response);
chan.send(response).unwrap();
});
select! (
@ -282,7 +282,7 @@ impl XMLHttpRequest {
}
// Step 10, 13
resource_task.send(Load(load_data));
resource_task.send(Load(load_data)).unwrap();
let progress_port;

View file

@ -139,7 +139,7 @@ impl Page {
let layout_rpc: Box<LayoutRPC> = {
let (rpc_send, rpc_recv) = channel();
let LayoutChan(ref lchan) = layout_chan;
lchan.send(Msg::GetRPC(rpc_send));
lchan.send(Msg::GetRPC(rpc_send)).unwrap();
rpc_recv.recv().unwrap()
};
Page {
@ -323,7 +323,7 @@ impl Page {
match join_port.try_recv() {
Err(Empty) => {
info!("script: waiting on layout");
join_port.recv();
join_port.recv().unwrap();
}
Ok(_) => {}
Err(Disconnected) => {
@ -398,7 +398,7 @@ impl Page {
};
let LayoutChan(ref chan) = self.layout_chan;
chan.send(Msg::Reflow(reflow));
chan.send(Msg::Reflow(reflow)).unwrap();
debug!("script: layout forked");

View file

@ -144,7 +144,7 @@ pub struct NonWorkerScriptChan(pub Sender<ScriptMsg>);
impl ScriptChan for NonWorkerScriptChan {
fn send(&self, msg: ScriptMsg) {
let NonWorkerScriptChan(ref chan) = *self;
chan.send(msg);
chan.send(msg).unwrap();
}
fn clone(&self) -> Box<ScriptChan+Send> {
@ -695,7 +695,7 @@ impl ScriptTask {
/// TODO(tkuehn): is it ever possible to navigate only on a subframe?
fn handle_navigate_msg(&self, direction: NavigationDirection) {
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::Navigate(direction));
chan.send(ConstellationMsg::Navigate(direction)).unwrap();
}
/// Window was resized, but this script was not active, so don't reflow yet
@ -832,7 +832,7 @@ impl ScriptTask {
data: load_data.data,
cors: None,
consumer: input_chan,
}));
})).unwrap();
let load_response = input_port.recv().unwrap();
@ -899,7 +899,7 @@ impl ScriptTask {
*page.fragment_name.borrow_mut() = final_url.fragment.clone();
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::LoadComplete);
chan.send(ConstellationMsg::LoadComplete).unwrap();
// Notify devtools that a new script global exists.
match self.devtools_chan {
@ -910,7 +910,7 @@ impl ScriptTask {
url: final_url
};
chan.send(NewGlobal(pipeline_id, self.devtools_sender.clone(),
page_info));
page_info)).unwrap();
}
}
}
@ -1070,7 +1070,7 @@ impl ScriptTask {
/// for the given pipeline.
fn trigger_load(&self, pipeline_id: PipelineId, load_data: LoadData) {
let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(ConstellationMsg::LoadUrl(pipeline_id, load_data));
const_chan.send(ConstellationMsg::LoadUrl(pipeline_id, load_data)).unwrap();
}
/// The entry point for content to notify that a fragment url has been requested
@ -1284,8 +1284,8 @@ fn shut_down_layout(page_tree: &Rc<Page>, rt: *mut JSRuntime, exit_type: Pipelin
// processed this message.
let (response_chan, response_port) = channel();
let LayoutChan(ref chan) = page.layout_chan;
chan.send(layout_interface::Msg::PrepareToExit(response_chan));
response_port.recv();
chan.send(layout_interface::Msg::PrepareToExit(response_chan)).unwrap();
response_port.recv().unwrap();
}
// Remove our references to the DOM objects in this page tree.
@ -1307,7 +1307,7 @@ fn shut_down_layout(page_tree: &Rc<Page>, rt: *mut JSRuntime, exit_type: Pipelin
// Destroy the layout task. If there were node leaks, layout will now crash safely.
for page in page_tree.iter() {
let LayoutChan(ref chan) = page.layout_chan;
chan.send(layout_interface::Msg::ExitNow(exit_type));
chan.send(layout_interface::Msg::ExitNow(exit_type)).unwrap();
}
}

View file

@ -148,7 +148,7 @@ impl TimerManager {
loop {
let id = select.wait();
if id == timeout_handle.id() {
timeout_port.recv();
timeout_port.recv().unwrap();
script_chan.send(ScriptMsg::FireTimer(source, TimerId(handle)));
if is_interval == IsInterval::NonInterval {
break;