mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -2,15 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod};
|
||||
use log::warn;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use style::values::computed::font::GenericFontFamily;
|
||||
use style::values::computed::{
|
||||
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::ptr;
|
||||
|
||||
use base::text::{UnicodeBlock, UnicodeBlockMethod};
|
||||
|
@ -26,7 +26,7 @@ use style::values::computed::{FontStretch, FontStyle, FontWeight};
|
|||
use style::Atom;
|
||||
use unicode_script::Script;
|
||||
|
||||
use super::{c_str_to_string, LocalFontIdentifier};
|
||||
use super::LocalFontIdentifier;
|
||||
use crate::font::map_platform_values_to_style_values;
|
||||
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
|
||||
use crate::platform::add_noto_fallback_families;
|
||||
|
@ -289,3 +289,11 @@ fn font_weight_from_fontconfig_pattern(pattern: *mut FcPattern) -> Option<FontWe
|
|||
let mapped_weight = map_platform_values_to_style_values(&mapping, weight as f64);
|
||||
Some(FontWeight::from_float(mapped_weight as f32))
|
||||
}
|
||||
|
||||
/// Creates a String from the given null-terminated buffer.
|
||||
/// Panics if the buffer does not contain UTF-8.
|
||||
unsafe fn c_str_to_string(s: *const c_char) -> String {
|
||||
std::str::from_utf8(CStr::from_ptr(s).to_bytes())
|
||||
.unwrap()
|
||||
.to_owned()
|
||||
}
|
||||
|
|
|
@ -3,26 +3,16 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::CStr;
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str;
|
||||
|
||||
use libc::c_char;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use memmap2::Mmap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use style::Atom;
|
||||
use webrender_api::NativeFontHandle;
|
||||
|
||||
/// Creates a String from the given null-terminated buffer.
|
||||
/// Panics if the buffer does not contain UTF-8.
|
||||
unsafe fn c_str_to_string(s: *const c_char) -> String {
|
||||
str::from_utf8(CStr::from_ptr(s).to_bytes())
|
||||
.unwrap()
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
pub mod font;
|
||||
|
||||
#[cfg(all(target_os = "linux", not(target_env = "ohos"), not(ohos_mock)))]
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::LazyLock;
|
||||
|
@ -13,7 +11,6 @@ use std::{fs, io};
|
|||
use base::text::{UnicodeBlock, UnicodeBlockMethod};
|
||||
use log::{debug, error, warn};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use style::values::computed::font::GenericFontFamily;
|
||||
use style::values::computed::{
|
||||
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "android")))]
|
||||
pub fn install() {}
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "linux"))]
|
||||
|
@ -49,7 +49,7 @@ pub fn install() {
|
|||
signal!(libc::SIGBUS, handler); // handle invalid memory access
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "android")))]
|
||||
pub(crate) fn raise_signal_or_exit_with_error(_signal: i32) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::sync::Arc;
|
|||
|
||||
use android_logger::{self, Config, FilterBuilder};
|
||||
use jni::objects::{GlobalRef, JClass, JObject, JString, JValue, JValueOwned};
|
||||
use jni::sys::{jboolean, jfloat, jint, jobject, jstring, JNI_TRUE};
|
||||
use jni::sys::{jboolean, jfloat, jint, jobject, JNI_TRUE};
|
||||
use jni::{JNIEnv, JavaVM};
|
||||
use log::{debug, error, info, warn};
|
||||
use simpleservo::{
|
||||
|
@ -59,7 +59,7 @@ where
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Java_org_servo_servoview_JNIServo_version<'local>(
|
||||
mut env: JNIEnv<'local>,
|
||||
env: JNIEnv<'local>,
|
||||
_class: JClass<'local>,
|
||||
) -> JString<'local> {
|
||||
let v = crate::servo_version();
|
||||
|
@ -711,16 +711,6 @@ fn throw(env: &mut JNIEnv, err: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
fn new_string(env: &mut JNIEnv, s: &str) -> Result<jstring, &'static str> {
|
||||
match env.new_string(s) {
|
||||
Ok(s) => Ok(s.into_raw()),
|
||||
Err(_) => {
|
||||
throw(env, "Couldn't create Java string");
|
||||
Err("Couldn't create Java String")
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn new_string_as_jvalue<'local>(
|
||||
env: &mut JNIEnv<'local>,
|
||||
input_string: &str,
|
||||
|
|
|
@ -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"))?;
|
||||
|
|
|
@ -23,7 +23,6 @@ use servo::keyboard_types::{Key, KeyState, KeyboardEvent};
|
|||
use servo::script_traits::{
|
||||
MediaSessionActionType, MouseButton, TouchEventType, TouchId, TraversalDirection,
|
||||
};
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::style_traits::DevicePixel;
|
||||
use servo::webrender_api::units::DeviceIntRect;
|
||||
use servo::webrender_api::ScrollLocation;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue