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 CompositorMsg::LoadStart, implement cef_load_handler::on_loading_…

…state_change()

only adds the loading:true callback this time...
  • Loading branch information
Mike Blumenkrantz
Mike Blumenkrantz committed May 27, 2015
commit 3481c752cd6514a50980044e425d65de80ebf608
@@ -384,6 +384,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.scroll_fragment_to_point(pipeline_id, layer_id, point);
}

(Msg::LoadStart(back, forward), ShutdownState::NotShuttingDown) => {
self.window.load_start(back, forward);
}

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

@@ -160,6 +160,8 @@ pub enum Msg {
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Replaces the current frame tree, typically called during main frame navigation.
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,
/// Indicates that the scrolling timeout with the given starting timestamp has happened and a
@@ -195,6 +197,7 @@ impl Debug for Msg {
Msg::ChangePageUrl(..) => write!(f, "ChangePageUrl"),
Msg::SetFrameTree(..) => write!(f, "SetFrameTree"),
Msg::LoadComplete => write!(f, "LoadComplete"),
Msg::LoadStart(..) => write!(f, "LoadStart"),
Msg::ScrollTimeout(..) => write!(f, "ScrollTimeout"),
Msg::RecompositeAfterScroll => write!(f, "RecompositeAfterScroll"),
Msg::KeyEvent(..) => write!(f, "KeyEvent"),
@@ -520,6 +520,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let window_rect = Rect(Point2D::zero(), self.window_size.visible_viewport);
let root_pipeline_id =
self.new_pipeline(None, Some(window_rect), None, LoadData::new(url.clone()));
self.handle_load_start_msg(&root_pipeline_id);
self.push_pending_frame(root_pipeline_id, None);
self.compositor_proxy.send(CompositorMsg::ChangePageUrl(root_pipeline_id, url));
}
@@ -630,6 +631,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// requested change so it can update its internal state.
match self.pipeline(source_id).parent_info {
Some((parent_pipeline_id, subpage_id)) => {
self.handle_load_start_msg(&source_id);
// Message the constellation to find the script task for this iframe
// and issue an iframe load through there.
let parent_pipeline = self.pipeline(parent_pipeline_id);
@@ -647,6 +649,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
}

self.handle_load_start_msg(&source_id);
// Being here means either there are no pending frames, or none of the pending
// changes would be overridden by changing the subframe associated with source_id.

@@ -662,6 +665,22 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
}

fn handle_load_start_msg(&mut self, pipeline_id: &PipelineId) {
let mut back = false;
let mut forward = false;
let frameid = self.pipeline_to_frame_map.get(pipeline_id);
match frameid {
Some(frame_id) => {
forward = if !self.frame(*frame_id).next.is_empty() { true }
else { false };
back = if !self.frame(*frame_id).prev.is_empty() { true }
else { false };
},
None => {}
};
self.compositor_proxy.send(CompositorMsg::LoadStart(back, forward));
}

fn handle_load_complete_msg(&mut self) {
self.compositor_proxy.send(CompositorMsg::LoadComplete);
if let Some(ref reply_chan) = self.webdriver.load_channel {
@@ -97,6 +97,7 @@ impl CompositorEventListener for NullCompositor {
Msg::AssignPaintedBuffers(..) |
Msg::ChangeRunningAnimationsState(..) |
Msg::ScrollFragmentPoint(..) |
Msg::LoadStart(..) |
Msg::LoadComplete |
Msg::ScrollTimeout(..) |
Msg::RecompositeAfterScroll |
@@ -103,6 +103,8 @@ pub trait WindowMethods {
fn set_page_title(&self, title: Option<String>);
/// Sets the load data for the current page.
fn set_page_url(&self, url: Url);
/// 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);

@@ -315,6 +315,22 @@ impl WindowMethods for Window {
}
}

fn load_start(&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(), 1i32, back as i32, forward as i32);
}
}

fn load_end(&self) {
// FIXME(pcwalton): The status code 200 is a lie.
let browser = self.cef_browser.borrow();
@@ -505,6 +505,9 @@ impl WindowMethods for Window {
fn set_page_url(&self, _: Url) {
}

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

fn load_end(&self) {
}

@@ -802,6 +802,9 @@ impl WindowMethods for Window {
fn set_page_url(&self, _: Url) {
}

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

fn load_end(&self) {
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.