mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
compositor: Hide IpcSender as implementation detail (#38963)
The `CrossProcessCompositorApi` already provides methods for most messages. Remove the `sender()` method, and hide the IpcSender as an implementation detail. This is a preparation for abstracting over the internal IpcSender. Testing: No functional changes --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
5909eb7684
commit
33e934421e
4 changed files with 29 additions and 22 deletions
|
@ -174,9 +174,14 @@ pub struct CompositionPipeline {
|
|||
|
||||
/// A mechanism to send messages from ScriptThread to the parent process' WebRender instance.
|
||||
#[derive(Clone, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct CrossProcessCompositorApi(pub IpcSender<CompositorMsg>);
|
||||
pub struct CrossProcessCompositorApi(IpcSender<CompositorMsg>);
|
||||
|
||||
impl CrossProcessCompositorApi {
|
||||
/// Create a new [`CrossProcessCompositorApi`] struct.
|
||||
pub fn new(sender: IpcSender<CompositorMsg>) -> Self {
|
||||
CrossProcessCompositorApi(sender)
|
||||
}
|
||||
|
||||
/// Create a new [`CrossProcessCompositorApi`] struct that does not have a listener on the other
|
||||
/// end to use for unit testing.
|
||||
pub fn dummy() -> Self {
|
||||
|
@ -184,11 +189,6 @@ impl CrossProcessCompositorApi {
|
|||
Self(sender)
|
||||
}
|
||||
|
||||
/// Get the sender for this proxy.
|
||||
pub fn sender(&self) -> &IpcSender<CompositorMsg> {
|
||||
&self.0
|
||||
}
|
||||
|
||||
/// Inform WebRender of the existence of this pipeline.
|
||||
pub fn send_initial_transaction(&self, pipeline: WebRenderPipelineId) {
|
||||
if let Err(e) = self.0.send(CompositorMsg::SendInitialTransaction(pipeline)) {
|
||||
|
@ -352,6 +352,25 @@ impl CrossProcessCompositorApi {
|
|||
));
|
||||
receiver.recv().unwrap()
|
||||
}
|
||||
|
||||
pub fn viewport(&self, webview_id: WebViewId, description: ViewportDescription) {
|
||||
let _ = self
|
||||
.0
|
||||
.send(CompositorMsg::Viewport(webview_id, description));
|
||||
}
|
||||
|
||||
pub fn pipeline_exited(
|
||||
&self,
|
||||
webview_id: WebViewId,
|
||||
pipeline_id: PipelineId,
|
||||
source: PipelineExitSource,
|
||||
) {
|
||||
let _ = self.0.send(CompositorMsg::PipelineExited(
|
||||
webview_id,
|
||||
pipeline_id,
|
||||
source,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// This trait is used as a bridge between the different GL clients
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue