mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Support for Separated Read Write
This commit is contained in:
parent
ad9aedac77
commit
75ffda9fb8
3 changed files with 18 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
/// Supports dynamic attaching and detaching which control notifications of navigation, etc.
|
||||
|
||||
use actor::{Actor, ActorRegistry};
|
||||
use actors::console::ConsoleActor;
|
||||
use protocol::JsonPacketStream;
|
||||
|
||||
use serialize::json;
|
||||
|
@ -74,7 +75,7 @@ impl Actor for TabActor {
|
|||
}
|
||||
|
||||
fn handle_message(&self,
|
||||
_registry: &ActorRegistry,
|
||||
registry: &ActorRegistry,
|
||||
msg_type: &String,
|
||||
_msg: &json::JsonObject,
|
||||
stream: &mut TcpStream) -> bool {
|
||||
|
@ -95,15 +96,21 @@ impl Actor for TabActor {
|
|||
javascriptEnabled: true,
|
||||
traits: TabTraits,
|
||||
};
|
||||
let console_actor = registry.find::<ConsoleActor>(self.console.as_slice());
|
||||
console_actor.streams.borrow_mut().push(stream.clone());
|
||||
stream.write_json_packet(&msg);
|
||||
true
|
||||
}
|
||||
|
||||
//FIXME: The current implementation won't work for multiple connections. Need to ensure 105
|
||||
// that the correct stream is removed.
|
||||
"detach" => {
|
||||
let msg = TabDetachedReply {
|
||||
from: self.name(),
|
||||
__type__: "detached".to_string(),
|
||||
};
|
||||
let console_actor = registry.find::<ConsoleActor>(self.console.as_slice());
|
||||
console_actor.streams.borrow_mut().pop();
|
||||
stream.write_json_packet(&msg);
|
||||
true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue