Replace remutex with parking_lot's ReentrantMutex (#31817)

Many things in Servo depend on `parking_lot`, so we can replace our
homegrown remutex with `parking_lot`'s version.

Fixes #12641.
This commit is contained in:
Martin Robinson 2024-03-22 09:16:39 +01:00 committed by GitHub
parent 8882507ad0
commit 34dd38b4cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 5 additions and 388 deletions

View file

@ -11,8 +11,8 @@ use compositing_traits::ConstellationMsg as FromCompositorMsg;
use crossbeam_channel::Sender;
use log::{Level, LevelFilter, Log, Metadata, Record};
use msg::constellation_msg::TopLevelBrowsingContextId;
use parking_lot::ReentrantMutex;
use script_traits::{LogEntry, ScriptMsg as FromScriptMsg, ScriptToConstellationChan};
use servo_remutex::ReentrantMutex;
/// The constellation uses logging to perform crash reporting.
/// The constellation receives all `warn!`, `error!` and `panic!` messages,
@ -55,10 +55,7 @@ impl Log for FromScriptLogger {
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 chan = self
.script_to_constellation_chan
.lock()
.unwrap_or_else(|err| err.into_inner());
let chan = self.script_to_constellation_chan.lock();
let _ = chan.send(msg);
}
}
@ -97,10 +94,7 @@ impl Log for FromCompositorLogger {
let top_level_id = TopLevelBrowsingContextId::installed();
let thread_name = thread::current().name().map(ToOwned::to_owned);
let msg = FromCompositorMsg::LogEntry(top_level_id, thread_name, entry);
let chan = self
.constellation_chan
.lock()
.unwrap_or_else(|err| err.into_inner());
let chan = self.constellation_chan.lock();
let _ = chan.send(msg);
}
}