mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
script: Add an implementation of Default
for Documents
(#32048)
This commit is contained in:
parent
df4c56efa4
commit
f70413baba
1 changed files with 10 additions and 7 deletions
|
@ -437,12 +437,6 @@ pub struct Documents {
|
|||
}
|
||||
|
||||
impl Documents {
|
||||
pub fn new() -> Documents {
|
||||
Documents {
|
||||
map: HashMapTracedValues::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, pipeline_id: PipelineId, doc: &Document) {
|
||||
self.map.insert(pipeline_id, Dom::from_ref(doc));
|
||||
}
|
||||
|
@ -485,6 +479,15 @@ impl Documents {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Documents {
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
map: HashMapTracedValues::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub struct DocumentsIter<'a> {
|
||||
iter: hash_map::Iter<'a, PipelineId, Dom<Document>>,
|
||||
|
@ -1340,7 +1343,7 @@ impl ScriptThread {
|
|||
let control_port = ROUTER.route_ipc_receiver_to_new_crossbeam_receiver(state.control_port);
|
||||
|
||||
ScriptThread {
|
||||
documents: DomRefCell::new(Documents::new()),
|
||||
documents: DomRefCell::new(Documents::default()),
|
||||
window_proxies: DomRefCell::new(HashMapTracedValues::new()),
|
||||
incomplete_loads: DomRefCell::new(vec![]),
|
||||
incomplete_parser_contexts: IncompleteParserContexts(RefCell::new(vec![])),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue