mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Hoist the LRU cache into its own crate to share it with selectors.
This commit is contained in:
parent
5afb1b7dd2
commit
8b6c5988b5
9 changed files with 30 additions and 3 deletions
9
Cargo.lock
generated
9
Cargo.lock
generated
|
@ -1704,6 +1704,13 @@ name = "log"
|
||||||
version = "0.3.8"
|
version = "0.3.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lru_cache"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lzw"
|
name = "lzw"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
|
@ -2712,6 +2719,7 @@ dependencies = [
|
||||||
"cssparser 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"lru_cache 0.0.1",
|
||||||
"malloc_size_of 0.0.1",
|
"malloc_size_of 0.0.1",
|
||||||
"malloc_size_of_derive 0.0.1",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3128,6 +3136,7 @@ dependencies = [
|
||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"lru_cache 0.0.1",
|
||||||
"malloc_size_of 0.0.1",
|
"malloc_size_of 0.0.1",
|
||||||
"malloc_size_of_derive 0.0.1",
|
"malloc_size_of_derive 0.0.1",
|
||||||
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
13
components/lru_cache/Cargo.toml
Normal file
13
components/lru_cache/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[package]
|
||||||
|
name = "lru_cache"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = ["The Servo Project Developers"]
|
||||||
|
license = "MPL-2.0"
|
||||||
|
publish = false # We should publish this at some point
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "lru_cache"
|
||||||
|
path = "lib.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
arrayvec = "0.3.20"
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
//! A simple LRU cache.
|
//! A simple LRU cache.
|
||||||
|
|
||||||
|
extern crate arrayvec;
|
||||||
|
|
||||||
use arrayvec::{Array, ArrayVec};
|
use arrayvec::{Array, ArrayVec};
|
||||||
|
|
||||||
/// A LRU cache using a statically-sized array for storage.
|
/// A LRU cache using a statically-sized array for storage.
|
|
@ -30,6 +30,7 @@ log = "0.3"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
malloc_size_of = { path = "../malloc_size_of" }
|
malloc_size_of = { path = "../malloc_size_of" }
|
||||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||||
|
lru_cache = { path = "../lru_cache" }
|
||||||
phf = "0.7.18"
|
phf = "0.7.18"
|
||||||
precomputed-hash = "0.1"
|
precomputed-hash = "0.1"
|
||||||
servo_arc = { path = "../servo_arc" }
|
servo_arc = { path = "../servo_arc" }
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
#[macro_use] extern crate matches;
|
#[macro_use] extern crate matches;
|
||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
|
extern crate lru_cache;
|
||||||
extern crate malloc_size_of;
|
extern crate malloc_size_of;
|
||||||
#[macro_use] extern crate malloc_size_of_derive;
|
#[macro_use] extern crate malloc_size_of_derive;
|
||||||
extern crate phf;
|
extern crate phf;
|
||||||
|
|
|
@ -48,6 +48,7 @@ itertools = "0.5"
|
||||||
itoa = "0.3"
|
itoa = "0.3"
|
||||||
html5ever = {version = "0.19", optional = true}
|
html5ever = {version = "0.19", optional = true}
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
|
lru_cache = { path = "../lru_cache" }
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
malloc_size_of = { path = "../malloc_size_of", optional=true }
|
malloc_size_of = { path = "../malloc_size_of", optional=true }
|
||||||
malloc_size_of_derive = { path = "../malloc_size_of_derive", optional=true }
|
malloc_size_of_derive = { path = "../malloc_size_of_derive", optional=true }
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
#[cfg(feature = "servo")] use animation::PropertyAnimation;
|
#[cfg(feature = "servo")] use animation::PropertyAnimation;
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use bloom::StyleBloom;
|
use bloom::StyleBloom;
|
||||||
use cache::{Entry, LRUCache};
|
|
||||||
use data::{EagerPseudoStyles, ElementData};
|
use data::{EagerPseudoStyles, ElementData};
|
||||||
use dom::{OpaqueNode, TNode, TElement, SendElement};
|
use dom::{OpaqueNode, TNode, TElement, SendElement};
|
||||||
use euclid::ScaleFactor;
|
use euclid::ScaleFactor;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use font_metrics::FontMetricsProvider;
|
use font_metrics::FontMetricsProvider;
|
||||||
|
use lru_cache::{Entry, LRUCache};
|
||||||
#[cfg(feature = "gecko")] use gecko_bindings::structs;
|
#[cfg(feature = "gecko")] use gecko_bindings::structs;
|
||||||
use parallel::{STACK_SAFETY_MARGIN_KB, STYLE_THREAD_STACK_SIZE_KB};
|
use parallel::{STACK_SAFETY_MARGIN_KB, STYLE_THREAD_STACK_SIZE_KB};
|
||||||
#[cfg(feature = "servo")] use parking_lot::RwLock;
|
#[cfg(feature = "servo")] use parking_lot::RwLock;
|
||||||
|
|
|
@ -59,6 +59,7 @@ extern crate itoa;
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
extern crate lru_cache;
|
||||||
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of;
|
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of;
|
||||||
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of_derive;
|
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of_derive;
|
||||||
#[allow(unused_extern_crates)]
|
#[allow(unused_extern_crates)]
|
||||||
|
@ -102,7 +103,6 @@ pub mod applicable_declarations;
|
||||||
#[cfg(feature = "servo")] pub mod attr;
|
#[cfg(feature = "servo")] pub mod attr;
|
||||||
pub mod bezier;
|
pub mod bezier;
|
||||||
pub mod bloom;
|
pub mod bloom;
|
||||||
pub mod cache;
|
|
||||||
pub mod context;
|
pub mod context;
|
||||||
pub mod counter_style;
|
pub mod counter_style;
|
||||||
pub mod custom_properties;
|
pub mod custom_properties;
|
||||||
|
|
|
@ -68,9 +68,9 @@ use Atom;
|
||||||
use applicable_declarations::ApplicableDeclarationBlock;
|
use applicable_declarations::ApplicableDeclarationBlock;
|
||||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||||
use bloom::StyleBloom;
|
use bloom::StyleBloom;
|
||||||
use cache::{LRUCache, Entry};
|
|
||||||
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
||||||
use dom::{TElement, SendElement};
|
use dom::{TElement, SendElement};
|
||||||
|
use lru_cache::{LRUCache, Entry};
|
||||||
use matching::MatchMethods;
|
use matching::MatchMethods;
|
||||||
use owning_ref::OwningHandle;
|
use owning_ref::OwningHandle;
|
||||||
use properties::ComputedValues;
|
use properties::ComputedValues;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue