aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorJack Moffitt <jack@metajack.im>2014-11-05 12:33:11 -0700
committerGlenn Watson <gw@intuitionlibrary.com>2014-11-13 11:17:43 +1000
commitd1b433a3b3bab353f320b2f39fa953ce326d2d55 (patch)
treed7a197abb65827b36c47e6b5c3adcce9071643d3 /components/script/script_task.rs
parent26045d7fcbab8851fbefe2851cd904203f8fd8dd (diff)
downloadservo-d1b433a3b3bab353f320b2f39fa953ce326d2d55.tar.gz
servo-d1b433a3b3bab353f320b2f39fa953ce326d2d55.zip
Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs58
1 files changed, 26 insertions, 32 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 5630a9763b9..61431f16af5 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -209,7 +209,7 @@ impl<'a> Drop for ScriptMemoryFailsafe<'a> {
fn drop(&mut self) {
match self.owner {
Some(owner) => {
- let mut page = owner.page.borrow_mut();
+ let page = owner.page.borrow_mut();
for page in page.iter() {
*page.mut_js_info() = None;
}
@@ -264,7 +264,7 @@ impl ScriptTaskFactory for ScriptTask {
let ConstellationChan(const_chan) = constellation_chan.clone();
let (script_chan, script_port) = channel();
let layout_chan = LayoutChan(layout_chan.sender());
- spawn_named_with_send_on_failure("ScriptTask", task_state::Script, proc() {
+ spawn_named_with_send_on_failure("ScriptTask", task_state::SCRIPT, proc() {
let script_task = ScriptTask::new(id,
box compositor as Box<ScriptListener>,
layout_chan,
@@ -286,12 +286,10 @@ impl ScriptTaskFactory for ScriptTask {
}
}
-unsafe extern "C" fn debug_gc_callback(rt: *mut JSRuntime, status: JSGCStatus) {
- js::rust::gc_callback(rt, status);
-
+unsafe extern "C" fn debug_gc_callback(_rt: *mut JSRuntime, status: JSGCStatus) {
match status {
- JSGC_BEGIN => task_state::enter(task_state::InGC),
- JSGC_END => task_state::exit(task_state::InGC),
+ JSGC_BEGIN => task_state::enter(task_state::IN_GC),
+ JSGC_END => task_state::exit(task_state::IN_GC),
_ => (),
}
}
@@ -419,7 +417,7 @@ impl ScriptTask {
let mut resizes = vec!();
{
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
for page in page.iter() {
// Only process a resize if layout is idle.
let layout_join_port = page.layout_join_port.borrow();
@@ -468,7 +466,7 @@ impl ScriptTask {
} else if ret == port3.id() {
FromDevtools(self.devtools_port.recv())
} else {
- fail!("unexpected select result")
+ panic!("unexpected select result")
}
};
@@ -484,12 +482,12 @@ impl ScriptTask {
self.handle_new_layout(new_layout_info);
}
FromConstellation(ResizeMsg(id, size)) => {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(id).expect("resize sent to nonexistent pipeline");
page.resize_event.set(Some(size));
}
FromConstellation(SendEventMsg(id, ReflowEvent(node_addresses))) => {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let inner_page = page.find(id).expect("Reflow sent to nonexistent pipeline");
let mut pending = inner_page.pending_dirty_nodes.borrow_mut();
pending.push_all_move(node_addresses);
@@ -526,23 +524,23 @@ impl ScriptTask {
for msg in sequential.into_iter() {
match msg {
// TODO(tkuehn) need to handle auxiliary layouts for iframes
- FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"),
+ FromConstellation(AttachLayoutMsg(_)) => panic!("should have handled AttachLayoutMsg already"),
FromConstellation(LoadMsg(id, load_data)) => self.load(id, load_data),
FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data),
FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url),
FromConstellation(SendEventMsg(id, event)) => self.handle_event(id, event),
FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id),
- FromScript(FireTimerMsg(FromWorker, _)) => fail!("Worker timeouts must not be sent to script task"),
+ FromScript(FireTimerMsg(FromWorker, _)) => panic!("Worker timeouts must not be sent to script task"),
FromScript(NavigateMsg(direction)) => self.handle_navigate_msg(direction),
FromConstellation(ReflowCompleteMsg(id, reflow_id)) => self.handle_reflow_complete_msg(id, reflow_id),
FromConstellation(ResizeInactiveMsg(id, new_size)) => self.handle_resize_inactive_msg(id, new_size),
FromConstellation(ExitPipelineMsg(id)) => if self.handle_exit_pipeline_msg(id) { return false },
FromConstellation(ViewportMsg(..)) => fail!("should have handled ViewportMsg already"),
FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id),
- FromConstellation(ResizeMsg(..)) => fail!("should have handled ResizeMsg already"),
+ FromConstellation(ResizeMsg(..)) => panic!("should have handled ResizeMsg already"),
FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress),
FromScript(XHRReleaseMsg(addr)) => XMLHttpRequest::handle_release(addr),
- FromScript(DOMMessage(..)) => fail!("unexpected message"),
+ FromScript(DOMMessage(..)) => panic!("unexpected message"),
FromScript(WorkerPostMessage(addr, data, nbytes)) => Worker::handle_message(addr, data, nbytes),
FromScript(WorkerRelease(addr)) => Worker::handle_release(addr),
FromDevtools(EvaluateJS(id, s, reply)) => self.handle_evaluate_js(id, s, reply),
@@ -580,7 +578,7 @@ impl ScriptTask {
} else {
//FIXME: jsvals don't have an is_int32/is_number yet
assert!(rval.is_object_or_null());
- fail!("object values unimplemented")
+ panic!("object values unimplemented")
});
}
@@ -615,7 +613,7 @@ impl ScriptTask {
}
}
- fail!("couldn't find node with unique id {:s}", node_id)
+ panic!("couldn't find node with unique id {:s}", node_id)
}
fn handle_get_children(&self, pipeline: PipelineId, node_id: String, reply: Sender<Vec<NodeInfo>>) {
@@ -632,7 +630,6 @@ impl ScriptTask {
}
fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) {
- debug!("Script: new layout: {:?}", new_layout_info);
let NewLayoutInfo {
old_pipeline_id,
new_pipeline_id,
@@ -640,7 +637,7 @@ impl ScriptTask {
layout_chan
} = new_layout_info;
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let parent_page = page.find(old_pipeline_id).expect("ScriptTask: received a layout
whose parent has a PipelineId which does not correspond to a pipeline in the script
task's page tree. This is a bug.");
@@ -658,7 +655,7 @@ impl ScriptTask {
/// Handles a timer that fired.
fn handle_fire_timer_msg(&self, id: PipelineId, timer_id: TimerId) {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(id).expect("ScriptTask: received fire timer msg for a
pipeline ID not associated with this script task. This is a bug.");
let frame = page.frame();
@@ -668,8 +665,8 @@ impl ScriptTask {
/// Handles a notification that reflow completed.
fn handle_reflow_complete_msg(&self, pipeline_id: PipelineId, reflow_id: uint) {
- debug!("Script: Reflow {:?} complete for {:?}", reflow_id, pipeline_id);
- let mut page = self.page.borrow_mut();
+ debug!("Script: Reflow {} complete for {}", reflow_id, pipeline_id);
+ let page = self.page.borrow_mut();
let page = page.find(pipeline_id).expect(
"ScriptTask: received a load message for a layout channel that is not associated \
with this script task. This is a bug.");
@@ -696,7 +693,7 @@ impl ScriptTask {
/// Window was resized, but this script was not active, so don't reflow yet
fn handle_resize_inactive_msg(&self, id: PipelineId, new_size: WindowSizeData) {
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(id).expect("Received resize message for PipelineId not associated
with a page in the page tree. This is a bug.");
page.window_size.set(new_size);
@@ -724,9 +721,9 @@ impl ScriptTask {
/// Returns true if the script task should shut down and false otherwise.
fn handle_exit_pipeline_msg(&self, id: PipelineId) -> bool {
// If root is being exited, shut down all pages
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
if page.id == id {
- debug!("shutting down layout for root page {:?}", id);
+ debug!("shutting down layout for root page {}", id);
*self.js_context.borrow_mut() = None;
shut_down_layout(&*page, (*self.js_runtime).ptr);
return true
@@ -750,9 +747,9 @@ impl ScriptTask {
/// objects, parses HTML and CSS, and kicks off initial layout.
fn load(&self, pipeline_id: PipelineId, load_data: LoadData) {
let url = load_data.url.clone();
- debug!("ScriptTask: loading {} on page {:?}", url, pipeline_id);
+ debug!("ScriptTask: loading {} on page {}", url, pipeline_id);
- let mut page = self.page.borrow_mut();
+ let page = self.page.borrow_mut();
let page = page.find(pipeline_id).expect("ScriptTask: received a load
message for a layout channel that is not associated with this script task. This
is a bug.");
@@ -934,8 +931,6 @@ impl ScriptTask {
fn handle_resize_event(&self, pipeline_id: PipelineId, new_size: WindowSizeData) {
- debug!("script got resize event: {:?}", new_size);
-
let window = {
let page = get_page(&*self.page.borrow(), pipeline_id);
page.window_size.set(new_size);
@@ -992,11 +987,11 @@ impl ScriptTask {
}
fn handle_click_event(&self, pipeline_id: PipelineId, _button: uint, point: Point2D<f32>) {
- debug!("ClickEvent: clicked at {:?}", point);
+ debug!("ClickEvent: clicked at {}", point);
let page = get_page(&*self.page.borrow(), pipeline_id);
match page.hit_test(&point) {
Some(node_address) => {
- debug!("node address is {:?}", node_address);
+ debug!("node address is {}", node_address);
let temp_node =
node::from_untrusted_node_address(
@@ -1144,4 +1139,3 @@ fn get_page(page: &Rc<Page>, pipeline_id: PipelineId) -> Rc<Page> {
message for a layout channel that is not associated with this script task.\
This is a bug.")
}
-