mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
script: Reduce ScriptThread TLS usage (#38875)
We store a pointer to the ScriptThread singleton for a thread in thread-local storage. While we don't have yet have profiles pointing to this TLS access as a hot spot, we can remove a potential performance footgun without a lot of effort by passing around small pieces of data that we otherwise need to fetch from the ScriptThread. Testing: Existing WPT is sufficient Fixes: part of #37969 --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
d1da1a995c
commit
c97ec1b2fb
17 changed files with 129 additions and 68 deletions
|
@ -2,6 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use data_url::mime::Mime;
|
||||
use dom_struct::dom_struct;
|
||||
use net_traits::request::InsecureRequestsPolicy;
|
||||
|
@ -17,6 +19,7 @@ use crate::dom::bindings::inheritance::Castable;
|
|||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::customelementregistry::CustomElementReactionStack;
|
||||
use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
|
||||
use crate::dom::location::Location;
|
||||
use crate::dom::node::Node;
|
||||
|
@ -44,6 +47,7 @@ impl XMLDocument {
|
|||
doc_loader: DocumentLoader,
|
||||
inherited_insecure_requests_policy: Option<InsecureRequestsPolicy>,
|
||||
has_trustworthy_ancestor_origin: bool,
|
||||
custom_element_reaction_stack: Rc<CustomElementReactionStack>,
|
||||
) -> XMLDocument {
|
||||
XMLDocument {
|
||||
document: Document::new_inherited(
|
||||
|
@ -64,6 +68,7 @@ impl XMLDocument {
|
|||
false,
|
||||
inherited_insecure_requests_policy,
|
||||
has_trustworthy_ancestor_origin,
|
||||
custom_element_reaction_stack,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +87,7 @@ impl XMLDocument {
|
|||
doc_loader: DocumentLoader,
|
||||
inherited_insecure_requests_policy: Option<InsecureRequestsPolicy>,
|
||||
has_trustworthy_ancestor_origin: bool,
|
||||
custom_element_reaction_stack: Rc<CustomElementReactionStack>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<XMLDocument> {
|
||||
let doc = reflect_dom_object(
|
||||
|
@ -98,6 +104,7 @@ impl XMLDocument {
|
|||
doc_loader,
|
||||
inherited_insecure_requests_policy,
|
||||
has_trustworthy_ancestor_origin,
|
||||
custom_element_reaction_stack,
|
||||
)),
|
||||
window,
|
||||
can_gc,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue