diff options
author | Josh Matthews <josh@joshmatthews.net> | 2015-01-15 13:26:44 -0500 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2015-01-28 10:16:49 +1000 |
commit | 95fc29fa0db21959df99d81cdbb9561226321d2f (patch) | |
tree | a48e171165ec155062ef13c550b2c0f72d127425 /components/devtools/actors | |
parent | ff8cbff81016c157373c1675f3eee69dd70ae544 (diff) | |
download | servo-95fc29fa0db21959df99d81cdbb9561226321d2f.tar.gz servo-95fc29fa0db21959df99d81cdbb9561226321d2f.zip |
Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.
Diffstat (limited to 'components/devtools/actors')
-rw-r--r-- | components/devtools/actors/console.rs | 43 | ||||
-rw-r--r-- | components/devtools/actors/inspector.rs | 72 | ||||
-rw-r--r-- | components/devtools/actors/root.rs | 8 | ||||
-rw-r--r-- | components/devtools/actors/tab.rs | 14 |
4 files changed, 71 insertions, 66 deletions
diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs index 5628506d5af..d8e88cdba8b 100644 --- a/components/devtools/actors/console.rs +++ b/components/devtools/actors/console.rs @@ -13,18 +13,19 @@ use devtools_traits::{EvaluateJS, NullValue, VoidValue, NumberValue, StringValue use devtools_traits::{ActorValue, DevtoolScriptControlMsg}; use servo_msg::constellation_msg::PipelineId; -use collections::TreeMap; +use collections::BTreeMap; use core::cell::RefCell; use serialize::json::{mod, Json, ToJson}; use std::io::TcpStream; use std::num::Float; +use std::sync::mpsc::{channel, Sender}; -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct StartedListenersTraits { customNetworkRequest: bool, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct StartedListenersReply { from: String, nativeConsoleAPI: bool, @@ -32,13 +33,13 @@ struct StartedListenersReply { traits: StartedListenersTraits, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] #[allow(dead_code)] struct ConsoleAPIMessage { _type: String, //FIXME: should this be __type__ instead? } -#[deriving(Encodable)] +#[derive(RustcEncodable)] #[allow(dead_code)] struct PageErrorMessage { _type: String, //FIXME: should this be __type__ instead? @@ -56,7 +57,7 @@ struct PageErrorMessage { private: bool, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] #[allow(dead_code)] struct LogMessage { _type: String, //FIXME: should this be __type__ instead? @@ -64,7 +65,7 @@ struct LogMessage { message: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] #[allow(dead_code)] enum ConsoleMessageType { ConsoleAPIType(ConsoleAPIMessage), @@ -72,26 +73,26 @@ enum ConsoleMessageType { LogMessageType(LogMessage), } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetCachedMessagesReply { from: String, messages: Vec<json::Object>, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct StopListenersReply { from: String, stoppedListeners: Vec<String>, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct AutocompleteReply { from: String, matches: Vec<String>, matchProp: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct EvaluateJSReply { from: String, input: String, @@ -220,28 +221,28 @@ impl Actor for ConsoleActor { "evaluateJS" => { let input = msg.get(&"text".to_string()).unwrap().as_string().unwrap().to_string(); let (chan, port) = channel(); - self.script_chan.send(EvaluateJS(self.pipeline, input.clone(), chan)); + self.script_chan.send(EvaluateJS(self.pipeline, input.clone(), chan)).unwrap(); //TODO: extract conversion into protocol module or some other useful place - let result = match try!(port.recv_opt()) { + let result = match try!(port.recv().map_err(|_| ())) { VoidValue => { - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); m.insert("type".to_string(), "undefined".to_string().to_json()); Json::Object(m) } NullValue => { - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); m.insert("type".to_string(), "null".to_string().to_json()); Json::Object(m) } BooleanValue(val) => val.to_json(), NumberValue(val) => { if val.is_nan() { - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); m.insert("type".to_string(), "NaN".to_string().to_json()); Json::Object(m) } else if val.is_infinite() { - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); if val < 0. { m.insert("type".to_string(), "-Infinity".to_string().to_json()); } else { @@ -249,7 +250,7 @@ impl Actor for ConsoleActor { } Json::Object(m) } else if val == Float::neg_zero() { - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); m.insert("type".to_string(), "-0".to_string().to_json()); Json::Object(m) } else { @@ -259,7 +260,7 @@ impl Actor for ConsoleActor { StringValue(s) => s.to_json(), ActorValue(s) => { //TODO: make initial ActorValue message include these properties. - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); m.insert("type".to_string(), "object".to_string().to_json()); m.insert("class".to_string(), "???".to_string().to_json()); m.insert("actor".to_string(), s.to_json()); @@ -276,9 +277,9 @@ impl Actor for ConsoleActor { input: input, result: result, timestamp: 0, - exception: Json::Object(TreeMap::new()), + exception: Json::Object(BTreeMap::new()), exceptionMessage: "".to_string(), - helperResult: Json::Object(TreeMap::new()), + helperResult: Json::Object(BTreeMap::new()), }; stream.write_json_packet(&msg); true diff --git a/components/devtools/actors/inspector.rs b/components/devtools/actors/inspector.rs index ac3b51cf34f..20611226edc 100644 --- a/components/devtools/actors/inspector.rs +++ b/components/devtools/actors/inspector.rs @@ -10,11 +10,12 @@ use devtools_traits::{GetLayout, NodeInfo, ModifyAttribute}; use actor::{Actor, ActorRegistry}; use protocol::JsonPacketStream; -use collections::TreeMap; +use collections::BTreeMap; use servo_msg::constellation_msg::PipelineId; use serialize::json::{mod, Json, ToJson}; use std::cell::RefCell; use std::io::TcpStream; +use std::sync::mpsc::{channel, Sender}; use std::num::Float; pub struct InspectorActor { @@ -26,13 +27,13 @@ pub struct InspectorActor { pub pipeline: PipelineId, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetHighlighterReply { highligter: HighlighterMsg, // sic. from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct HighlighterMsg { actor: String, } @@ -47,12 +48,12 @@ pub struct NodeActor { pipeline: PipelineId, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ShowBoxModelReply { from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct HideBoxModelReply { from: String, } @@ -89,7 +90,7 @@ impl Actor for HighlighterActor { } } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ModifyAttributeReply{ from: String, } @@ -114,7 +115,8 @@ impl Actor for NodeActor { self.script_chan.send(ModifyAttribute(self.pipeline, registry.actor_to_script(target.to_string()), - modifications)); + modifications)) + .unwrap(); let reply = ModifyAttributeReply{ from: self.name(), }; @@ -127,26 +129,26 @@ impl Actor for NodeActor { } } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetWalkerReply { from: String, walker: WalkerMsg, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct WalkerMsg { actor: String, root: NodeActorMsg, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct AttrMsg { namespace: String, name: String, value: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct NodeActorMsg { actor: String, baseURI: String, @@ -243,23 +245,23 @@ struct WalkerActor { pipeline: PipelineId, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct QuerySelectorReply { from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct DocumentElementReply { from: String, node: NodeActorMsg, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ClearPseudoclassesReply { from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ChildrenReply { hasFirst: bool, hasLast: bool, @@ -288,8 +290,8 @@ impl Actor for WalkerActor { "documentElement" => { let (tx, rx) = channel(); - self.script_chan.send(GetDocumentElement(self.pipeline, tx)); - let doc_elem_info = rx.recv(); + self.script_chan.send(GetDocumentElement(self.pipeline, tx)).unwrap(); + let doc_elem_info = rx.recv().unwrap(); let node = doc_elem_info.encode(registry, true, self.script_chan.clone(), self.pipeline); let msg = DocumentElementReply { @@ -313,8 +315,9 @@ impl Actor for WalkerActor { let (tx, rx) = channel(); self.script_chan.send(GetChildren(self.pipeline, registry.actor_to_script(target.to_string()), - tx)); - let children = rx.recv(); + tx)) + .unwrap(); + let children = rx.recv().unwrap(); let msg = ChildrenReply { hasFirst: true, @@ -333,13 +336,13 @@ impl Actor for WalkerActor { } } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetPageStyleReply { from: String, pageStyle: PageStyleMsg, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct PageStyleMsg { actor: String, } @@ -350,7 +353,7 @@ struct PageStyleActor { pipeline: PipelineId, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetAppliedReply { entries: Vec<AppliedEntry>, rules: Vec<AppliedRule>, @@ -358,13 +361,13 @@ struct GetAppliedReply { from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetComputedReply { computed: Vec<uint>, //XXX all css props from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct AppliedEntry { rule: String, pseudoElement: Json, @@ -372,7 +375,7 @@ struct AppliedEntry { matchedSelectors: Vec<String>, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct AppliedRule { actor: String, __type__: uint, @@ -383,7 +386,7 @@ struct AppliedRule { parentStyleSheet: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct AppliedSheet { actor: String, href: String, @@ -395,7 +398,7 @@ struct AppliedSheet { ruleCount: uint, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct GetLayoutReply { width: int, height: int, @@ -403,7 +406,7 @@ struct GetLayoutReply { from: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] #[allow(dead_code)] struct AutoMargins { top: String, @@ -450,9 +453,10 @@ impl Actor for PageStyleActor { let target = msg.get(&"node".to_string()).unwrap().as_string().unwrap(); let (tx, rx) = channel(); self.script_chan.send(GetLayout(self.pipeline, - registry.actor_to_script(target.to_string()), - tx)); - let (width, height) = rx.recv(); + registry.actor_to_script(target.to_string()), + tx)) + .unwrap(); + let (width, height) = rx.recv().unwrap(); let auto_margins = msg.get(&"autoMargins".to_string()).unwrap().as_boolean().unwrap(); @@ -463,7 +467,7 @@ impl Actor for PageStyleActor { height: height.round() as int, autoMargins: if auto_margins { //TODO: real values like processMargins in http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/styles.js - let mut m = TreeMap::new(); + let mut m = BTreeMap::new(); m.insert("top".to_string(), "auto".to_string().to_json()); m.insert("bottom".to_string(), "auto".to_string().to_json()); m.insert("left".to_string(), "auto".to_string().to_json()); @@ -507,8 +511,8 @@ impl Actor for InspectorActor { } let (tx, rx) = channel(); - self.script_chan.send(GetRootNode(self.pipeline, tx)); - let root_info = rx.recv(); + self.script_chan.send(GetRootNode(self.pipeline, tx)).unwrap(); + let root_info = rx.recv().unwrap(); let node = root_info.encode(registry, false, self.script_chan.clone(), self.pipeline); diff --git a/components/devtools/actors/root.rs b/components/devtools/actors/root.rs index da0e33d7c7d..cd9084c0282 100644 --- a/components/devtools/actors/root.rs +++ b/components/devtools/actors/root.rs @@ -13,28 +13,28 @@ use protocol::JsonPacketStream; use serialize::json; use std::io::TcpStream; -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ActorTraits { sources: bool, highlightable: bool, customHighlighters: Vec<String>, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ErrorReply { from: String, error: String, message: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ListTabsReply { from: String, selected: uint, tabs: Vec<TabActorMsg>, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct RootActorMsg { from: String, applicationType: String, diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs index 519e3e48128..69450cd4b32 100644 --- a/components/devtools/actors/tab.rs +++ b/components/devtools/actors/tab.rs @@ -13,10 +13,10 @@ use protocol::JsonPacketStream; use serialize::json; use std::io::TcpStream; -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct TabTraits; -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct TabAttachedReply { from: String, __type__: String, @@ -26,24 +26,24 @@ struct TabAttachedReply { traits: TabTraits, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct TabDetachedReply { from: String, __type__: String, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ReconfigureReply { from: String } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct ListFramesReply { from: String, frames: Vec<FrameMsg>, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] struct FrameMsg { id: uint, url: String, @@ -51,7 +51,7 @@ struct FrameMsg { parentID: uint, } -#[deriving(Encodable)] +#[derive(RustcEncodable)] pub struct TabActorMsg { actor: String, title: String, |