implement clone for embedder and compositor proxies

This commit is contained in:
Gregory Terzian 2017-08-27 03:47:31 +08:00
parent 01c24e017d
commit 6bca3402a6
4 changed files with 14 additions and 8 deletions

View file

@ -27,7 +27,7 @@ impl GLContextFactory {
if cfg!(target_os = "windows") {
// Used to dispatch functions from the GLContext thread to the main thread's event loop.
// Required to allow WGL GLContext sharing in Windows.
GLContextFactory::Native(handle, Some(MainThreadDispatcher::new(proxy.clone_compositor_proxy())))
GLContextFactory::Native(handle, Some(MainThreadDispatcher::new(proxy.clone())))
} else {
GLContextFactory::Native(handle, None)
}

View file

@ -43,7 +43,10 @@ impl EmbedderProxy {
}
self.event_loop_waker.wake();
}
pub fn clone_embedder_proxy(&self) -> EmbedderProxy {
}
impl Clone for EmbedderProxy {
fn clone(&self) -> EmbedderProxy {
EmbedderProxy {
sender: self.sender.clone(),
event_loop_waker: self.event_loop_waker.clone(),
@ -79,7 +82,10 @@ impl CompositorProxy {
}
self.event_loop_waker.wake();
}
pub fn clone_compositor_proxy(&self) -> CompositorProxy {
}
impl Clone for CompositorProxy {
fn clone(&self) -> CompositorProxy {
CompositorProxy {
sender: self.sender.clone(),
event_loop_waker: self.event_loop_waker.clone(),

View file

@ -699,7 +699,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
},
layout_to_constellation_chan: self.layout_sender.clone(),
scheduler_chan: self.scheduler_chan.clone(),
compositor_proxy: self.compositor_proxy.clone_compositor_proxy(),
compositor_proxy: self.compositor_proxy.clone(),
devtools_chan: self.devtools_chan.clone(),
bluetooth_thread: self.bluetooth_thread.clone(),
swmanager_thread: self.swmanager_sender.clone(),
@ -1694,7 +1694,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
Some((parent_pipeline_id, frame_type)),
script_sender,
layout_sender,
self.compositor_proxy.clone_compositor_proxy(),
self.compositor_proxy.clone(),
is_private || parent_pipeline.is_private,
url.clone(),
parent_pipeline.visible)
@ -1998,7 +1998,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
},
None => {
let event = EmbedderMsg::KeyEvent(None, ch, key, state, mods);
self.embedder_proxy.clone_embedder_proxy().send(event);
self.embedder_proxy.clone().send(event);
}
}
}

View file

@ -213,8 +213,8 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
// as the navigation context.
let (constellation_chan, sw_senders) = create_constellation(opts.user_agent.clone(),
opts.config_dir.clone(),
embedder_proxy.clone_embedder_proxy(),
compositor_proxy.clone_compositor_proxy(),
embedder_proxy.clone(),
compositor_proxy.clone(),
time_profiler_chan.clone(),
mem_profiler_chan.clone(),
debugger_chan,