Replace lazy_static crate with std::sync::LazyLock in layout and config (#33065)

* replace in layout_thread_2020

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in layout_thread

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in layout

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in config

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace in config_plugins

The macro of config_plugins require Send trait bounds

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
Hayashi Mikihiro 2024-08-16 01:28:04 +09:00 committed by GitHub
parent c01b733523
commit 016ff5dfa6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 43 additions and 65 deletions

View file

@ -13,7 +13,7 @@ use std::collections::HashMap;
use std::fmt::Debug;
use std::ops::{Deref, DerefMut};
use std::process;
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use app_units::Au;
use base::id::{BrowsingContextId, PipelineId};
@ -35,7 +35,6 @@ use layout::query::{
};
use layout::traversal::RecalcStyle;
use layout::{layout_debug, BoxTree, FragmentTree};
use lazy_static::lazy_static;
use log::{debug, error, warn};
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
@ -1151,17 +1150,14 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
})
}
lazy_static! {
static ref UA_STYLESHEETS: UserAgentStylesheets = {
match get_ua_stylesheets() {
Ok(stylesheets) => stylesheets,
Err(filename) => {
error!("Failed to load UA stylesheet {}!", filename);
process::exit(1);
},
}
};
}
static UA_STYLESHEETS: LazyLock<UserAgentStylesheets> =
LazyLock::new(|| match get_ua_stylesheets() {
Ok(stylesheets) => stylesheets,
Err(filename) => {
error!("Failed to load UA stylesheet {}!", filename);
process::exit(1);
},
});
struct RegisteredPainterImpl {
painter: Box<dyn Painter>,