mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Actor::handle_message should return an enum instad of a boolean #7110 r=jdm
This commit is contained in:
parent
f5e97ef1b5
commit
c7b48240b0
12 changed files with 83 additions and 76 deletions
|
@ -13,7 +13,7 @@ use std::thread::sleep_ms;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::mpsc::channel;
|
||||
|
||||
use actor::{Actor, ActorRegistry};
|
||||
use actor::{Actor, ActorRegistry, ActorMessageStatus};
|
||||
use actors::memory::{MemoryActor, TimelineMemoryReply};
|
||||
use actors::framerate::FramerateActor;
|
||||
use devtools_traits::DevtoolScriptControlMsg;
|
||||
|
@ -232,7 +232,7 @@ impl Actor for TimelineActor {
|
|||
registry: &ActorRegistry,
|
||||
msg_type: &str,
|
||||
msg: &json::Object,
|
||||
stream: &mut TcpStream) -> Result<bool, ()> {
|
||||
stream: &mut TcpStream) -> Result<ActorMessageStatus, ()> {
|
||||
Ok(match msg_type {
|
||||
"start" => {
|
||||
**self.is_recording.lock().as_mut().unwrap() = true;
|
||||
|
@ -275,7 +275,7 @@ impl Actor for TimelineActor {
|
|||
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
|
||||
};
|
||||
stream.write_json_packet(&msg);
|
||||
true
|
||||
ActorMessageStatus::Processed
|
||||
}
|
||||
|
||||
"stop" => {
|
||||
|
@ -297,7 +297,7 @@ impl Actor for TimelineActor {
|
|||
|
||||
**self.is_recording.lock().as_mut().unwrap() = false;
|
||||
self.stream.borrow_mut().take();
|
||||
true
|
||||
ActorMessageStatus::Processed
|
||||
}
|
||||
|
||||
"isRecording" => {
|
||||
|
@ -307,11 +307,11 @@ impl Actor for TimelineActor {
|
|||
};
|
||||
|
||||
stream.write_json_packet(&msg);
|
||||
true
|
||||
ActorMessageStatus::Processed
|
||||
}
|
||||
|
||||
_ => {
|
||||
false
|
||||
ActorMessageStatus::Ignored
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue