aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-22 15:57:46 +0200
committerMs2ger <Ms2ger@gmail.com>2015-10-22 16:12:57 +0200
commit7cd3870977841a00122b2d6009c43eb976ce945d (patch)
tree9d4273fb3335a62a55a087caa00841dbe5c58e89 /components/script/dom/window.rs
parent9d739cf684f0fcc59ae1e0e91ba804481e4d7aa2 (diff)
downloadservo-7cd3870977841a00122b2d6009c43eb976ce945d.tar.gz
servo-7cd3870977841a00122b2d6009c43eb976ce945d.zip
Inline Window::join_layout into its only caller.
I do not know if the FIXME comment is correct; I just copied it.
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs43
1 files changed, 18 insertions, 25 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 7f885988c4e..75a66716043 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -946,7 +946,24 @@ impl Window {
debug!("script: layout forked");
- self.join_layout();
+ // FIXME(cgaebel): this is racey. What if the compositor triggers a
+ // reflow between the "join complete" message and returning from this
+ // function?
+ let mut layout_join_port = self.layout_join_port.borrow_mut();
+ if let Some(join_port) = std_mem::replace(&mut *layout_join_port, None) {
+ match join_port.try_recv() {
+ Err(Empty) => {
+ info!("script: waiting on layout");
+ join_port.recv().unwrap();
+ }
+ Ok(_) => {}
+ Err(Disconnected) => {
+ panic!("Layout task failed while script was waiting for a result.");
+ }
+ }
+
+ debug!("script: layout joined")
+ }
self.pending_reflow_count.set(0);
@@ -977,30 +994,6 @@ impl Window {
self.force_reflow(goal, query_type, reason)
}
- // FIXME(cgaebel): join_layout is racey. What if the compositor triggers a
- // reflow between the "join complete" message and returning from this
- // function?
-
- /// Sends a ping to layout and waits for the response. The response will arrive when the
- /// layout task has finished any pending request messages.
- pub fn join_layout(&self) {
- let mut layout_join_port = self.layout_join_port.borrow_mut();
- if let Some(join_port) = std_mem::replace(&mut *layout_join_port, None) {
- match join_port.try_recv() {
- Err(Empty) => {
- info!("script: waiting on layout");
- join_port.recv().unwrap();
- }
- Ok(_) => {}
- Err(Disconnected) => {
- panic!("Layout task failed while script was waiting for a result.");
- }
- }
-
- debug!("script: layout joined")
- }
- }
-
pub fn layout(&self) -> &LayoutRPC {
&*self.layout_rpc
}