Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding: revenge of cargo #6175

Merged
merged 27 commits into from May 27, 2015
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d7ad5d6
add cef method for notifying the main loop of work available
May 19, 2015
83e605d
add no_mangle to servo_test() embedding function
May 19, 2015
af1dce5
add new browser process interface method for main loop integration
May 19, 2015
caa8172
implement cef browser title setting callback
May 19, 2015
cf388cd
call compositor.window.set_page_url() on WindowEvent::LoadUrl
May 19, 2015
92d44fb
send ChangeUrl message from constellation on init
May 19, 2015
02606fa
implement on_address_change handler for cef port
May 19, 2015
a809d6b
remove unused cef imports
May 19, 2015
efc75ef
ignore KEYEVENT_RAWKEYDOWN in cef browser events
May 21, 2015
28aed52
improve cef keyboard handling
May 21, 2015
1e4ceb0
more accurately handle key modifiers in cef
May 21, 2015
cd9dab7
implement cef_load_handler::on_load_start()
May 22, 2015
3481c75
add CompositorMsg::LoadStart, implement cef_load_handler::on_loading_…
May 22, 2015
0d46a3b
add navigation state data to LoadComplete messages, finish cef load s…
May 22, 2015
3f8d8a3
add back/forward/loading members to ServoCefBrowser with related brow…
May 22, 2015
68fc512
add error enum for chromium net errors, create window method for erro…
May 26, 2015
8e78feb
make cef_errorcode_t a typedef for net::NetError
May 26, 2015
14a6390
add embedding method for load_handler::on_load_error
May 26, 2015
90169e8
force resize after sending cef_browser::on_after_created() callback
May 26, 2015
aef3218
Revert "temp re-set default url for cef while I figure out wtf is goi…
May 26, 2015
64ff2c4
handle early LoadURL messages without panicking by sending initial ur…
May 26, 2015
45116dc
break out cef app wakeup code into separate pub function
May 27, 2015
fcf4495
handle case of deleted pipeline when preparing to send load_end const…
May 27, 2015
b1ae5e7
make Opts.url an Option<> type, only emit initial url load if url exists
May 27, 2015
81eb426
when creating a cef browser, setup the url to load but don't load it
May 27, 2015
ca1f49a
spawn a task for cef async browser creation to kick the main loop awake
May 27, 2015
8c278d3
fix glutin headless compile errors
May 27, 2015
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

add navigation state data to LoadComplete messages, finish cef load s…

…tate cbs
  • Loading branch information
Mike Blumenkrantz
Mike Blumenkrantz committed May 27, 2015
commit 0d46a3b89a3fb56340b4109b6ecb17cd8da7d3af
@@ -388,7 +388,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.window.load_start(back, forward);
}

