mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
constellation: Rename messages sent to the Constellation
(#36341)
Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
c7a7862574
commit
5a35e1faec
37 changed files with 415 additions and 364 deletions
|
@ -12,11 +12,11 @@ use std::thread;
|
|||
|
||||
use backtrace::Backtrace;
|
||||
use base::id::WebViewId;
|
||||
use constellation_traits::{ConstellationMsg as FromCompositorMsg, LogEntry};
|
||||
use constellation_traits::{EmbedderToConstellationMessage, LogEntry};
|
||||
use crossbeam_channel::Sender;
|
||||
use log::{Level, LevelFilter, Log, Metadata, Record};
|
||||
use parking_lot::ReentrantMutex;
|
||||
use script_traits::{ScriptMsg as FromScriptMsg, ScriptToConstellationChan};
|
||||
use script_traits::{ScriptToConstellationChan, ScriptToConstellationMessage};
|
||||
|
||||
/// A logger directed at the constellation from content processes
|
||||
/// #[derive(Clone)]
|
||||
|
@ -50,7 +50,7 @@ impl Log for FromScriptLogger {
|
|||
fn log(&self, record: &Record) {
|
||||
if let Some(entry) = log_entry(record) {
|
||||
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
||||
let msg = FromScriptMsg::LogEntry(thread_name, entry);
|
||||
let msg = ScriptToConstellationMessage::LogEntry(thread_name, entry);
|
||||
let chan = self.script_to_constellation_chan.lock();
|
||||
let _ = chan.send(msg);
|
||||
}
|
||||
|
@ -61,15 +61,15 @@ impl Log for FromScriptLogger {
|
|||
|
||||
/// A logger directed at the constellation from the compositor
|
||||
#[derive(Clone)]
|
||||
pub struct FromCompositorLogger {
|
||||
pub struct FromEmbedderLogger {
|
||||
/// A channel to the constellation
|
||||
pub constellation_chan: Arc<ReentrantMutex<Sender<FromCompositorMsg>>>,
|
||||
pub constellation_chan: Arc<ReentrantMutex<Sender<EmbedderToConstellationMessage>>>,
|
||||
}
|
||||
|
||||
impl FromCompositorLogger {
|
||||
impl FromEmbedderLogger {
|
||||
/// Create a new constellation logger.
|
||||
pub fn new(constellation_chan: Sender<FromCompositorMsg>) -> FromCompositorLogger {
|
||||
FromCompositorLogger {
|
||||
pub fn new(constellation_chan: Sender<EmbedderToConstellationMessage>) -> FromEmbedderLogger {
|
||||
FromEmbedderLogger {
|
||||
constellation_chan: Arc::new(ReentrantMutex::new(constellation_chan)),
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ impl FromCompositorLogger {
|
|||
}
|
||||
}
|
||||
|
||||
impl Log for FromCompositorLogger {
|
||||
impl Log for FromEmbedderLogger {
|
||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||
metadata.level() <= Level::Warn
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ impl Log for FromCompositorLogger {
|
|||
if let Some(entry) = log_entry(record) {
|
||||
let top_level_id = WebViewId::installed();
|
||||
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
||||
let msg = FromCompositorMsg::LogEntry(top_level_id, thread_name, entry);
|
||||
let msg = EmbedderToConstellationMessage::LogEntry(top_level_id, thread_name, entry);
|
||||
let chan = self.constellation_chan.lock();
|
||||
let _ = chan.send(msg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue