Auto merge of #6010 - brson:next, r=pcwalton

Just cleanup.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6010)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-05-12 03:26:54 -05:00
commit ca9c703bf5
11 changed files with 41 additions and 198 deletions

1
ports/cef/Cargo.lock generated
View file

@ -1224,6 +1224,7 @@ dependencies = [
"string_cache 0.1.0 (git+https://github.com/servo/string-cache)",
"string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)",
"time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]

View file

@ -15,7 +15,6 @@ use window;
use compositing::windowing::{WindowNavigateMsg, WindowEvent};
use glutin_app;
use libc::c_int;
use util::opts;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell, BorrowState};
use std::sync::atomic::{AtomicIsize, Ordering};
@ -204,9 +203,6 @@ fn browser_host_create(window_info: &cef_window_info_t,
client: CefClient,
callback_executed: bool)
-> CefBrowser {
let url = "http://s27.postimg.org/vqbtrolyr/servo.jpg".to_owned();
let mut opts = opts::default_opts();
opts.url = url;
let browser = ServoCefBrowser::new(window_info, client).as_cef_interface();
browser.init(window_info);
if callback_executed {

View file

@ -12,6 +12,7 @@ use std::borrow::ToOwned;
use std::ffi;
use std::str;
use browser;
use std_url::Url;
const MAX_RENDERING_THREADS: usize = 128;
@ -70,14 +71,14 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
};
let mut temp_opts = opts::default_opts();
temp_opts.url = HOME_URL.to_owned();
temp_opts.url = Url::parse(HOME_URL).unwrap();
temp_opts.paint_threads = rendering_threads;
temp_opts.layout_threads = rendering_threads;
temp_opts.headless = false;
temp_opts.hard_fail = false;
temp_opts.enable_text_antialiasing = true;
temp_opts.resources_path = resources_path();
opts::set_opts(temp_opts);
opts::set(temp_opts);
return 1
}

1
ports/gonk/Cargo.lock generated
View file

@ -1086,6 +1086,7 @@ dependencies = [
"string_cache 0.1.0 (git+https://github.com/servo/string-cache)",
"string_cache_plugin 0.1.1 (git+https://github.com/servo/string-cache)",
"time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]

View file

@ -1,171 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(thread_local)]
#![feature(box_syntax)]
#![feature(rustc_private)]
// For FFI
#![allow(non_snake_case, dead_code)]
#[macro_use]
extern crate log;
extern crate compositing;
extern crate devtools;
extern crate net;
extern crate net_traits;
extern crate msg;
#[macro_use]
extern crate util;
extern crate script;
extern crate layout;
extern crate gfx;
extern crate libc;
extern crate profile;
extern crate url;
use compositing::CompositorEventListener;
use compositing::windowing::{WindowEvent, WindowMethods};
#[cfg(not(test))]
use compositing::{CompositorProxy, CompositorTask, Constellation};
#[cfg(not(test))]
use msg::constellation_msg::Msg as ConstellationMsg;
#[cfg(not(test))]
use msg::constellation_msg::ConstellationChan;
#[cfg(not(test))]
use script::dom::bindings::codegen::RegisterBindings;
#[cfg(not(test))]
use net::image_cache_task::new_image_cache_task;
#[cfg(not(test))]
use net::storage_task::StorageTaskFactory;
#[cfg(not(test))]
use net::resource_task::new_resource_task;
#[cfg(not(test))]
use gfx::font_cache_task::FontCacheTask;
#[cfg(not(test))]
use profile::mem;
#[cfg(not(test))]
use profile::time;
#[cfg(not(test))]
use util::opts;
#[cfg(not(test))]
use util::taskpool::TaskPool;
#[cfg(not(test))]
use std::env;
#[cfg(not(test))]
use std::rc::Rc;
pub struct Browser {
compositor: Box<CompositorEventListener + 'static>,
}
/// The in-process interface to Servo.
///
/// It does everything necessary to render the web, primarily
/// orchestrating the interaction between JavaScript, CSS layout,
/// rendering, and the client window.
///
/// Clients create a `Browser` for a given reference-counted type
/// implementing `WindowMethods`, which is the bridge to whatever
/// application Servo is embedded in. Clients then create an event
/// loop to pump messages between the embedding application and
/// various browser components.
impl Browser {
#[cfg(not(test))]
pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
where Window: WindowMethods + 'static {
::util::opts::set_experimental_enabled(opts::get().enable_experimental);
// Global configuration options, parsed from the command line.
let opts = opts::get();
// Create the global vtables used by the (generated) DOM
// bindings to implement JS proxies.
RegisterBindings::RegisterProxyHandlers();
// Use this thread pool to load-balance simple tasks, such as
// image decoding.
let shared_task_pool = TaskPool::new(8);
// Get both endpoints of a special channel for communication between
// the client window and the compositor. This channel is unique because
// messages to client may need to pump a platform-specific event loop
// to deliver the message.
let (compositor_proxy, compositor_receiver) =
WindowMethods::create_compositor_channel(&window);
let time_profiler_chan = time::Profiler::create(opts.time_profiler_period);
let mem_profiler_chan = mem::Profiler::create(opts.mem_profiler_period);
let devtools_chan = opts.devtools_port.map(|port| {
devtools::start_server(port)
});
// Create a Servo instance.
let resource_task = new_resource_task(opts.user_agent.clone(), devtools_chan.clone());
let image_cache_task = new_image_cache_task(resource_task.clone());
let font_cache_task = FontCacheTask::new(resource_task.clone());
let storage_task = StorageTaskFactory::new();
// Create the constellation, which maintains the engine
// pipelines, including the script and layout threads, as well
// as the navigation context.
let constellation_chan = Constellation::<layout::layout_task::LayoutTask,
script::script_task::ScriptTask>::start(
compositor_proxy.clone_compositor_proxy(),
resource_task,
image_cache_task,
font_cache_task,
time_profiler_chan.clone(),
mem_profiler_chan.clone(),
devtools_chan,
storage_task);
// Send the URL command to the constellation.
let cwd = env::current_dir().unwrap();
let url = match url::Url::parse(&opts.url) {
Ok(url) => url,
Err(url::ParseError::RelativeUrlWithoutBase)
=> url::Url::from_file_path(&*cwd.join(&opts.url)).unwrap(),
Err(_) => panic!("URL parsing failed"),
};
let ConstellationChan(ref chan) = constellation_chan;
chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap();
// The compositor coordinates with the client window to create the final
// rendered page and display it somewhere.
let compositor = CompositorTask::create(window,
compositor_proxy,
compositor_receiver,
constellation_chan.clone(),
time_profiler_chan,
mem_profiler_chan);
Browser {
compositor: compositor,
}
}
pub fn handle_event(&mut self, event: WindowEvent) -> bool {
self.compositor.handle_event(event)
}
pub fn repaint_synchronously(&mut self) {
self.compositor.repaint_synchronously()
}
pub fn pinch_zoom_level(&self) -> f32 {
self.compositor.pinch_zoom_level()
}
pub fn get_title_for_main_frame(&self) {
self.compositor.get_title_for_main_frame()
}
pub fn shutdown(mut self) {
self.compositor.shutdown();
}
}