Auto merge of #11270 - servo:ConstellationChan, r=asajeffrey

Remove ConstellationChan.

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

It's a pointless abstraction that propagates the obsolete chan terminology,
swaps the order in which the sender and receiver are returned, and hides a
source of panics.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11270)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-19 12:38:26 -07:00
commit 27c25e859a
24 changed files with 110 additions and 162 deletions

View file

@ -2,8 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use ipc_channel::ipc;
use msg::constellation_msg::ConstellationChan;
use ipc_channel::ipc::{self, IpcSender};
use script_traits::ScriptMsg as ConstellationMsg;
use std::borrow::ToOwned;
@ -14,14 +13,14 @@ pub trait ClipboardProvider {
fn set_clipboard_contents(&mut self, String);
}
impl ClipboardProvider for ConstellationChan<ConstellationMsg> {
impl ClipboardProvider for IpcSender<ConstellationMsg> {
fn clipboard_contents(&mut self) -> String {
let (tx, rx) = ipc::channel().unwrap();
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
self.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
rx.recv().unwrap()
}
fn set_clipboard_contents(&mut self, s: String) {
self.0.send(ConstellationMsg::SetClipboardContents(s)).unwrap();
self.send(ConstellationMsg::SetClipboardContents(s)).unwrap();
}
}

View file

@ -18,7 +18,7 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment};
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
use msg::constellation_msg::{PanicMsg, PipelineId};
use net_traits::ResourceThread;
use profile_traits::{mem, time};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
@ -89,8 +89,8 @@ impl<'a> GlobalRef<'a> {
}
}
/// Get a `ConstellationChan` to send messages to the constellation channel when available.
pub fn constellation_chan(&self) -> &ConstellationChan<ConstellationMsg> {
/// Get a `IpcSender` to send messages to the constellation when available.
pub fn constellation_chan(&self) -> &IpcSender<ConstellationMsg> {
match *self {
GlobalRef::Window(window) => window.constellation_chan(),
GlobalRef::Worker(worker) => worker.constellation_chan(),

View file

@ -55,7 +55,6 @@ use js::jsval::JSVal;
use js::rust::Runtime;
use layout_interface::{LayoutChan, LayoutRPC};
use libc;
use msg::constellation_msg::ConstellationChan;
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WindowSizeType, ReferrerPolicy};
use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
@ -66,7 +65,7 @@ use offscreen_gl_context::GLLimits;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
use script_runtime::ScriptChan;
use script_traits::{LayoutMsg, ScriptMsg, TimerEventId, TimerSource, TouchpadPressurePhase, UntrustedNodeAddress};
use script_traits::{TimerEventId, TimerSource, TouchpadPressurePhase, UntrustedNodeAddress};
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use std::boxed::FnBox;
@ -323,20 +322,6 @@ no_jsmanaged_fields!(SharedRt);
no_jsmanaged_fields!(TouchpadPressurePhase);
no_jsmanaged_fields!(ReferrerPolicy);
impl JSTraceable for ConstellationChan<ScriptMsg> {
#[inline]
fn trace(&self, _trc: *mut JSTracer) {
// Do nothing
}
}
impl JSTraceable for ConstellationChan<LayoutMsg> {
#[inline]
fn trace(&self, _trc: *mut JSTracer) {
// Do nothing
}
}
impl JSTraceable for Box<ScriptChan + Send> {
#[inline]
fn trace(&self, _trc: *mut JSTracer) {

View file

@ -123,7 +123,7 @@ impl CanvasRenderingContext2D {
-> CanvasRenderingContext2D {
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
constellation_chan.0.send(ConstellationMsg::CreateCanvasPaintThread(size, sender)).unwrap();
constellation_chan.send(ConstellationMsg::CreateCanvasPaintThread(size, sender)).unwrap();
let ipc_renderer = receiver.recv().unwrap();
CanvasRenderingContext2D {
reflector_: Reflector::new(),

View file

@ -94,7 +94,7 @@ use js::jsapi::JS_GetRuntime;
use js::jsapi::{JSContext, JSObject, JSRuntime};
use layout_interface::{LayoutChan, Msg, ReflowQueryType};
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState};
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, ReferrerPolicy, SubpageId};
use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
use net_traits::CookieSource::NonHTTP;
@ -623,9 +623,8 @@ impl Document {
// Update the focus state for all elements in the focus chain.
// https://html.spec.whatwg.org/multipage/#focus-chain
if focus_type == FocusType::Element {
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::Focus(self.window.pipeline());
chan.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
}
}
@ -699,7 +698,7 @@ impl Document {
let event = ConstellationMsg::ForwardMouseButtonEvent(pipeline_id,
mouse_event_type,
button, child_point);
self.window.constellation_chan().0.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
return;
}
@ -880,7 +879,7 @@ impl Document {
let child_point = client_point - child_origin;
let event = ConstellationMsg::ForwardMouseMoveEvent(pipeline_id, child_point);
self.window.constellation_chan().0.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
return;
}
@ -1270,11 +1269,10 @@ impl Document {
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
if htmliframeelement::mozbrowser_enabled() {
if let Some((containing_pipeline_id, subpage_id)) = self.window.parent_info() {
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
subpage_id,
event);
chan.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
}
}
@ -1294,11 +1292,10 @@ impl Document {
//
// TODO: Should tick animation only when document is visible
if !self.running_animation_callbacks.get() {
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::ChangeRunningAnimationsState(
self.window.pipeline(),
AnimationState::AnimationCallbacksPresent);
chan.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
ident
@ -1308,10 +1305,9 @@ impl Document {
pub fn cancel_animation_frame(&self, ident: u32) {
self.animation_frame_list.borrow_mut().remove(&ident);
if self.animation_frame_list.borrow().is_empty() {
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),
AnimationState::NoAnimationCallbacksPresent);
chan.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
}
@ -1333,10 +1329,9 @@ impl Document {
// the next frame (which is the common case), we won't send a NoAnimationCallbacksPresent
// message quickly followed by an AnimationCallbacksPresent message.
if self.animation_frame_list.borrow().is_empty() {
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),
AnimationState::NoAnimationCallbacksPresent);
chan.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}
self.running_animation_callbacks.set(false);
@ -1495,9 +1490,8 @@ impl Document {
pub fn notify_constellation_load(&self) {
let pipeline_id = self.window.pipeline();
let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::DOMLoad(pipeline_id);
chan.send(event).unwrap();
self.window.constellation_chan().send(event).unwrap();
}

View file

@ -15,7 +15,6 @@ use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
use script_traits::ScriptMsg as ConstellationMsg;
use std::rc::Rc;
use string_cache::Atom;
@ -153,9 +152,8 @@ impl VirtualMethods for HTMLBodyElement {
let window = window_from_node(self);
let document = window.Document();
document.set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
let ConstellationChan(ref chan) = *window.constellation_chan();
let event = ConstellationMsg::HeadParsed;
chan.send(event).unwrap();
window.constellation_chan().send(event).unwrap();
}
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {

View file

@ -33,8 +33,7 @@ use ipc_channel::ipc;
use js::jsapi::{JSAutoCompartment, RootedValue, JSContext, MutableHandleValue};
use js::jsval::{UndefinedValue, NullValue};
use layout_interface::ReflowQueryType;
use msg::constellation_msg::{ConstellationChan, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
use msg::constellation_msg::{LoadData, NavigationDirection, PipelineId, SubpageId};
use net_traits::response::HttpsState;
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg};
@ -120,12 +119,10 @@ impl HTMLIFrameElement {
}
let window = window_from_node(self);
let window = window.r();
let (new_subpage_id, old_subpage_id) = self.generate_new_subpage_id();
let new_pipeline_id = self.pipeline_id.get().unwrap();
let private_iframe = self.privatebrowsing();
let ConstellationChan(ref chan) = *window.constellation_chan();
let load_info = IFrameLoadInfo {
load_data: load_data,
containing_pipeline_id: window.pipeline(),
@ -135,7 +132,9 @@ impl HTMLIFrameElement {
sandbox: sandboxed,
is_private: private_iframe,
};
chan.send(ConstellationMsg::ScriptLoadedURLInIFrame(load_info)).unwrap();
window.constellation_chan()
.send(ConstellationMsg::ScriptLoadedURLInIFrame(load_info))
.unwrap();
if mozbrowser_enabled() {
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
@ -372,13 +371,11 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> E
if iframe.Mozbrowser() {
if iframe.upcast::<Node>().is_in_doc() {
let window = window_from_node(iframe);
let window = window.r();
let pipeline_info = Some((window.pipeline(),
iframe.subpage_id().unwrap()));
let ConstellationChan(ref chan) = *window.constellation_chan();
let msg = ConstellationMsg::Navigate(pipeline_info, direction);
chan.send(msg).unwrap();
window.constellation_chan().send(msg).unwrap();
}
Ok(())
@ -568,7 +565,6 @@ impl VirtualMethods for HTMLIFrameElement {
// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
if let Some(pipeline_id) = self.pipeline_id.get() {
let window = window_from_node(self);
let window = window.r();
// The only reason we're waiting for the iframe to be totally
// removed is to ensure the script thread can't add iframes faster
@ -576,7 +572,6 @@ impl VirtualMethods for HTMLIFrameElement {
//
// Since most of this cleanup doesn't happen on same-origin
// iframes, and since that would cause a deadlock, don't do it.
let ConstellationChan(ref chan) = *window.constellation_chan();
let same_origin = {
// FIXME(#10968): this should probably match the origin check in
// HTMLIFrameElement::contentDocument.
@ -591,7 +586,7 @@ impl VirtualMethods for HTMLIFrameElement {
(Some(sender), Some(receiver))
};
let msg = ConstellationMsg::RemoveIFrame(pipeline_id, sender);
chan.send(msg).unwrap();
window.constellation_chan().send(msg).unwrap();
if let Some(receiver) = receiver {
receiver.recv().unwrap()
}

View file

@ -27,7 +27,7 @@ use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::validation::Validatable;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
use ipc_channel::ipc::IpcSender;
use script_traits::ScriptMsg as ConstellationMsg;
use std::borrow::ToOwned;
use std::cell::Cell;
@ -76,7 +76,7 @@ pub struct HTMLInputElement {
size: Cell<u32>,
maxlength: Cell<i32>,
#[ignore_heap_size_of = "#7193"]
textinput: DOMRefCell<TextInput<ConstellationChan<ConstellationMsg>>>,
textinput: DOMRefCell<TextInput<IpcSender<ConstellationMsg>>>,
activation_state: DOMRefCell<InputActivationState>,
// https://html.spec.whatwg.org/multipage/#concept-input-value-dirty-flag
value_dirty: Cell<bool>,

View file

@ -26,7 +26,6 @@ use hyper::mime::{Mime, TopLevel, SubLevel};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use layout_interface::{LayoutChan, Msg};
use msg::constellation_msg::ConstellationChan;
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata, NetworkError};
use network_listener::{NetworkListener, PreInvoke};
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg};
@ -242,9 +241,8 @@ impl HTMLLinkElement {
let document = document_from_node(self);
match document.base_url().join(href) {
Ok(url) => {
let ConstellationChan(ref chan) = *document.window().constellation_chan();
let event = ConstellationMsg::NewFavicon(url.clone());
chan.send(event).unwrap();
document.window().constellation_chan().send(event).unwrap();
let mozbrowser_event = match *sizes {
Some(ref sizes) => MozBrowserEvent::IconChange(rel.to_owned(), url.to_string(), sizes.to_owned()),

View file

@ -23,7 +23,7 @@ use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::validation::Validatable;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
use ipc_channel::ipc::IpcSender;
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
use std::ops::Range;
@ -36,7 +36,7 @@ use util::str::DOMString;
pub struct HTMLTextAreaElement {
htmlelement: HTMLElement,
#[ignore_heap_size_of = "#7193"]
textinput: DOMRefCell<TextInput<ConstellationChan<ConstellationMsg>>>,
textinput: DOMRefCell<TextInput<IpcSender<ConstellationMsg>>>,
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
value_changed: Cell<bool>,
}

View file

@ -95,8 +95,7 @@ impl WebGLRenderingContext {
-> Result<WebGLRenderingContext, String> {
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
constellation_chan.0
.send(ConstellationMsg::CreateWebGLPaintThread(size, attrs, sender))
constellation_chan.send(ConstellationMsg::CreateWebGLPaintThread(size, attrs, sender))
.unwrap();
let result = receiver.recv().unwrap();

View file

@ -42,7 +42,7 @@ use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse};
use libc;
use msg::constellation_msg::{ConstellationChan, LoadData, PanicMsg, PipelineId, SubpageId};
use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, SubpageId};
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::ResourceThread;
@ -228,7 +228,7 @@ pub struct Window {
/// A handle for communicating messages to the constellation thread.
#[ignore_heap_size_of = "channels are hard"]
constellation_chan: ConstellationChan<ConstellationMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
/// Pending scroll to fragment event, if any
fragment_name: DOMRefCell<Option<String>>,
@ -449,7 +449,7 @@ impl WindowMethods for Window {
stderr.flush().unwrap();
let (sender, receiver) = ipc::channel().unwrap();
self.constellation_chan().0.send(ConstellationMsg::Alert(self.pipeline(), s.to_string(), sender)).unwrap();
self.constellation_chan().send(ConstellationMsg::Alert(self.pipeline(), s.to_string(), sender)).unwrap();
let should_display_alert_dialog = receiver.recv().unwrap();
if should_display_alert_dialog {
@ -1120,7 +1120,7 @@ impl Window {
if ready_state == DocumentReadyState::Complete && !reftest_wait {
let event = ConstellationMsg::SetDocumentState(self.id, DocumentState::Idle);
self.constellation_chan().0.send(event).unwrap();
self.constellation_chan().send(event).unwrap();
}
}
}
@ -1296,7 +1296,7 @@ impl Window {
&self.layout_chan
}
pub fn constellation_chan(&self) -> &ConstellationChan<ConstellationMsg> {
pub fn constellation_chan(&self) -> &IpcSender<ConstellationMsg> {
&self.constellation_chan
}
@ -1459,7 +1459,7 @@ impl Window {
mem_profiler_chan: mem::ProfilerChan,
time_profiler_chan: ProfilerChan,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
constellation_chan: ConstellationChan<ConstellationMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
control_chan: IpcSender<ConstellationControlMsg>,
scheduler_chan: IpcSender<TimerEventRequest>,
panic_chan: IpcSender<PanicMsg>,

View file

@ -21,7 +21,7 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, JSContext, JSRuntime, RootedValue};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
use msg::constellation_msg::{PanicMsg, PipelineId};
use net_traits::{LoadContext, ResourceThread, load_whole_resource};
use profile_traits::{mem, time};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
@ -48,7 +48,7 @@ pub struct WorkerGlobalScopeInit {
pub time_profiler_chan: time::ProfilerChan,
pub to_devtools_sender: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
pub from_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
pub constellation_chan: ConstellationChan<ConstellationMsg>,
pub constellation_chan: IpcSender<ConstellationMsg>,
pub scheduler_chan: IpcSender<TimerEventRequest>,
pub panic_chan: IpcSender<PanicMsg>,
pub worker_id: WorkerId,
@ -94,7 +94,7 @@ pub struct WorkerGlobalScope {
devtools_wants_updates: Cell<bool>,
#[ignore_heap_size_of = "Defined in std"]
constellation_chan: ConstellationChan<ConstellationMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
#[ignore_heap_size_of = "Defined in std"]
scheduler_chan: IpcSender<TimerEventRequest>,
@ -156,7 +156,7 @@ impl WorkerGlobalScope {
&self.from_devtools_receiver
}
pub fn constellation_chan(&self) -> &ConstellationChan<ConstellationMsg> {
pub fn constellation_chan(&self) -> &IpcSender<ConstellationMsg> {
&self.constellation_chan
}

View file

@ -12,8 +12,7 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use gfx_traits::{Epoch, LayerId};
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
use msg::constellation_msg::{WindowSizeData};
use msg::constellation_msg::{PanicMsg, PipelineId, WindowSizeData};
use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem::ReportsChan;
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
@ -262,8 +261,8 @@ pub struct NewLayoutThreadInfo {
pub is_parent: bool,
pub layout_pair: OpaqueScriptLayoutChannel,
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
pub constellation_chan: ConstellationChan<ConstellationMsg>,
pub panic_chan: ConstellationChan<PanicMsg>,
pub constellation_chan: IpcSender<ConstellationMsg>,
pub panic_chan: IpcSender<PanicMsg>,
pub script_chan: IpcSender<ConstellationControlMsg>,
pub image_cache_thread: ImageCacheThread,
pub paint_chan: OptionalOpaqueIpcSender,

View file

@ -59,8 +59,7 @@ use js::rust::Runtime;
use layout_interface::{ReflowQueryType};
use layout_interface::{self, LayoutChan, NewLayoutThreadInfo, ScriptLayoutChan};
use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{ConstellationChan, LoadData, PanicMsg};
use msg::constellation_msg::{PipelineId, PipelineNamespace};
use msg::constellation_msg::{LoadData, PanicMsg, PipelineId, PipelineNamespace};
use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData;
@ -342,10 +341,10 @@ pub struct ScriptThread {
control_port: Receiver<ConstellationControlMsg>,
/// For communicating load url messages to the constellation
constellation_chan: ConstellationChan<ConstellationMsg>,
constellation_chan: IpcSender<ConstellationMsg>,
/// For communicating layout messages to the constellation
layout_to_constellation_chan: ConstellationChan<LayoutMsg>,
layout_to_constellation_chan: IpcSender<LayoutMsg>,
/// A handle to the compositor for communicating ready state messages.
compositor: DOMRefCell<IpcSender<ScriptToCompositorMsg>>,
@ -438,7 +437,7 @@ impl ScriptThreadFactory for ScriptThread {
state: InitialScriptState,
layout_chan: &OpaqueScriptLayoutChannel,
load_data: LoadData) {
let ConstellationChan(panic_chan) = state.panic_chan.clone();
let panic_chan = state.panic_chan.clone();
let (script_chan, script_port) = channel();
let layout_chan = LayoutChan(layout_chan.sender());
let pipeline_id = state.id;
@ -577,7 +576,7 @@ impl ScriptThread {
compositor: DOMRefCell::new(state.compositor),
time_profiler_chan: state.time_profiler_chan,
mem_profiler_chan: state.mem_profiler_chan,
panic_chan: state.panic_chan.0,
panic_chan: state.panic_chan,
devtools_chan: state.devtools_chan,
devtools_port: devtools_port,
@ -1134,8 +1133,7 @@ impl ScriptThread {
let handler = box DocumentProgressHandler::new(Trusted::new(doc));
self.dom_manipulation_task_source.queue(DOMManipulationTask::DocumentProgress(handler)).unwrap();
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap();
self.constellation_chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap();
}
fn collect_reports(&self, reports_chan: ReportsChan) {
@ -1398,8 +1396,9 @@ impl ScriptThread {
chan.send(layout_interface::Msg::SetFinalUrl(final_url.clone())).unwrap();
// update the pipeline url
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone())).unwrap();
self.constellation_chan
.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone()))
.unwrap();
}
debug!("ScriptThread: loading {} on pipeline {:?}", incomplete.url, incomplete.pipeline_id);
@ -1569,8 +1568,9 @@ impl ScriptThread {
}
document.set_ready_state(DocumentReadyState::Loading);
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::ActivateDocument(incomplete.pipeline_id)).unwrap();
self.constellation_chan
.send(ConstellationMsg::ActivateDocument(incomplete.pipeline_id))
.unwrap();
// Notify devtools that a new script global exists.
self.notify_devtools(document.Title(), final_url.clone(), (browsing_context.pipeline(), None));
@ -1729,8 +1729,7 @@ impl ScriptThread {
});
let event = ConstellationMsg::NodeStatus(status);
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(event).unwrap();
self.constellation_chan.send(event).unwrap();
state_already_changed = true;
}
@ -1744,8 +1743,7 @@ impl ScriptThread {
.filter_map(Root::downcast::<HTMLAnchorElement>)
.next() {
let event = ConstellationMsg::NodeStatus(None);
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(event).unwrap();
self.constellation_chan.send(event).unwrap();
}
}
}
@ -1844,8 +1842,9 @@ impl ScriptThread {
}
}
None => {
let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(ConstellationMsg::LoadUrl(pipeline_id, load_data)).unwrap();
self.constellation_chan
.send(ConstellationMsg::LoadUrl(pipeline_id, load_data))
.unwrap();
}
}
}