(Msg::LoadComplete, ShutdownState::NotShuttingDown) => {
(Msg::LoadComplete(back, forward), ShutdownState::NotShuttingDown) => {
self.got_load_complete_message = true;

// If we're painting in headless mode, schedule a recomposite.
@@ -399,7 +399,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
// Inform the embedder that the load has finished.
//
// TODO(pcwalton): Specify which frame's load completed.
self.window.load_end();
self.window.load_end(back, forward);
}

(Msg::ScrollTimeout(timestamp), ShutdownState::NotShuttingDown) => {
@@ -162,8 +162,8 @@ pub enum Msg {
SetFrameTree(SendableFrameTree, Sender<()>, ConstellationChan),
/// The load of a page has begun: (can go back, can go forward).
LoadStart(bool, bool),
/// The load of a page has completed.
LoadComplete,
/// The load of a page has completed: (can go back, can go forward).
LoadComplete(bool, bool),
/// Indicates that the scrolling timeout with the given starting timestamp has happened and a
/// composite should happen. (See the `scrolling` module.)
ScrollTimeout(u64),
@@ -196,7 +196,7 @@ impl Debug for Msg {
Msg::ChangePageTitle(..) => write!(f, "ChangePageTitle"),
Msg::ChangePageUrl(..) => write!(f, "ChangePageUrl"),
Msg::SetFrameTree(..) => write!(f, "SetFrameTree"),
Msg::LoadComplete => write!(f, "LoadComplete"),
Msg::LoadComplete(..) => write!(f, "LoadComplete"),
Msg::LoadStart(..) => write!(f, "LoadStart"),
Msg::ScrollTimeout(..) => write!(f, "ScrollTimeout"),
Msg::RecompositeAfterScroll => write!(f, "RecompositeAfterScroll"),
@@ -391,9 +391,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
// A page loaded through one of several methods above has completed all parsing,
// script, and reflow messages have been sent.
ConstellationMsg::LoadComplete => {
ConstellationMsg::LoadComplete(pipeline_id) => {
debug!("constellation got load complete message");
self.handle_load_complete_msg()
self.handle_load_complete_msg(&pipeline_id)
}
// Handle a forward or back request
ConstellationMsg::Navigate(pipeline_info, direction) => {
@@ -681,8 +681,12 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.compositor_proxy.send(CompositorMsg::LoadStart(back, forward));
}

fn handle_load_complete_msg(&mut self) {
self.compositor_proxy.send(CompositorMsg::LoadComplete);
fn handle_load_complete_msg(&mut self, pipeline_id: &PipelineId) {
let frame_id = *self.pipeline_to_frame_map.get(pipeline_id).unwrap();

let forward = !self.mut_frame(frame_id).next.is_empty();
let back = !self.mut_frame(frame_id).prev.is_empty();
self.compositor_proxy.send(CompositorMsg::LoadComplete(back, forward));
if let Some(ref reply_chan) = self.webdriver.load_channel {
reply_chan.send(webdriver_traits::LoadComplete).unwrap();
}
@@ -98,7 +98,7 @@ impl CompositorEventListener for NullCompositor {
Msg::ChangeRunningAnimationsState(..) |
Msg::ScrollFragmentPoint(..) |
Msg::LoadStart(..) |
Msg::LoadComplete |
Msg::LoadComplete(..) |
Msg::ScrollTimeout(..) |
Msg::RecompositeAfterScroll |
Msg::ChangePageTitle(..) |
@@ -106,7 +106,7 @@ pub trait WindowMethods {
/// Called when the browser has started loading a frame.
fn load_start(&self, back: bool, forward: bool);
/// Called when the browser is done loading a frame.
fn load_end(&self);
fn load_end(&self, back: bool, forward: bool);

/// Returns the hidpi factor of the monitor.
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>;
@@ -211,7 +211,7 @@ pub enum Msg {
Exit,
Failure(Failure),
InitLoadUrl(Url),
LoadComplete,
LoadComplete(PipelineId),
FrameRect(PipelineId, SubpageId, Rect<f32>),
LoadUrl(PipelineId, LoadData),
ScriptLoadedURLInIFrame(Url, PipelineId, SubpageId, Option<SubpageId>, IFrameSandboxState),
@@ -960,7 +960,7 @@ impl ScriptTask {
self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();

let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::LoadComplete).unwrap();
chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap();
}

/// Handles a timer that fired.
@@ -331,13 +331,20 @@ impl WindowMethods for Window {
}
}

fn load_end(&self) {
fn load_end(&self, back: bool, forward: bool) {
// FIXME(pcwalton): The status code 200 is a lie.
let browser = self.cef_browser.borrow();
let browser = match *browser {
None => return,
Some(ref browser) => browser,
};
if check_ptr_exist!(browser.get_host().get_client(), get_load_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_loading_state_change) {
browser.get_host()
.get_client()
.get_load_handler()
.on_loading_state_change((*browser).clone(), 0i32, back as i32, forward as i32);
}
if check_ptr_exist!(browser.get_host().get_client(), get_load_handler) &&
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_load_end) {
browser.get_host()
@@ -508,7 +508,7 @@ impl WindowMethods for Window {
fn load_start(&self, _: bool, _: bool) {
}

fn load_end(&self) {
fn load_end(&self, _: bool, _: bool) {
}

/// Has no effect on Android.
@@ -805,7 +805,7 @@ impl WindowMethods for Window {
fn load_start(&self, _: bool, _: bool) {
}

fn load_end(&self) {
fn load_end(&self, _: bool, _: bool) {
}

fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.