mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Clear the UA cache on shutdown.
MozReview-Commit-ID: KAGdhFb67hq Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
cb31e782aa
commit
5be81d04a7
2 changed files with 11 additions and 1 deletions
|
@ -131,6 +131,10 @@ impl UserAgentCascadeDataCache {
|
||||||
fn expire_unused(&mut self) {
|
fn expire_unused(&mut self) {
|
||||||
self.entries.retain(|e| !e.is_unique())
|
self.entries.retain(|e| !e.is_unique())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.entries.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrecomputedPseudoElementDeclarations =
|
type PrecomputedPseudoElementDeclarations =
|
||||||
|
@ -1502,6 +1506,11 @@ impl Stylist {
|
||||||
|
|
||||||
// We may measure other fields in the future if DMD says it's worth it.
|
// We may measure other fields in the future if DMD says it's worth it.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Shutdown the static data that this module stores.
|
||||||
|
pub fn shutdown() {
|
||||||
|
UA_CASCADE_DATA_CACHE.lock().unwrap().clear()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This struct holds data which users of Stylist may want to extract
|
/// This struct holds data which users of Stylist may want to extract
|
||||||
|
|
|
@ -130,7 +130,7 @@ use style::stylesheets::{StylesheetContents, SupportsRule};
|
||||||
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
|
use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
|
||||||
use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
|
use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
|
||||||
use style::stylesheets::supports_rule::parse_condition_or_declaration;
|
use style::stylesheets::supports_rule::parse_condition_or_declaration;
|
||||||
use style::stylist::RuleInclusion;
|
use style::stylist::{RuleInclusion, Stylist};
|
||||||
use style::thread_state;
|
use style::thread_state;
|
||||||
use style::timer::Timer;
|
use style::timer::Timer;
|
||||||
use style::traversal::DomTraversal;
|
use style::traversal::DomTraversal;
|
||||||
|
@ -186,6 +186,7 @@ pub extern "C" fn Servo_Shutdown() {
|
||||||
// The dummy url will be released after shutdown, so clear the
|
// The dummy url will be released after shutdown, so clear the
|
||||||
// reference to avoid use-after-free.
|
// reference to avoid use-after-free.
|
||||||
unsafe { DUMMY_URL_DATA = ptr::null_mut(); }
|
unsafe { DUMMY_URL_DATA = ptr::null_mut(); }
|
||||||
|
Stylist::shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn dummy_url_data() -> &'static RefPtr<URLExtraData> {
|
unsafe fn dummy_url_data() -> &'static RefPtr<URLExtraData> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue