mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Remove Clone impl for WebGLMsg
This commit is contained in:
parent
1293692ef8
commit
e37856a855
3 changed files with 21 additions and 4 deletions
|
@ -24,7 +24,7 @@ pub use ::webgl_channel::WebGLPipeline;
|
||||||
pub use ::webgl_channel::WebGLChan;
|
pub use ::webgl_channel::WebGLChan;
|
||||||
|
|
||||||
/// WebGL Message API
|
/// WebGL Message API
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub enum WebGLMsg {
|
pub enum WebGLMsg {
|
||||||
/// Creates a new WebGLContext.
|
/// Creates a new WebGLContext.
|
||||||
CreateContext(WebGLVersion, Size2D<i32>, GLContextAttributes,
|
CreateContext(WebGLVersion, Size2D<i32>, GLContextAttributes,
|
||||||
|
@ -155,7 +155,7 @@ impl WebGLMsgSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// WebGL Commands for a specific WebGLContext
|
/// WebGL Commands for a specific WebGLContext
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum WebGLCommand {
|
pub enum WebGLCommand {
|
||||||
GetContextAttributes(WebGLSender<GLContextAttributes>),
|
GetContextAttributes(WebGLSender<GLContextAttributes>),
|
||||||
ActiveTexture(u32),
|
ActiveTexture(u32),
|
||||||
|
|
|
@ -16,12 +16,24 @@ lazy_static! {
|
||||||
static ref IS_MULTIPROCESS: bool = { opts::multiprocess() };
|
static ref IS_MULTIPROCESS: bool = { opts::multiprocess() };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub enum WebGLSender<T: Serialize> {
|
pub enum WebGLSender<T: Serialize> {
|
||||||
Ipc(ipc::WebGLSender<T>),
|
Ipc(ipc::WebGLSender<T>),
|
||||||
Mpsc(mpsc::WebGLSender<T>),
|
Mpsc(mpsc::WebGLSender<T>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> Clone for WebGLSender<T>
|
||||||
|
where
|
||||||
|
T: Serialize,
|
||||||
|
{
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
match *self {
|
||||||
|
WebGLSender::Ipc(ref chan) => WebGLSender::Ipc(chan.clone()),
|
||||||
|
WebGLSender::Mpsc(ref chan) => WebGLSender::Mpsc(chan.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Serialize> fmt::Debug for WebGLSender<T> {
|
impl<T: Serialize> fmt::Debug for WebGLSender<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "WebGLSender(..)")
|
write!(f, "WebGLSender(..)")
|
||||||
|
|
|
@ -26,10 +26,15 @@ macro_rules! unreachable_serializable {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct WebGLSender<T>(mpsc::Sender<T>);
|
pub struct WebGLSender<T>(mpsc::Sender<T>);
|
||||||
pub struct WebGLReceiver<T>(mpsc::Receiver<T>);
|
pub struct WebGLReceiver<T>(mpsc::Receiver<T>);
|
||||||
|
|
||||||
|
impl<T> Clone for WebGLSender<T> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
WebGLSender(self.0.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T> WebGLSender<T> {
|
impl<T> WebGLSender<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn send(&self, data: T) -> Result<(), mpsc::SendError<T>> {
|
pub fn send(&self, data: T) -> Result<(), mpsc::SendError<T>> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue