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

@ -10,12 +10,11 @@ use std::fs::{self, File};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{RwLock, RwLockReadGuard};
use std::sync::{LazyLock, RwLock, RwLockReadGuard};
use std::{env, process};
use euclid::Size2D;
use getopts::{Matches, Options};
use lazy_static::lazy_static;
use log::error;
use serde::{Deserialize, Serialize};
use servo_geometry::DeviceIndependentPixel;
@ -789,9 +788,7 @@ pub enum ArgumentParsingResult {
// Make Opts available globally. This saves having to clone and pass
// opts everywhere it is used, which gets particularly cumbersome
// when passing through the DOM structures.
lazy_static! {
static ref OPTIONS: RwLock<Opts> = RwLock::new(default_opts());
}
static OPTIONS: LazyLock<RwLock<Opts>> = LazyLock::new(|| RwLock::new(default_opts()));
pub fn set_options(opts: Opts) {
MULTIPROCESS.store(opts.multiprocess, Ordering::SeqCst);