Avoid a clone in ScriptThread::new

This commit is contained in:
Anthony Ramine 2017-09-13 09:50:06 +02:00
parent 65dfd6bf63
commit fe29037e89

View file

@ -843,7 +843,7 @@ impl ScriptThread {
// Ask the router to proxy IPC messages from the control port to us. // Ask the router to proxy IPC messages from the control port to us.
let control_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(state.control_port); let control_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(state.control_port);
let boxed_script_sender = MainThreadScriptChan(chan.clone()).clone(); let boxed_script_sender = box MainThreadScriptChan(chan.clone());
let (image_cache_channel, image_cache_port) = channel(); let (image_cache_channel, image_cache_port) = channel();
@ -2038,7 +2038,8 @@ impl ScriptThread {
}; };
// Create the window and document objects. // Create the window and document objects.
let window = Window::new(self.js_runtime.clone(), let window = Window::new(
self.js_runtime.clone(),
MainThreadScriptChan(sender.clone()), MainThreadScriptChan(sender.clone()),
DOMManipulationTaskSource(dom_sender.clone()), DOMManipulationTaskSource(dom_sender.clone()),
UserInteractionTaskSource(user_sender.clone()), UserInteractionTaskSource(user_sender.clone()),
@ -2065,7 +2066,8 @@ impl ScriptThread {
incomplete.navigation_start, incomplete.navigation_start,
incomplete.navigation_start_precise, incomplete.navigation_start_precise,
self.webgl_chan.channel(), self.webgl_chan.channel(),
self.webvr_chan.clone()); self.webvr_chan.clone(),
);
// Initialize the browsing context for the window. // Initialize the browsing context for the window.
let window_proxy = self.local_window_proxy(&window, let window_proxy = self.local_window_proxy(&window,