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,34 +2038,36 @@ 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(
MainThreadScriptChan(sender.clone()), self.js_runtime.clone(),
DOMManipulationTaskSource(dom_sender.clone()), MainThreadScriptChan(sender.clone()),
UserInteractionTaskSource(user_sender.clone()), DOMManipulationTaskSource(dom_sender.clone()),
self.networking_task_source.clone(), UserInteractionTaskSource(user_sender.clone()),
HistoryTraversalTaskSource(history_sender.clone()), self.networking_task_source.clone(),
self.file_reading_task_source.clone(), HistoryTraversalTaskSource(history_sender.clone()),
self.performance_timeline_task_source.clone(), self.file_reading_task_source.clone(),
self.image_cache_channel.clone(), self.performance_timeline_task_source.clone(),
self.image_cache.clone(), self.image_cache_channel.clone(),
self.resource_threads.clone(), self.image_cache.clone(),
self.bluetooth_thread.clone(), self.resource_threads.clone(),
self.mem_profiler_chan.clone(), self.bluetooth_thread.clone(),
self.time_profiler_chan.clone(), self.mem_profiler_chan.clone(),
self.devtools_chan.clone(), self.time_profiler_chan.clone(),
script_to_constellation_chan, self.devtools_chan.clone(),
self.control_chan.clone(), script_to_constellation_chan,
self.scheduler_chan.clone(), self.control_chan.clone(),
ipc_timer_event_chan, self.scheduler_chan.clone(),
incomplete.layout_chan, ipc_timer_event_chan,
incomplete.pipeline_id, incomplete.layout_chan,
incomplete.parent_info, incomplete.pipeline_id,
incomplete.window_size, incomplete.parent_info,
origin, incomplete.window_size,
incomplete.navigation_start, origin,
incomplete.navigation_start_precise, incomplete.navigation_start,
self.webgl_chan.channel(), incomplete.navigation_start_precise,
self.webvr_chan.clone()); self.webgl_chan.channel(),
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,