diff options
author | Sagar Muchhal <muchhalsagar88@gmail.com> | 2014-12-03 21:14:03 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-12-03 18:45:05 -0800 |
commit | 75ffda9fb8b04d4b4bba3222c67d95a5754ad0fb (patch) | |
tree | 4c1a9783fdeab5a3e0759a0579f156d214069342 /components/devtools/lib.rs | |
parent | ad9aedac77d094b8524b6170b857499bdc9cd762 (diff) | |
download | servo-75ffda9fb8b04d4b4bba3222c67d95a5754ad0fb.tar.gz servo-75ffda9fb8b04d4b4bba3222c67d95a5754ad0fb.zip |
Support for Separated Read Write
Diffstat (limited to 'components/devtools/lib.rs')
-rw-r--r-- | components/devtools/lib.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 12239c6a3a4..8233cd1da51 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -40,6 +40,7 @@ use servo_msg::constellation_msg::PipelineId; use servo_util::task::spawn_named; use std::cell::RefCell; +use std::collections::HashMap; use std::comm; use std::comm::{Disconnected, Empty}; use std::io::{TcpListener, TcpStream}; @@ -87,6 +88,8 @@ fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) { let mut accepted_connections: Vec<TcpStream> = Vec::new(); + let mut actor_pipelines: HashMap<PipelineId, String> = HashMap::new(); + /// Process the input from a single devtools client until EOF. fn handle_client(actors: Arc<Mutex<ActorRegistry>>, mut stream: TcpStream) { println!("connection established to {}", stream.peer_name().unwrap()); @@ -114,7 +117,8 @@ fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) { // TODO: move this into the root or tab modules? fn handle_new_global(actors: Arc<Mutex<ActorRegistry>>, pipeline: PipelineId, - sender: Sender<DevtoolScriptControlMsg>) { + sender: Sender<DevtoolScriptControlMsg>, + actor_pipelines: &mut HashMap<PipelineId, String>) { let mut actors = actors.lock(); //TODO: move all this actor creation into a constructor method on TabActor @@ -123,6 +127,7 @@ fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) { name: actors.new_name("console"), script_chan: sender.clone(), pipeline: pipeline, + streams: RefCell::new(Vec::new()), }; let inspector = InspectorActor { name: actors.new_name("inspector"), @@ -146,6 +151,7 @@ fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) { (tab, console, inspector) }; + actor_pipelines.insert(pipeline, tab.name.clone()); actors.register(box tab); actors.register(box console); actors.register(box inspector); @@ -162,7 +168,7 @@ fn run_server(receiver: Receiver<DevtoolsControlMsg>, port: u16) { Err(ref e) if e.kind == TimedOut => { match receiver.try_recv() { Ok(ServerExitMsg) | Err(Disconnected) => break, - Ok(NewGlobal(id, sender)) => handle_new_global(actors.clone(), id, sender), + Ok(NewGlobal(id, sender)) => handle_new_global(actors.clone(), id, sender, &mut actor_pipelines), Err(Empty) => acceptor.set_timeout(Some(POLL_TIMEOUT)), } } |