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

@ -23,7 +23,6 @@ fonts_traits = { workspace = true }
histogram = "0.6.8"
ipc-channel = { workspace = true }
layout = { path = "../layout", package = "layout_2013" }
lazy_static = { workspace = true }
log = { workspace = true }
malloc_size_of = { workspace = true }
metrics = { path = "../metrics" }

View file

@ -12,7 +12,7 @@ use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
use std::ops::{Deref, DerefMut};
use std::process;
use std::sync::{Arc, Mutex};
use std::sync::{Arc, LazyLock, Mutex};
use app_units::Au;
use base::id::{BrowsingContextId, PipelineId};
@ -48,7 +48,6 @@ use layout::traversal::{
};
use layout::wrapper::ThreadSafeLayoutNodeHelpers;
use layout::{layout_debug, layout_debug_scope, parallel, sequential};
use lazy_static::lazy_static;
use log::{debug, error, trace, warn};
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
@ -1557,17 +1556,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>,