Auto merge of #6031 - glennw:reftest-race-conditions, r=larsberg,jdm

The basic idea is it's safe to output an image for reftest by testing:
 - That the compositor doesn't have any animations active.
 - That the compositor is not waiting on any outstanding paint messages to arrive.
 - That the script tasks are "idle" and therefore won't cause reflow.
    - This currently means page loaded, onload fired, reftest-wait not active, first reflow triggered.
    - It could easily be expanded to handle pending timers etc.
 - That the "epoch" that the layout tasks have last laid out after script went idle, is reflected by the compositor in all visible layers for that pipeline.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6031)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-05-13 18:37:54 -05:00
commit 5e61ebaa05
17 changed files with 363 additions and 390 deletions

View file

@ -22,7 +22,6 @@ use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata;
use libc::{c_char, c_void};
use msg::constellation_msg::{Key, KeyModifiers};
use msg::compositor_msg::{ReadyState, PaintState};
use std::ptr;
use std_url::Url;
use util::cursor::Cursor;
@ -212,26 +211,6 @@ impl WindowMethods for Window {
}
}
fn set_ready_state(&self, ready_state: ReadyState) {
let browser = self.cef_browser.borrow();
let browser = match *browser {
None => return,
Some(ref browser) => browser,
};
let is_loading = match ready_state {
ReadyState::Blank | ReadyState::FinishedLoading => 0,
ReadyState::Loading | ReadyState::PerformingLayout => 1,
};
browser.get_host()
.get_client()
.get_load_handler()
.on_loading_state_change(browser.clone(), is_loading, 1, 1);
}
fn set_paint_state(&self, _: PaintState) {
// TODO(pcwalton)
}
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx,DevicePixel,f32> {
let browser = self.cef_browser.borrow();
match *browser {

View file

@ -14,7 +14,6 @@ use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata;
use msg::constellation_msg;
use msg::constellation_msg::Key;
use msg::compositor_msg::{PaintState, ReadyState};
use NestedEventLoopListener;
use std::rc::Rc;
use std::sync::mpsc::{channel, Sender};
@ -64,8 +63,6 @@ pub struct Window {
event_queue: RefCell<Vec<WindowEvent>>,
mouse_pos: Cell<Point2D<i32>>,
ready_state: Cell<ReadyState>,
paint_state: Cell<PaintState>,
key_modifiers: Cell<KeyModifiers>,
}
@ -93,8 +90,6 @@ impl Window {
mouse_down_point: Cell::new(Point2D(0, 0)),
mouse_pos: Cell::new(Point2D(0, 0)),
ready_state: Cell::new(ReadyState::Blank),
paint_state: Cell::new(PaintState::Idle),
key_modifiers: Cell::new(KeyModifiers::empty()),
};
@ -476,16 +471,6 @@ impl WindowMethods for Window {
box receiver as Box<CompositorReceiver>)
}
/// Sets the ready state.
fn set_ready_state(&self, ready_state: ReadyState) {
self.ready_state.set(ready_state);
}
/// Sets the paint state.
fn set_paint_state(&self, paint_state: PaintState) {
self.paint_state.set(paint_state);
}
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> {
ScaleFactor::new(self.window.hidpi_factor())
}
@ -670,14 +655,6 @@ impl WindowMethods for Window {
box receiver as Box<CompositorReceiver>)
}
/// Sets the ready state.
fn set_ready_state(&self, _: ReadyState) {
}
/// Sets the paint state.
fn set_paint_state(&self, _: PaintState) {
}
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> {
ScaleFactor::new(1.0)
}

View file

@ -11,9 +11,7 @@ use geom::size::TypedSize2D;
use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata;
use libc::c_int;
use msg::compositor_msg::{ReadyState, PaintState};
use msg::constellation_msg::{Key, KeyModifiers};
use std::cell::Cell;
use std::sync::mpsc::{channel, Sender, Receiver};
use std::rc::Rc;
use std::mem::transmute;
@ -622,9 +620,6 @@ pub struct Window {
dpy: EGLDisplay,
ctx: EGLContext,
surf: EGLSurface,
ready_state: Cell<ReadyState>,
paint_state: Cell<PaintState>,
}
impl Window {
@ -750,9 +745,6 @@ impl Window {
dpy: dpy,
ctx: ctx,
surf: eglwindow,
ready_state: Cell::new(ReadyState::Blank),
paint_state: Cell::new(PaintState::Idle),
};
Rc::new(window)
@ -787,16 +779,6 @@ impl WindowMethods for Window {
let _ = egl::SwapBuffers(self.dpy, self.surf);
}
/// Sets the ready state.
fn set_ready_state(&self, ready_state: ReadyState) {
self.ready_state.set(ready_state);
}
/// Sets the paint state.
fn set_paint_state(&self, paint_state: PaintState) {
self.paint_state.set(paint_state);
}
fn set_page_title(&self, _: Option<String>) {
}