Reformat Window::new

This commit is contained in:
Anthony Ramine 2017-09-13 09:49:30 +02:00
parent 72f0fda836
commit 0822a74f94

View file

@ -1789,13 +1789,14 @@ impl Window {
impl Window { impl Window {
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn new(runtime: Rc<Runtime>, pub fn new(
runtime: Rc<Runtime>,
script_chan: MainThreadScriptChan, script_chan: MainThreadScriptChan,
dom_task_source: DOMManipulationTaskSource, dom_manipulation_task_source: DOMManipulationTaskSource,
user_task_source: UserInteractionTaskSource, user_interaction_task_source: UserInteractionTaskSource,
network_task_source: NetworkingTaskSource, networking_task_source: NetworkingTaskSource,
history_task_source: HistoryTraversalTaskSource, history_traversal_task_source: HistoryTraversalTaskSource,
file_task_source: FileReadingTaskSource, file_reading_task_source: FileReadingTaskSource,
performance_timeline_task_source: PerformanceTimelineTaskSource, performance_timeline_task_source: PerformanceTimelineTaskSource,
image_cache_chan: Sender<ImageCacheMsg>, image_cache_chan: Sender<ImageCacheMsg>,
image_cache: Arc<ImageCache>, image_cache: Arc<ImageCache>,
@ -1809,28 +1810,27 @@ impl Window {
scheduler_chan: IpcSender<TimerSchedulerMsg>, scheduler_chan: IpcSender<TimerSchedulerMsg>,
timer_event_chan: IpcSender<TimerEvent>, timer_event_chan: IpcSender<TimerEvent>,
layout_chan: Sender<Msg>, layout_chan: Sender<Msg>,
id: PipelineId, pipelineid: PipelineId,
parent_info: Option<(PipelineId, FrameType)>, parent_info: Option<(PipelineId, FrameType)>,
window_size: Option<WindowSizeData>, window_size: Option<WindowSizeData>,
origin: MutableOrigin, origin: MutableOrigin,
navigation_start: u64, navigation_start: u64,
navigation_start_precise: f64, navigation_start_precise: f64,
webgl_chan: WebGLChan, webgl_chan: WebGLChan,
webvr_chan: Option<IpcSender<WebVRMsg>>) webvr_chan: Option<IpcSender<WebVRMsg>>,
-> Root<Window> { ) -> Root<Self> {
let layout_rpc: Box<LayoutRPC + Send> = { let layout_rpc: Box<LayoutRPC + Send> = {
let (rpc_send, rpc_recv) = channel(); let (rpc_send, rpc_recv) = channel();
layout_chan.send(Msg::GetRPC(rpc_send)).unwrap(); layout_chan.send(Msg::GetRPC(rpc_send)).unwrap();
rpc_recv.recv().unwrap() rpc_recv.recv().unwrap()
}; };
let error_reporter = CSSErrorReporter { let error_reporter = CSSErrorReporter {
pipelineid: id, pipelineid,
script_chan: Arc::new(Mutex::new(control_chan)), script_chan: Arc::new(Mutex::new(control_chan)),
}; };
let win = box Window { let win = box Self {
globalscope: globalscope: GlobalScope::new_inherited(
GlobalScope::new_inherited( pipelineid,
id,
devtools_chan, devtools_chan,
mem_profiler_chan, mem_profiler_chan,
time_profiler_chan, time_profiler_chan,
@ -1838,16 +1838,17 @@ impl Window {
scheduler_chan, scheduler_chan,
resource_threads, resource_threads,
timer_event_chan, timer_event_chan,
origin), origin,
script_chan: script_chan, ),
dom_manipulation_task_source: dom_task_source, script_chan,
user_interaction_task_source: user_task_source, dom_manipulation_task_source,
networking_task_source: network_task_source, user_interaction_task_source,
history_traversal_task_source: history_task_source, networking_task_source,
file_reading_task_source: file_task_source, history_traversal_task_source,
file_reading_task_source,
performance_timeline_task_source, performance_timeline_task_source,
image_cache_chan: image_cache_chan, image_cache_chan,
image_cache: image_cache.clone(), image_cache,
navigator: Default::default(), navigator: Default::default(),
history: Default::default(), history: Default::default(),
custom_element_registry: Default::default(), custom_element_registry: Default::default(),
@ -1860,34 +1861,33 @@ impl Window {
session_storage: Default::default(), session_storage: Default::default(),
local_storage: Default::default(), local_storage: Default::default(),
status: DOMRefCell::new(DOMString::new()), status: DOMRefCell::new(DOMString::new()),
parent_info: parent_info, parent_info,
dom_static: GlobalStaticData::new(), dom_static: GlobalStaticData::new(),
js_runtime: DOMRefCell::new(Some(runtime.clone())), js_runtime: DOMRefCell::new(Some(runtime.clone())),
bluetooth_thread: bluetooth_thread, bluetooth_thread,
bluetooth_extra_permission_data: BluetoothExtraPermissionData::new(), bluetooth_extra_permission_data: BluetoothExtraPermissionData::new(),
page_clip_rect: Cell::new(max_rect()), page_clip_rect: Cell::new(max_rect()),
resize_event: Cell::new(None), resize_event: Default::default(),
layout_chan: layout_chan, layout_chan,
layout_rpc: layout_rpc, layout_rpc,
window_size: Cell::new(window_size), window_size: Cell::new(window_size),
current_viewport: Cell::new(Rect::zero()), current_viewport: Cell::new(Rect::zero()),
suppress_reflow: Cell::new(true), suppress_reflow: Cell::new(true),
pending_reflow_count: Cell::new(0), pending_reflow_count: Default::default(),
current_state: Cell::new(WindowState::Alive), current_state: Cell::new(WindowState::Alive),
devtools_marker_sender: Default::default(),
devtools_marker_sender: DOMRefCell::new(None), devtools_markers: Default::default(),
devtools_markers: DOMRefCell::new(HashSet::new()), webdriver_script_chan: Default::default(),
webdriver_script_chan: DOMRefCell::new(None),
ignore_further_async_events: Default::default(), ignore_further_async_events: Default::default(),
error_reporter: error_reporter, error_reporter,
scroll_offsets: DOMRefCell::new(HashMap::new()), scroll_offsets: Default::default(),
media_query_lists: WeakMediaQueryListVec::new(), media_query_lists: WeakMediaQueryListVec::new(),
test_runner: Default::default(), test_runner: Default::default(),
webgl_chan: webgl_chan, webgl_chan,
webvr_chan: webvr_chan, webvr_chan,
permission_state_invocation_results: DOMRefCell::new(HashMap::new()), permission_state_invocation_results: Default::default(),
pending_layout_images: DOMRefCell::new(HashMap::new()), pending_layout_images: Default::default(),
unminified_js_dir: DOMRefCell::new(None), unminified_js_dir: Default::default(),
test_worklet: Default::default(), test_worklet: Default::default(),
paint_worklet: Default::default(), paint_worklet: Default::default(),
}; };