mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #14013 - asajeffrey:script-thread-no-root-document, r=jdm
Script thread with no root document <!-- Please describe your changes on the following line: --> This PR removes the single root document from the script thread, and replaces it by a lookup table from `PipelineId`s to `Document`s. This is needed if we're going to share script threads, as per #633. The last commit is the one that matters, the ones before are #13646. cc @jdm @Ms2ger @ConnorGBrewster --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14013) <!-- Reviewable:end -->
This commit is contained in:
commit
d1b7f19410
8 changed files with 494 additions and 668 deletions
|
@ -1636,12 +1636,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
pipeline_id: PipelineId,
|
||||
event: MozBrowserEvent) {
|
||||
assert!(PREFS.is_mozbrowser_enabled());
|
||||
let frame_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
|
||||
|
||||
// Find the script channel for the given parent pipeline,
|
||||
// and pass the event to that script thread.
|
||||
// If the pipeline lookup fails, it is because we have torn down the pipeline,
|
||||
// so it is reasonable to silently ignore the event.
|
||||
let frame_id = self.pipelines.get(&pipeline_id).map(|pipeline| pipeline.frame_id);
|
||||
match self.pipelines.get(&parent_pipeline_id) {
|
||||
Some(pipeline) => pipeline.trigger_mozbrowser_event(frame_id, event),
|
||||
None => warn!("Pipeline {:?} handling mozbrowser event after closure.", parent_pipeline_id),
|
||||
|
@ -2219,6 +2219,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
// Close a frame (and all children)
|
||||
fn close_frame(&mut self, frame_id: FrameId, exit_mode: ExitPipelineMode) {
|
||||
debug!("Closing frame {:?}.", frame_id);
|
||||
// Store information about the pipelines to be closed. Then close the
|
||||
// pipelines, before removing ourself from the frames hash map. This
|
||||
// ordering is vital - so that if close_pipeline() ends up closing
|
||||
|
@ -2254,10 +2255,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
};
|
||||
parent_pipeline.remove_child(frame_id);
|
||||
}
|
||||
debug!("Closed frame {:?}.", frame_id);
|
||||
}
|
||||
|
||||
// Close all pipelines at and beneath a given frame
|
||||
fn close_pipeline(&mut self, pipeline_id: PipelineId, exit_mode: ExitPipelineMode) {
|
||||
debug!("Closing pipeline {:?}.", pipeline_id);
|
||||
// Store information about the frames to be closed. Then close the
|
||||
// frames, before removing ourself from the pipelines hash map. This
|
||||
// ordering is vital - so that if close_frames() ends up closing
|
||||
|
@ -2297,6 +2300,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
ExitPipelineMode::Normal => pipeline.exit(),
|
||||
ExitPipelineMode::Force => pipeline.force_exit(),
|
||||
}
|
||||
debug!("Closed pipeline {:?}.", pipeline_id);
|
||||
}
|
||||
|
||||
// Randomly close a pipeline -if --random-pipeline-closure-probability is set
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue