➖ Sustituye parking_lot por std::sync
PageTop ya no lo necesita como dependencia directa: `std::sync` cubre los bloqueos del contexto, los temas y las trazas. No se detecta pérdida de rendimiento en ningún caso. Usa `unwrap()` en los bloqueos, también en las extensiones, porque sus secciones exclusivas no pueden provocar panic. Sólo pagetop-cron ignora el envenenamiento, porque calcula fechas con el bloqueo tomado.
This commit is contained in:
parent
a6d15ab211
commit
698b917fb1
11 changed files with 31 additions and 56 deletions
|
|
@ -2,10 +2,8 @@ use crate::core::component::{Child, ChildOp, Children, Component};
|
|||
use crate::core::theme::{CoreRegions, RegionRef, ThemeRef};
|
||||
use crate::{AutoDefault, UniqueId, builder_impl};
|
||||
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
use std::sync::{Arc, LazyLock, RwLock};
|
||||
|
||||
// Lista de prototipos de componentes por nombre de región.
|
||||
//
|
||||
|
|
@ -90,7 +88,7 @@ impl ChildrenInRegions {
|
|||
let region_name = region.name();
|
||||
|
||||
// 1. Prototipos globales comunes.
|
||||
if let Some(global_protos) = COMMON_REGIONS.read().get(region_name) {
|
||||
if let Some(global_protos) = COMMON_REGIONS.read().unwrap().get(region_name) {
|
||||
result.add_many(
|
||||
global_protos
|
||||
.iter()
|
||||
|
|
@ -102,7 +100,7 @@ impl ChildrenInRegions {
|
|||
result.add_many(page_children);
|
||||
}
|
||||
// 3. Prototipos del tema activo.
|
||||
if let Some(theme_region) = THEME_REGIONS.read().get(&theme.type_id())
|
||||
if let Some(theme_region) = THEME_REGIONS.read().unwrap().get(&theme.type_id())
|
||||
&& let Some(theme_protos) = theme_region.get(region_name)
|
||||
{
|
||||
result.add_many(
|
||||
|
|
@ -190,6 +188,7 @@ impl InRegion {
|
|||
InRegion::ForTheme(theme, region) => {
|
||||
THEME_REGIONS
|
||||
.write()
|
||||
.unwrap()
|
||||
.entry(theme.type_id())
|
||||
.or_default()
|
||||
.push((*region).name(), proto);
|
||||
|
|
@ -200,6 +199,6 @@ impl InRegion {
|
|||
|
||||
#[inline]
|
||||
fn add_to_common(region: RegionRef, proto: Arc<dyn Component>) {
|
||||
COMMON_REGIONS.write().push(region.name(), proto);
|
||||
COMMON_REGIONS.write().unwrap().push(region.name(), proto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue