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,65 +1789,66 @@ impl Window {
impl Window { impl Window {
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn new(runtime: Rc<Runtime>, pub fn new(
script_chan: MainThreadScriptChan, runtime: Rc<Runtime>,
dom_task_source: DOMManipulationTaskSource, script_chan: MainThreadScriptChan,
user_task_source: UserInteractionTaskSource, dom_manipulation_task_source: DOMManipulationTaskSource,
network_task_source: NetworkingTaskSource, user_interaction_task_source: UserInteractionTaskSource,
history_task_source: HistoryTraversalTaskSource, networking_task_source: NetworkingTaskSource,
file_task_source: FileReadingTaskSource, history_traversal_task_source: HistoryTraversalTaskSource,
performance_timeline_task_source: PerformanceTimelineTaskSource, file_reading_task_source: FileReadingTaskSource,
image_cache_chan: Sender<ImageCacheMsg>, performance_timeline_task_source: PerformanceTimelineTaskSource,
image_cache: Arc<ImageCache>, image_cache_chan: Sender<ImageCacheMsg>,
resource_threads: ResourceThreads, image_cache: Arc<ImageCache>,
bluetooth_thread: IpcSender<BluetoothRequest>, resource_threads: ResourceThreads,
mem_profiler_chan: MemProfilerChan, bluetooth_thread: IpcSender<BluetoothRequest>,
time_profiler_chan: TimeProfilerChan, mem_profiler_chan: MemProfilerChan,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>, time_profiler_chan: TimeProfilerChan,
constellation_chan: ScriptToConstellationChan, devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
control_chan: IpcSender<ConstellationControlMsg>, constellation_chan: ScriptToConstellationChan,
scheduler_chan: IpcSender<TimerSchedulerMsg>, control_chan: IpcSender<ConstellationControlMsg>,
timer_event_chan: IpcSender<TimerEvent>, scheduler_chan: IpcSender<TimerSchedulerMsg>,
layout_chan: Sender<Msg>, timer_event_chan: IpcSender<TimerEvent>,
id: PipelineId, layout_chan: Sender<Msg>,
parent_info: Option<(PipelineId, FrameType)>, pipelineid: PipelineId,
window_size: Option<WindowSizeData>, parent_info: Option<(PipelineId, FrameType)>,
origin: MutableOrigin, window_size: Option<WindowSizeData>,
navigation_start: u64, origin: MutableOrigin,
navigation_start_precise: f64, navigation_start: u64,
webgl_chan: WebGLChan, navigation_start_precise: f64,
webvr_chan: Option<IpcSender<WebVRMsg>>) webgl_chan: WebGLChan,
-> Root<Window> { webvr_chan: Option<IpcSender<WebVRMsg>>,
) -> 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, constellation_chan,
constellation_chan, scheduler_chan,
scheduler_chan, resource_threads,
resource_threads, timer_event_chan,
timer_event_chan, origin,
origin), ),
script_chan: script_chan, script_chan,
dom_manipulation_task_source: dom_task_source, dom_manipulation_task_source,
user_interaction_task_source: user_task_source, user_interaction_task_source,
networking_task_source: network_task_source, networking_task_source,
history_traversal_task_source: history_task_source, history_traversal_task_source,
file_reading_task_source: file_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(),
}; };