mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
script_traits: Rename ConstellationControlMsg
to ScriptThreadMessage
(#35226)
At some point in the past this message was only sent from the `Constellation` to `script`, but nowadays this is sent from various parts of servo to the `ScriptThread`, so this is a better name. In particular, the current name makes it seeem like this message controls the `Constellation`, which it does not. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
006ec58598
commit
ad07db0b0c
13 changed files with 183 additions and 200 deletions
|
@ -11,25 +11,23 @@ use std::rc::Rc;
|
|||
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use ipc_channel::Error;
|
||||
use script_traits::ConstellationControlMsg;
|
||||
use script_traits::ScriptThreadMessage;
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#event-loop>
|
||||
pub struct EventLoop {
|
||||
script_chan: IpcSender<ConstellationControlMsg>,
|
||||
script_chan: IpcSender<ScriptThreadMessage>,
|
||||
dont_send_or_sync: PhantomData<Rc<()>>,
|
||||
}
|
||||
|
||||
impl Drop for EventLoop {
|
||||
fn drop(&mut self) {
|
||||
let _ = self
|
||||
.script_chan
|
||||
.send(ConstellationControlMsg::ExitScriptThread);
|
||||
let _ = self.script_chan.send(ScriptThreadMessage::ExitScriptThread);
|
||||
}
|
||||
}
|
||||
|
||||
impl EventLoop {
|
||||
/// Create a new event loop from the channel to its script thread.
|
||||
pub fn new(script_chan: IpcSender<ConstellationControlMsg>) -> Rc<EventLoop> {
|
||||
pub fn new(script_chan: IpcSender<ScriptThreadMessage>) -> Rc<EventLoop> {
|
||||
Rc::new(EventLoop {
|
||||
script_chan,
|
||||
dont_send_or_sync: PhantomData,
|
||||
|
@ -37,12 +35,12 @@ impl EventLoop {
|
|||
}
|
||||
|
||||
/// Send a message to the event loop.
|
||||
pub fn send(&self, msg: ConstellationControlMsg) -> Result<(), Error> {
|
||||
pub fn send(&self, msg: ScriptThreadMessage) -> Result<(), Error> {
|
||||
self.script_chan.send(msg)
|
||||
}
|
||||
|
||||
/// The underlying channel to the script thread.
|
||||
pub fn sender(&self) -> IpcSender<ConstellationControlMsg> {
|
||||
pub fn sender(&self) -> IpcSender<ScriptThreadMessage> {
|
||||
self.script_chan.clone()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue