aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Terzian <gterzian@users.noreply.github.com>2017-08-27 03:47:31 +0800
committerGregory Terzian <gterzian@users.noreply.github.com>2017-08-28 18:39:31 +0800
commit6bca3402a61d5a06103909b35e358e6ec745b522 (patch)
tree866027c31f2742a0ba1c5077a307eae42a74e7ca
parent01c24e017d61d52e5d175962da0b7e805d35386d (diff)
downloadservo-6bca3402a61d5a06103909b35e358e6ec745b522.tar.gz
servo-6bca3402a61d5a06103909b35e358e6ec745b522.zip
implement clone for embedder and compositor proxies
-rw-r--r--components/canvas/gl_context.rs2
-rw-r--r--components/compositing/compositor_thread.rs10
-rw-r--r--components/constellation/constellation.rs6
-rw-r--r--components/servo/lib.rs4
4 files changed, 14 insertions, 8 deletions
diff --git a/components/canvas/gl_context.rs b/components/canvas/gl_context.rs
index 69a26c0e03c..ae7446e2eb5 100644
--- a/components/canvas/gl_context.rs
+++ b/components/canvas/gl_context.rs
@@ -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)
}
diff --git a/components/compositing/compositor_thread.rs b/components/compositing/compositor_thread.rs
index 0a3828c0faf..03a7b46c7c0 100644
--- a/components/compositing/compositor_thread.rs
+++ b/components/compositing/compositor_thread.rs
@@ -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(),
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index 9cecc148ed1..ae286fedd09 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -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);
}
}
}
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 8031d4ad877..cddc84707d0 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -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,