diff options
author | Mukilan Thiyagarajan <mukilan@igalia.com> | 2024-05-20 16:05:18 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 10:35:18 +0000 |
commit | 2af6fe0b30a275e5fd8a43eca4126d82639fbaa9 (patch) | |
tree | 2687a12c392b30cba7cdcd849133d0d382b79cbe /components/shared/net/lib.rs | |
parent | c2076580f352f3c61f90969e03d78ada609935eb (diff) | |
download | servo-2af6fe0b30a275e5fd8a43eca4126d82639fbaa9.tar.gz servo-2af6fe0b30a275e5fd8a43eca4126d82639fbaa9.zip |
compositor: Move WebRender-ish messages and types to `webrender_traits` (#32315)
* Move WebRender related types to `webrender_traits`
This refactor moves several WebRender related types
from `compositing_traits`, `script_traits` and `net_traits`
crates to the `webrender_traits` crate.
This change also moves the `Image` type and associated
function out of `net_traits` and into the `pixels` crate.
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Move `script_traits::WebrenderIpcSender` to `webrender_traits::WebRenderScriptApi`
---------
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/net/lib.rs')
-rw-r--r-- | components/shared/net/lib.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/components/shared/net/lib.rs b/components/shared/net/lib.rs index 436ccf5d645..595d47c7b06 100644 --- a/components/shared/net/lib.rs +++ b/components/shared/net/lib.rs @@ -16,7 +16,6 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use ipc_channel::Error as IpcError; use lazy_static::lazy_static; -use log::warn; use malloc_size_of::malloc_size_of_is_0; use malloc_size_of_derive::MallocSizeOf; use mime::Mime; @@ -25,7 +24,6 @@ use rustls::Certificate; use serde::{Deserialize, Serialize}; use servo_rand::RngCore; use servo_url::{ImmutableOrigin, ServoUrl}; -use webrender_api::{ImageData, ImageDescriptor, ImageKey}; use crate::filemanager_thread::FileManagerThreadMsg; use crate::request::{Request, RequestBuilder}; @@ -41,15 +39,6 @@ pub mod request; pub mod response; pub mod storage_thread; -/// Image handling. -/// -/// It may be surprising that this goes in the network crate as opposed to the graphics crate. -/// However, image handling is generally very integrated with the network stack (especially where -/// caching is involved) and as a result it must live in here. -pub mod image { - pub mod base; -} - /// An implementation of the [Fetch specification](https://fetch.spec.whatwg.org/) pub mod fetch { pub mod headers; @@ -829,38 +818,6 @@ pub fn http_percent_encode(bytes: &[u8]) -> String { percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string() } -#[derive(Deserialize, Serialize)] -pub enum NetToCompositorMsg { - AddImage(ImageKey, ImageDescriptor, ImageData), - GenerateImageKey(IpcSender<ImageKey>), -} - -#[derive(Clone, Deserialize, Serialize)] -pub struct WebrenderIpcSender(IpcSender<NetToCompositorMsg>); - -impl WebrenderIpcSender { - pub fn new(sender: IpcSender<NetToCompositorMsg>) -> Self { - Self(sender) - } - - pub fn generate_image_key(&self) -> ImageKey { - let (sender, receiver) = ipc::channel().unwrap(); - self.0 - .send(NetToCompositorMsg::GenerateImageKey(sender)) - .expect("error sending image key generation"); - receiver.recv().expect("error receiving image key result") - } - - pub fn add_image(&self, key: ImageKey, descriptor: ImageDescriptor, data: ImageData) { - if let Err(e) = self - .0 - .send(NetToCompositorMsg::AddImage(key, descriptor, data)) - { - warn!("Error sending image update: {}", e); - } - } -} - lazy_static! { pub static ref PRIVILEGED_SECRET: u32 = servo_rand::ServoRng::default().next_u32(); } |