mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
andrdoid: Fix some compiler warnings (#34070)
This removes unused code in order to reduce the number of compiler warnings on the Android build. Some of this code might be used in the future and it can be restored from git commit history. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
517e8a376a
commit
f12071f77e
8 changed files with 14 additions and 86 deletions
|
@ -9,10 +9,8 @@ use std::os::raw::c_void;
|
|||
use std::rc::Rc;
|
||||
|
||||
use getopts::Options;
|
||||
use log::info;
|
||||
use servo::compositing::windowing::EmbedderEvent;
|
||||
use servo::compositing::CompositeTarget;
|
||||
use servo::config::prefs::pref_map;
|
||||
pub use servo::config::prefs::{add_user_prefs, PrefValue};
|
||||
use servo::embedder_traits::resources;
|
||||
/// The EventLoopWaker::wake function will be called from any thread.
|
||||
|
@ -51,52 +49,6 @@ pub struct InitOptions {
|
|||
pub enum SurfmanIntegration {
|
||||
/// Render directly to a provided native widget (see surfman::NativeWidget).
|
||||
Widget(*mut c_void),
|
||||
/// Render to an offscreen surface.
|
||||
Surface,
|
||||
}
|
||||
|
||||
/// Test if a url is valid.
|
||||
pub fn is_uri_valid(url: &str) -> bool {
|
||||
info!("load_uri: {}", url);
|
||||
ServoUrl::parse(url).is_ok()
|
||||
}
|
||||
|
||||
/// Retrieve a snapshot of the current preferences
|
||||
pub fn get_prefs() -> HashMap<String, (PrefValue, bool)> {
|
||||
pref_map()
|
||||
.iter()
|
||||
.map(|(key, value)| {
|
||||
let is_default = pref_map().is_default(&key).unwrap();
|
||||
(key, (value, is_default))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Retrieve a preference.
|
||||
pub fn get_pref(key: &str) -> (PrefValue, bool) {
|
||||
if let Ok(is_default) = pref_map().is_default(&key) {
|
||||
(pref_map().get(key), is_default)
|
||||
} else {
|
||||
(PrefValue::Missing, false)
|
||||
}
|
||||
}
|
||||
|
||||
/// Restore a preference to its default value.
|
||||
pub fn reset_pref(key: &str) -> bool {
|
||||
pref_map().reset(key).is_ok()
|
||||
}
|
||||
|
||||
/// Restore all the preferences to their default values.
|
||||
pub fn reset_all_prefs() {
|
||||
pref_map().reset_all();
|
||||
}
|
||||
|
||||
/// Change the value of a preference.
|
||||
pub fn set_pref(key: &str, val: PrefValue) -> Result<(), &'static str> {
|
||||
pref_map()
|
||||
.set(key, val)
|
||||
.map(|_| ())
|
||||
.map_err(|_| "Pref set failed")
|
||||
}
|
||||
|
||||
/// Initialize Servo. At that point, we need a valid GL context.
|
||||
|
@ -144,10 +96,6 @@ pub fn init(
|
|||
};
|
||||
SurfaceType::Widget { native_widget }
|
||||
},
|
||||
SurfmanIntegration::Surface => {
|
||||
let size = init_opts.coordinates.framebuffer.to_untyped();
|
||||
SurfaceType::Generic { size }
|
||||
},
|
||||
};
|
||||
let rendering_context = RenderingContext::create(&connection, &adapter, surface_type)
|
||||
.or(Err("Failed to create surface manager"))?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue