mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
compositor: Wait for both Script and the Constellation when shutting down Pipelines (#37505)
Previously, the Constellation would immediately ask the Compositor to shut down a pipeline, even before the ScriptThread finished shutting it down. This meant that the Compositor might remove a Pipeline and then re-add it if the ScriptThread sent a Pipeline-related message (such as a new display list) in the meantime. This change makes it so that the Compositor waits for both the Constellation and the ScriptThread to finish shutting down a Pipeline before removing its data. In addition, the Constellation no longer synchronously waits on the Compositor when shutting down Pipelines. This was important when the Compositor would talk to the ScriptThread directly, but isn't necessary any longer. Testing: This is very hard to test, because it depends on the creation and destruction of many iframes and the particular timing of of all the messaging between Servo bits. That said, this was tested manually by observing the completion of Speedometer 2.1. Fixes: #37458. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
1bd8f38810
commit
c0970ea655
8 changed files with 112 additions and 69 deletions
|
@ -28,6 +28,7 @@ pub mod viewport_description;
|
|||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use bitflags::bitflags;
|
||||
use display_list::CompositorDisplayListInfo;
|
||||
use embedder_traits::{CompositorHitTestResult, ScreenGeometry};
|
||||
use euclid::default::Size2D as UntypedSize2D;
|
||||
|
@ -96,12 +97,11 @@ pub enum CompositorMsg {
|
|||
/// the frame is ready. It contains a bool to indicate if it needs to composite and the
|
||||
/// `DocumentId` of the new frame.
|
||||
NewWebRenderFrameReady(DocumentId, bool),
|
||||
/// A pipeline was shut down.
|
||||
// This message acts as a synchronization point between the constellation,
|
||||
// when it shuts down a pipeline, to the compositor; when the compositor
|
||||
// sends a reply on the IpcSender, the constellation knows it's safe to
|
||||
// tear down the other threads associated with this pipeline.
|
||||
PipelineExited(WebViewId, PipelineId, IpcSender<()>),
|
||||
/// Script or the Constellation is notifying the renderer that a Pipeline has finished
|
||||
/// shutting down. The renderer will not discard the Pipeline until both report that
|
||||
/// they have fully shut it down, to avoid recreating it due to any subsequent
|
||||
/// messages.
|
||||
PipelineExited(WebViewId, PipelineId, PipelineExitSource),
|
||||
/// The load of a page has completed
|
||||
LoadComplete(WebViewId),
|
||||
/// WebDriver mouse button event
|
||||
|
@ -562,3 +562,15 @@ pub trait WebViewTrait {
|
|||
fn screen_geometry(&self) -> Option<ScreenGeometry>;
|
||||
fn set_animating(&self, new_value: bool);
|
||||
}
|
||||
|
||||
/// What entity is reporting that a `Pipeline` has exited. Only when all have
|
||||
/// done this will the renderer discard its details.
|
||||
#[derive(Clone, Copy, Default, Deserialize, PartialEq, Serialize)]
|
||||
pub struct PipelineExitSource(u8);
|
||||
|
||||
bitflags! {
|
||||
impl PipelineExitSource: u8 {
|
||||
const Script = 1 << 0;
|
||||
const Constellation = 1 << 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue