mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Implement a dummy canCurrentlyRecord method in performance actor
This commit is contained in:
parent
14653e2875
commit
50bca7319b
1 changed files with 39 additions and 1 deletions
|
@ -32,6 +32,21 @@ struct ConnectReply {
|
||||||
traits: PerformanceTraits,
|
traits: PerformanceTraits,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct CanCurrentlyRecordReply {
|
||||||
|
from: String,
|
||||||
|
value: SuccessMsg,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct SuccessMsg {
|
||||||
|
success: bool,
|
||||||
|
errors: Vec<Error>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
enum Error {}
|
||||||
|
|
||||||
impl Actor for PerformanceActor {
|
impl Actor for PerformanceActor {
|
||||||
fn name(&self) -> String {
|
fn name(&self) -> String {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
|
@ -59,6 +74,17 @@ impl Actor for PerformanceActor {
|
||||||
stream.write_json_packet(&msg);
|
stream.write_json_packet(&msg);
|
||||||
ActorMessageStatus::Processed
|
ActorMessageStatus::Processed
|
||||||
},
|
},
|
||||||
|
"canCurrentlyRecord" => {
|
||||||
|
let msg = CanCurrentlyRecordReply {
|
||||||
|
from: self.name(),
|
||||||
|
value: SuccessMsg {
|
||||||
|
success: true,
|
||||||
|
errors: vec![],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
stream.write_json_packet(&msg);
|
||||||
|
ActorMessageStatus::Processed
|
||||||
|
}
|
||||||
_ => ActorMessageStatus::Ignored,
|
_ => ActorMessageStatus::Ignored,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -75,7 +101,19 @@ impl PerformanceActor {
|
||||||
ActorDescription {
|
ActorDescription {
|
||||||
category: "actor",
|
category: "actor",
|
||||||
typeName: "performance",
|
typeName: "performance",
|
||||||
methods: vec![],
|
methods: vec![
|
||||||
|
Method {
|
||||||
|
name: "canCurrentlyRecord",
|
||||||
|
request: Value::Object(vec![
|
||||||
|
("type".to_owned(), Value::String("canCurrentlyRecord".to_owned())),
|
||||||
|
].into_iter().collect()),
|
||||||
|
response: Value::Object(vec![
|
||||||
|
("value".to_owned(), Value::Object(vec![
|
||||||
|
("_retval".to_owned(), Value::String("json".to_owned())),
|
||||||
|
].into_iter().collect())),
|
||||||
|
].into_iter().collect()),
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue