mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Replace the lazy_static crate whth std::sync::LazyLock
in components/script (#33004)
* replace in str.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace navigator.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace htmlmetaelement.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace document.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace cssstyledeclaration.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace script_runtime.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace window_named_properties.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce dependency lazy_static Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce lazy in script_runtime.rs `Mutex::new()` is const contexts. I think that `JS_ENGINE` is need not lazy initialize. Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
parent
f38d1574bc
commit
a797969efe
9 changed files with 98 additions and 104 deletions
|
@ -11,6 +11,7 @@ use std::default::Default;
|
|||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
use std::slice::from_ref;
|
||||
use std::sync::LazyLock;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use base::id::BrowsingContextId;
|
||||
|
@ -28,7 +29,6 @@ use hyper_serde::Serde;
|
|||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::rust::{HandleObject, HandleValue};
|
||||
use keyboard_types::{Code, Key, KeyState};
|
||||
use lazy_static::lazy_static;
|
||||
use metrics::{
|
||||
InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory,
|
||||
ProgressiveWebMetric,
|
||||
|
@ -3219,17 +3219,15 @@ impl Document {
|
|||
anchors: Default::default(),
|
||||
applets: Default::default(),
|
||||
style_shared_lock: {
|
||||
lazy_static! {
|
||||
/// Per-process shared lock for author-origin stylesheets
|
||||
///
|
||||
/// FIXME: make it per-document or per-pipeline instead:
|
||||
/// <https://github.com/servo/servo/issues/16027>
|
||||
/// (Need to figure out what to do with the style attribute
|
||||
/// of elements adopted into another document.)
|
||||
static ref PER_PROCESS_AUTHOR_SHARED_LOCK: StyleSharedRwLock = {
|
||||
StyleSharedRwLock::new()
|
||||
};
|
||||
}
|
||||
/// Per-process shared lock for author-origin stylesheets
|
||||
///
|
||||
/// FIXME: make it per-document or per-pipeline instead:
|
||||
/// <https://github.com/servo/servo/issues/16027>
|
||||
/// (Need to figure out what to do with the style attribute
|
||||
/// of elements adopted into another document.)
|
||||
static PER_PROCESS_AUTHOR_SHARED_LOCK: LazyLock<StyleSharedRwLock> =
|
||||
LazyLock::new(|| StyleSharedRwLock::new());
|
||||
|
||||
PER_PROCESS_AUTHOR_SHARED_LOCK.clone()
|
||||
//StyleSharedRwLock::new()
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue