diff options
author | Ms2ger <Ms2ger@gmail.com> | 2016-05-25 09:23:57 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2016-05-27 15:33:04 +0200 |
commit | e94f3d4fe056a12d561fbdee7e0af26ba738389c (patch) | |
tree | 7a776c66cd0776977399a7019fee3e5f41d29fae /components/script/dom | |
parent | 2f9796fa696e9514280777398467696dd4f004b3 (diff) | |
download | servo-e94f3d4fe056a12d561fbdee7e0af26ba738389c.tar.gz servo-e94f3d4fe056a12d561fbdee7e0af26ba738389c.zip |
Remove the LayoutChan type.
It is a pointless abstraction.
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 3 | ||||
-rw-r--r-- | components/script/dom/document.rs | 5 | ||||
-rw-r--r-- | components/script/dom/htmllinkelement.rs | 5 | ||||
-rw-r--r-- | components/script/dom/htmlstyleelement.rs | 5 | ||||
-rw-r--r-- | components/script/dom/node.rs | 5 | ||||
-rw-r--r-- | components/script/dom/window.rs | 14 |
6 files changed, 15 insertions, 22 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 4a1c781a293..65bed8b0bf1 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -54,7 +54,7 @@ use js::glue::{CallObjectTracer, CallUnbarrieredObjectTracer, CallValueTracer}; use js::jsapi::{GCTraceKindToAscii, Heap, TraceKind, JSObject, JSTracer}; use js::jsval::JSVal; use js::rust::Runtime; -use layout_interface::{LayoutChan, LayoutRPC}; +use layout_interface::LayoutRPC; use libc; use msg::constellation_msg::{FrameType, PipelineId, SubpageId, WindowSizeData, WindowSizeType, ReferrerPolicy}; use net_traits::image::base::{Image, ImageMetadata}; @@ -296,7 +296,6 @@ no_jsmanaged_fields!(WorkerId); no_jsmanaged_fields!(QuirksMode); no_jsmanaged_fields!(Runtime); no_jsmanaged_fields!(Headers, Method); -no_jsmanaged_fields!(LayoutChan); no_jsmanaged_fields!(WindowProxyHandler); no_jsmanaged_fields!(UntrustedNodeAddress); no_jsmanaged_fields!(LengthOrPercentageOrAuto); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 00dec5d995f..2ceffe97b21 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -92,7 +92,7 @@ use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks, QuirksMode}; use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::JS_GetRuntime; use js::jsapi::{JSContext, JSObject, JSRuntime}; -use layout_interface::{LayoutChan, Msg, ReflowQueryType}; +use layout_interface::{Msg, ReflowQueryType}; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, ReferrerPolicy, SubpageId}; @@ -404,8 +404,7 @@ impl Document { self.quirks_mode.set(mode); if mode == Quirks { - let LayoutChan(ref layout_chan) = *self.window.layout_chan(); - layout_chan.send(Msg::SetQuirksMode).unwrap(); + self.window.layout_chan().send(Msg::SetQuirksMode).unwrap(); } } diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 81b516e0772..a69ec5b9aa5 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -25,7 +25,7 @@ use hyper::header::ContentType; use hyper::mime::{Mime, TopLevel, SubLevel}; use ipc_channel::ipc; use ipc_channel::router::ROUTER; -use layout_interface::{LayoutChan, Msg}; +use layout_interface::Msg; use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata, NetworkError}; use network_listener::{NetworkListener, PreInvoke}; use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg}; @@ -318,8 +318,7 @@ impl AsyncResponseListener for StylesheetContext { let document = document.r(); let win = window_from_node(elem); - let LayoutChan(ref layout_chan) = *win.layout_chan(); - layout_chan.send(Msg::AddStylesheet(sheet.clone())).unwrap(); + win.layout_chan().send(Msg::AddStylesheet(sheet.clone())).unwrap(); *elem.stylesheet.borrow_mut() = Some(sheet); document.invalidate_stylesheets(); diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 62395b682d1..c972cb77bb5 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -14,7 +14,7 @@ use dom::element::Element; use dom::htmlelement::HTMLElement; use dom::node::{ChildrenMutation, Node, document_from_node, window_from_node}; use dom::virtualmethods::VirtualMethods; -use layout_interface::{LayoutChan, Msg}; +use layout_interface::Msg; use std::sync::Arc; use string_cache::Atom; use style::media_queries::parse_media_query_list; @@ -68,8 +68,7 @@ impl HTMLStyleElement { sheet.set_media(Some(media)); let sheet = Arc::new(sheet); - let LayoutChan(ref layout_chan) = *win.layout_chan(); - layout_chan.send(Msg::AddStylesheet(sheet.clone())).unwrap(); + win.layout_chan().send(Msg::AddStylesheet(sheet.clone())).unwrap(); *self.stylesheet.borrow_mut() = Some(sheet); let doc = document_from_node(self); doc.r().invalidate_stylesheets(); diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 711e0ba740c..b7f78eb9aa0 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -54,7 +54,7 @@ use euclid::size::Size2D; use heapsize::{HeapSizeOf, heap_size_of}; use html5ever::tree_builder::QuirksMode; use js::jsapi::{JSContext, JSObject, JSRuntime}; -use layout_interface::{LayoutChan, Msg}; +use layout_interface::Msg; use libc::{self, c_void, uintptr_t}; use parse::html::parse_html_fragment; use ref_slice::ref_slice; @@ -195,9 +195,8 @@ impl OpaqueStyleAndLayoutData { pub fn dispose(self, node: &Node) { debug_assert!(thread_state::get().is_script()); let win = window_from_node(node); - let LayoutChan(ref chan) = *win.layout_chan(); node.style_and_layout_data.set(None); - chan.send(Msg::ReapStyleAndLayoutData(self)).unwrap(); + win.layout_chan().send(Msg::ReapStyleAndLayoutData(self)).unwrap(); } } diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 2cd6c4daf9e..a7d2dc608df 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -42,7 +42,7 @@ use js::jsapi::{JS_GetRuntime, JS_GC, MutableHandleValue, SetWindowProxy}; use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow}; -use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse}; +use layout_interface::{LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse}; use libc; use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, SubpageId}; use msg::constellation_msg::{WindowSizeData, WindowSizeType}; @@ -209,7 +209,7 @@ pub struct Window { /// A handle for communicating messages to the layout thread. #[ignore_heap_size_of = "channels are hard"] - layout_chan: LayoutChan, + layout_chan: Sender<Msg>, /// A handle to perform RPC calls into the layout, quickly. #[ignore_heap_size_of = "trait objects are hard"] @@ -1057,8 +1057,7 @@ impl Window { query_type: query_type, }; - let LayoutChan(ref chan) = self.layout_chan; - chan.send(Msg::Reflow(reflow)).unwrap(); + self.layout_chan.send(Msg::Reflow(reflow)).unwrap(); debug!("script: layout forked"); @@ -1300,7 +1299,7 @@ impl Window { self.devtools_chan.clone() } - pub fn layout_chan(&self) -> &LayoutChan { + pub fn layout_chan(&self) -> &Sender<Msg> { &self.layout_chan } @@ -1484,15 +1483,14 @@ impl Window { scheduler_chan: IpcSender<TimerEventRequest>, panic_chan: IpcSender<PanicMsg>, timer_event_chan: IpcSender<TimerEvent>, - layout_chan: LayoutChan, + layout_chan: Sender<Msg>, id: PipelineId, parent_info: Option<(PipelineId, SubpageId)>, window_size: Option<WindowSizeData>) -> Root<Window> { let layout_rpc: Box<LayoutRPC> = { let (rpc_send, rpc_recv) = channel(); - let LayoutChan(ref lchan) = layout_chan; - lchan.send(Msg::GetRPC(rpc_send)).unwrap(); + layout_chan.send(Msg::GetRPC(rpc_send)).unwrap(); rpc_recv.recv().unwrap() }; let error_reporter = CSSErrorReporter { |