aboutsummaryrefslogtreecommitdiffstats
path: root/components/devtools
diff options
context:
space:
mode:
Diffstat (limited to 'components/devtools')
-rw-r--r--components/devtools/actor.rs11
-rw-r--r--components/devtools/lib.rs7
2 files changed, 8 insertions, 10 deletions
diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs
index fae6c8864cf..d9f214c79f1 100644
--- a/components/devtools/actor.rs
+++ b/components/devtools/actor.rs
@@ -8,7 +8,7 @@ use std::any::{Any, AnyRefExt, AnyMutRefExt};
use std::collections::hashmap::HashMap;
use std::cell::{Cell, RefCell};
use std::io::TcpStream;
-use std::mem::{transmute, transmute_copy};
+use std::mem::{transmute, transmute_copy, replace};
use std::raw::TraitObject;
use serialize::json;
@@ -24,7 +24,7 @@ pub trait Actor: Any {
fn name(&self) -> String;
}
-impl<'a> AnyMutRefExt<'a> for &'a mut Actor {
+impl<'a> AnyMutRefExt<'a> for &'a mut Actor + 'a {
fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> {
if self.is::<T>() {
unsafe {
@@ -40,7 +40,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Actor {
}
}
-impl<'a> AnyRefExt<'a> for &'a Actor {
+impl<'a> AnyRefExt<'a> for &'a Actor + 'a {
fn is<T: 'static>(self) -> bool {
//FIXME: This implementation is bogus since get_type_id is private now.
// However, this implementation is only needed so long as there's a Rust bug
@@ -162,10 +162,9 @@ impl ActorRegistry {
}
}
}
- let mut new_actors = self.new_actors.borrow_mut();
- for &actor in new_actors.iter() {
+ let mut new_actors = replace(&mut *self.new_actors.borrow_mut(), vec!());
+ for actor in new_actors.into_iter() {
self.actors.insert(actor.name().to_string(), actor);
}
- new_actors.clear();
}
}
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index 71fd82f5369..d7305ebdc90 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -22,10 +22,9 @@ extern crate collections;
extern crate core;
extern crate devtools_traits;
extern crate debug;
-extern crate std;
extern crate serialize;
extern crate sync;
-extern crate servo_msg = "msg";
+extern crate "msg" as servo_msg;
use actor::{Actor, ActorRegistry};
use actors::console::ConsoleActor;
@@ -181,8 +180,8 @@ fn run_server(port: Receiver<DevtoolsControlMsg>) {
//TODO: make constellation send ServerExitMsg on shutdown.
// accept connections and process them, spawning a new tasks for each one
- for stream in acceptor.incoming() {
- match stream {
+ loop {
+ match acceptor.accept() {
Err(ref e) if e.kind == TimedOut => {
match port.try_recv() {
Ok(ServerExitMsg) | Err(Disconnected) => break,