mirror of
https://github.com/servo/servo.git
synced 2025-08-17 03:15:34 +01:00
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting * Reformat all imports
This commit is contained in:
parent
413da4ca69
commit
aad2dccc9c
802 changed files with 6861 additions and 6395 deletions
|
@ -2,9 +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 gstreamer::DebugCategory;
|
||||
use gstreamer::DebugColorFlags;
|
||||
use gstreamer::DebugLevel;
|
||||
use gstreamer::{DebugCategory, DebugColorFlags, DebugLevel};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
// TODO: move this to somewhere where it can be shared.
|
||||
// https://github.com/servo/servo/issues/24853
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use servo::embedder_traits::resources::{self, Resource};
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
use std::{env, fs, io};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use servo::embedder_traits::resources::{self, Resource};
|
||||
|
||||
lazy_static! {
|
||||
static ref CMD_RESOURCE_DIR: Mutex<Option<String>> = Mutex::new(None);
|
||||
|
|
|
@ -2,116 +2,65 @@
|
|||
* 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 crate::logging::CATEGORY;
|
||||
|
||||
use crossbeam_channel::Receiver;
|
||||
use crossbeam_channel::Sender;
|
||||
|
||||
use euclid::default::Rotation3D;
|
||||
use euclid::default::Vector3D;
|
||||
use euclid::Point2D;
|
||||
use euclid::Rect;
|
||||
use euclid::Scale;
|
||||
use euclid::Size2D;
|
||||
|
||||
use glib::glib_object_impl;
|
||||
use glib::glib_object_subclass;
|
||||
use glib::object::Cast;
|
||||
use glib::object::Object;
|
||||
use glib::object::ObjectType;
|
||||
use glib::subclass::object::ObjectClassSubclassExt;
|
||||
use glib::subclass::object::ObjectImpl;
|
||||
use glib::subclass::object::ObjectImplExt;
|
||||
use glib::subclass::object::Property;
|
||||
use glib::subclass::simple::ClassStruct;
|
||||
use glib::subclass::types::ObjectSubclass;
|
||||
use glib::translate::FromGlibPtrBorrow;
|
||||
use glib::value::Value;
|
||||
use glib::ParamSpec;
|
||||
use gstreamer::gst_element_error;
|
||||
use gstreamer::gst_loggable_error;
|
||||
use gstreamer::subclass::element::ElementClassSubclassExt;
|
||||
use gstreamer::subclass::element::ElementImpl;
|
||||
use gstreamer::subclass::ElementInstanceStruct;
|
||||
use gstreamer::Buffer;
|
||||
use gstreamer::BufferPool;
|
||||
use gstreamer::BufferPoolExt;
|
||||
use gstreamer::BufferPoolExtManual;
|
||||
use gstreamer::Caps;
|
||||
use gstreamer::CoreError;
|
||||
use gstreamer::Element;
|
||||
use gstreamer::ErrorMessage;
|
||||
use gstreamer::FlowError;
|
||||
use gstreamer::Format;
|
||||
use gstreamer::Fraction;
|
||||
use gstreamer::LoggableError;
|
||||
use gstreamer::PadDirection;
|
||||
use gstreamer::PadPresence;
|
||||
use gstreamer::PadTemplate;
|
||||
use gstreamer_base::subclass::base_src::BaseSrcImpl;
|
||||
use gstreamer_base::BaseSrc;
|
||||
use gstreamer_base::BaseSrcExt;
|
||||
use gstreamer_gl::GLContext;
|
||||
use gstreamer_gl::GLContextExt;
|
||||
use gstreamer_gl::GLContextExtManual;
|
||||
use gstreamer_gl::GLSyncMeta;
|
||||
use gstreamer_gl_sys::gst_gl_context_thread_add;
|
||||
use gstreamer_gl_sys::gst_gl_texture_target_to_gl;
|
||||
use gstreamer_gl_sys::gst_is_gl_memory;
|
||||
use gstreamer_gl_sys::GstGLContext;
|
||||
use gstreamer_gl_sys::GstGLMemory;
|
||||
use gstreamer_video::VideoInfo;
|
||||
|
||||
use log::debug;
|
||||
use log::error;
|
||||
use log::info;
|
||||
use log::warn;
|
||||
|
||||
use servo::compositing::windowing::AnimationState;
|
||||
use servo::compositing::windowing::EmbedderCoordinates;
|
||||
use servo::compositing::windowing::EmbedderEvent;
|
||||
use servo::compositing::windowing::EmbedderMethods;
|
||||
use servo::compositing::windowing::WindowMethods;
|
||||
use servo::embedder_traits::EmbedderProxy;
|
||||
use servo::embedder_traits::EventLoopWaker;
|
||||
use servo::msg::constellation_msg::TopLevelBrowsingContextId;
|
||||
use servo::servo_config::prefs::add_user_prefs;
|
||||
use servo::servo_config::prefs::read_prefs_map;
|
||||
use servo::servo_config::prefs::PrefValue;
|
||||
use servo::servo_config::set_pref;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::webrender_surfman::WebrenderSurfman;
|
||||
use servo::Servo;
|
||||
|
||||
use sparkle::gl;
|
||||
use sparkle::gl::types::GLuint;
|
||||
use sparkle::gl::Gl;
|
||||
|
||||
use surfman::chains::{SwapChain, SwapChainAPI};
|
||||
use surfman::Connection;
|
||||
use surfman::Context;
|
||||
use surfman::Device;
|
||||
use surfman::SurfaceAccess;
|
||||
use surfman::SurfaceType;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::ffi::c_void;
|
||||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
use std::sync::atomic::AtomicU64;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::Mutex;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use webxr::glwindow::GlWindow as WebXRWindow;
|
||||
use webxr::glwindow::GlWindowDiscovery as WebXRDiscovery;
|
||||
use webxr::glwindow::GlWindowMode as WebXRMode;
|
||||
use webxr::glwindow::GlWindowRenderTarget as WebXRRenderTarget;
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use euclid::default::{Rotation3D, Vector3D};
|
||||
use euclid::{Point2D, Rect, Scale, Size2D};
|
||||
use glib::object::{Cast, Object, ObjectType};
|
||||
use glib::subclass::object::{ObjectClassSubclassExt, ObjectImpl, ObjectImplExt, Property};
|
||||
use glib::subclass::simple::ClassStruct;
|
||||
use glib::subclass::types::ObjectSubclass;
|
||||
use glib::translate::FromGlibPtrBorrow;
|
||||
use glib::value::Value;
|
||||
use glib::{glib_object_impl, glib_object_subclass, ParamSpec};
|
||||
use gstreamer::subclass::element::{ElementClassSubclassExt, ElementImpl};
|
||||
use gstreamer::subclass::ElementInstanceStruct;
|
||||
use gstreamer::{
|
||||
gst_element_error, gst_loggable_error, Buffer, BufferPool, BufferPoolExt, BufferPoolExtManual,
|
||||
Caps, CoreError, Element, ErrorMessage, FlowError, Format, Fraction, LoggableError,
|
||||
PadDirection, PadPresence, PadTemplate,
|
||||
};
|
||||
use gstreamer_base::subclass::base_src::BaseSrcImpl;
|
||||
use gstreamer_base::{BaseSrc, BaseSrcExt};
|
||||
use gstreamer_gl::{GLContext, GLContextExt, GLContextExtManual, GLSyncMeta};
|
||||
use gstreamer_gl_sys::{
|
||||
gst_gl_context_thread_add, gst_gl_texture_target_to_gl, gst_is_gl_memory, GstGLContext,
|
||||
GstGLMemory,
|
||||
};
|
||||
use gstreamer_video::VideoInfo;
|
||||
use log::{debug, error, info, warn};
|
||||
use servo::compositing::windowing::{
|
||||
AnimationState, EmbedderCoordinates, EmbedderEvent, EmbedderMethods, WindowMethods,
|
||||
};
|
||||
use servo::embedder_traits::{EmbedderProxy, EventLoopWaker};
|
||||
use servo::msg::constellation_msg::TopLevelBrowsingContextId;
|
||||
use servo::servo_config::prefs::{add_user_prefs, read_prefs_map, PrefValue};
|
||||
use servo::servo_config::set_pref;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::webrender_surfman::WebrenderSurfman;
|
||||
use servo::Servo;
|
||||
use sparkle::gl;
|
||||
use sparkle::gl::types::GLuint;
|
||||
use sparkle::gl::Gl;
|
||||
use surfman::chains::{SwapChain, SwapChainAPI};
|
||||
use surfman::{Connection, Context, Device, SurfaceAccess, SurfaceType};
|
||||
use webxr::glwindow::{
|
||||
GlWindow as WebXRWindow, GlWindowDiscovery as WebXRDiscovery, GlWindowMode as WebXRMode,
|
||||
GlWindowRenderTarget as WebXRRenderTarget,
|
||||
};
|
||||
|
||||
use crate::logging::CATEGORY;
|
||||
|
||||
pub struct ServoWebSrc {
|
||||
sender: Sender<ServoWebSrcMsg>,
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
* 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 gl_generator::{Api, Fallbacks, Profile, Registry};
|
||||
use serde_json::{self, Value};
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use gl_generator::{Api, Fallbacks, Profile, Registry};
|
||||
use serde_json::{self, Value};
|
||||
use vergen::EmitBuilder;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -9,10 +9,11 @@ pub type ServoGl = std::rc::Rc<dyn servo::gl::Gl>;
|
|||
#[cfg(any(target_os = "android", target_os = "windows"))]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub mod egl {
|
||||
use servo::gl::GlesFns;
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
use servo::gl::GlesFns;
|
||||
|
||||
pub type EGLNativeWindowType = *const libc::c_void;
|
||||
pub type khronos_utime_nanoseconds_t = khronos_uint64_t;
|
||||
pub type khronos_uint64_t = u64;
|
||||
|
@ -64,14 +65,15 @@ pub mod gl {
|
|||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod gl {
|
||||
use std::os::raw::c_void;
|
||||
use std::str;
|
||||
|
||||
use core_foundation::base::TCFType;
|
||||
use core_foundation::bundle::{
|
||||
CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName,
|
||||
};
|
||||
use core_foundation::string::CFString;
|
||||
use servo::gl::GlFns;
|
||||
use std::os::raw::c_void;
|
||||
use std::str;
|
||||
|
||||
pub fn init() -> Result<crate::gl_glue::ServoGl, &'static str> {
|
||||
info!("Loading OpenGL...");
|
||||
|
@ -98,11 +100,12 @@ pub mod gl {
|
|||
target_os = "openbsd"
|
||||
))]
|
||||
pub mod gl {
|
||||
use libloading::{Library, Symbol};
|
||||
use servo::gl::GlFns;
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
use libloading::{Library, Symbol};
|
||||
use servo::gl::GlFns;
|
||||
|
||||
pub fn init() -> Result<crate::gl_glue::ServoGl, &'static str> {
|
||||
info!("Loading OpenGL");
|
||||
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
|
||||
pub mod gl_glue;
|
||||
|
||||
pub use servo::config::prefs::{add_user_prefs, PrefValue};
|
||||
pub use servo::embedder_traits::{
|
||||
ContextMenuResult, MediaSessionPlaybackState, PermissionPrompt, PermissionRequest, PromptResult,
|
||||
};
|
||||
pub use servo::msg::constellation_msg::InputMethodType;
|
||||
pub use servo::script_traits::{MediaSessionActionType, MouseButton};
|
||||
pub use servo::webrender_api::units::DeviceIntRect;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
use getopts::Options;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -19,30 +18,29 @@ use servo::compositing::windowing::{
|
|||
WindowMethods,
|
||||
};
|
||||
use servo::config::prefs::pref_map;
|
||||
pub use servo::config::prefs::{add_user_prefs, PrefValue};
|
||||
use servo::embedder_traits::resources::{self, Resource, ResourceReaderMethods};
|
||||
pub use servo::embedder_traits::{
|
||||
ContextMenuResult, MediaSessionPlaybackState, PermissionPrompt, PermissionRequest, PromptResult,
|
||||
};
|
||||
use servo::embedder_traits::{
|
||||
EmbedderMsg, EmbedderProxy, MediaSessionEvent, PromptDefinition, PromptOrigin,
|
||||
};
|
||||
use servo::euclid::{Point2D, Rect, Scale, Size2D, Vector2D};
|
||||
use servo::keyboard_types::{Key, KeyState, KeyboardEvent};
|
||||
pub use servo::msg::constellation_msg::InputMethodType;
|
||||
use servo::msg::constellation_msg::TraversalDirection;
|
||||
pub use servo::script_traits::{MediaSessionActionType, MouseButton};
|
||||
use servo::script_traits::{TouchEventType, TouchId};
|
||||
use servo::servo_config::{opts, pref};
|
||||
use servo::servo_url::ServoUrl;
|
||||
pub use servo::webrender_api::units::DeviceIntRect;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::webrender_api::ScrollLocation;
|
||||
use servo::webrender_surfman::WebrenderSurfman;
|
||||
use servo::{self, gl, BrowserId, Servo};
|
||||
use servo_media::player::context as MediaPlayerContext;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use surfman::Adapter;
|
||||
use surfman::Connection;
|
||||
use surfman::SurfaceType;
|
||||
use surfman::{Adapter, Connection, SurfaceType};
|
||||
|
||||
thread_local! {
|
||||
pub static SERVO: RefCell<Option<ServoGlue>> = RefCell::new(None);
|
||||
|
|
|
@ -7,16 +7,6 @@ mod prefs;
|
|||
#[cfg(target_os = "windows")]
|
||||
mod vslogger;
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use env_logger;
|
||||
use keyboard_types::Key;
|
||||
use log::LevelFilter;
|
||||
use simpleservo::{self, gl_glue, ServoGlue, SERVO};
|
||||
use simpleservo::{
|
||||
ContextMenuResult, Coordinates, DeviceIntRect, EventLoopWaker, HostTrait, InitOptions,
|
||||
InputMethodType, MediaSessionActionType, MediaSessionPlaybackState, MouseButton, PromptResult,
|
||||
SurfmanIntegration,
|
||||
};
|
||||
use std::ffi::{CStr, CString};
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::mem;
|
||||
|
@ -25,6 +15,16 @@ use std::slice;
|
|||
use std::str::FromStr;
|
||||
use std::sync::{Mutex, RwLock};
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use env_logger;
|
||||
use keyboard_types::Key;
|
||||
use log::LevelFilter;
|
||||
use simpleservo::{
|
||||
self, gl_glue, ContextMenuResult, Coordinates, DeviceIntRect, EventLoopWaker, HostTrait,
|
||||
InitOptions, InputMethodType, MediaSessionActionType, MediaSessionPlaybackState, MouseButton,
|
||||
PromptResult, ServoGlue, SurfmanIntegration, SERVO,
|
||||
};
|
||||
|
||||
extern "C" fn default_panic_handler(msg: *const c_char) {
|
||||
let c_str: &CStr = unsafe { CStr::from_ptr(msg) };
|
||||
error!("{}", c_str.to_str().unwrap());
|
||||
|
@ -78,13 +78,9 @@ fn redirect_stdout_stderr(handler: LogHandlerFn) -> Result<(), String> {
|
|||
// Err(str) - The Err value can contain the string value of GetLastError.
|
||||
fn do_redirect_stdout_stderr(handler: LogHandlerFn) -> Result<(), ()> {
|
||||
use std::thread;
|
||||
|
||||
use winapi::shared;
|
||||
use winapi::um::handleapi;
|
||||
use winapi::um::minwinbase;
|
||||
use winapi::um::namedpipeapi;
|
||||
use winapi::um::processenv;
|
||||
use winapi::um::winbase;
|
||||
use winapi::um::winnt;
|
||||
use winapi::um::{handleapi, minwinbase, namedpipeapi, processenv, winbase, winnt};
|
||||
|
||||
let mut h_read_pipe: winnt::HANDLE = handleapi::INVALID_HANDLE_VALUE;
|
||||
let mut h_write_pipe: winnt::HANDLE = handleapi::INVALID_HANDLE_VALUE;
|
||||
|
@ -354,10 +350,12 @@ pub extern "C" fn servo_version() -> *const c_char {
|
|||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn init_logger(modules: &[*const c_char], level: LevelFilter) {
|
||||
use crate::vslogger::LOG_MODULE_FILTERS;
|
||||
use std::sync::Once;
|
||||
|
||||
use vslogger::VSLogger;
|
||||
|
||||
use crate::vslogger::LOG_MODULE_FILTERS;
|
||||
|
||||
static LOGGER: VSLogger = VSLogger;
|
||||
static LOGGER_INIT: Once = Once::new();
|
||||
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
//! retrieve an array (CPREFS) of struct of pointers (CPrefs) to the C-compatible preferences
|
||||
//! (LocalCPref).
|
||||
|
||||
use crate::simpleservo::{self, PrefValue};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::os::raw::{c_char, c_void};
|
||||
|
||||
use crate::simpleservo::{self, PrefValue};
|
||||
|
||||
thread_local! {
|
||||
// CPREFS keeps alive a set of CPref that are sent over to the embedder.
|
||||
// The CPREFS are structs holding pointers to values held alive by LOCALCPREFS.
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
* 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 crate::OUTPUT_LOG_HANDLER;
|
||||
use log::{self, Metadata, Record};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use log::{self, Metadata, Record};
|
||||
|
||||
use crate::OUTPUT_LOG_HANDLER;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref LOG_MODULE_FILTERS: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(vec![]));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
use std::ptr::{null, null_mut};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
use android_logger::{self, Filter};
|
||||
use gstreamer::debug_set_threshold_from_string;
|
||||
use jni::objects::{GlobalRef, JClass, JObject, JString, JValue};
|
||||
|
@ -11,16 +16,11 @@ use jni::sys::{jboolean, jfloat, jint, jstring, JNI_TRUE};
|
|||
use jni::{errors, JNIEnv, JavaVM};
|
||||
use libc::{dup2, pipe, read};
|
||||
use log::Level;
|
||||
use simpleservo::{self, deinit, gl_glue, MouseButton, ServoGlue, SERVO};
|
||||
use simpleservo::{self, gl_glue, ServoGlue, SERVO};
|
||||
use simpleservo::{
|
||||
Coordinates, DeviceIntRect, EventLoopWaker, HostTrait, InitOptions, InputMethodType,
|
||||
MediaSessionPlaybackState, PromptResult, VRInitOptions,
|
||||
self, self, deinit, gl_glue, gl_glue, Coordinates, DeviceIntRect, EventLoopWaker, HostTrait,
|
||||
InitOptions, InputMethodType, MediaSessionPlaybackState, MouseButton, PromptResult, ServoGlue,
|
||||
ServoGlue, VRInitOptions, SERVO, SERVO,
|
||||
};
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
use std::ptr::{null, null_mut};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
struct HostCallbacks {
|
||||
callbacks: GlobalRef,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue