mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Removed util.
This commit is contained in:
parent
01b6ad55bd
commit
9be4fd56ce
133 changed files with 396 additions and 352 deletions
|
@ -5603,7 +5603,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
|||
'dom::globalscope::GlobalScope',
|
||||
'mem::heap_size_of_raw_self_and_children',
|
||||
'libc',
|
||||
'util::prefs::PREFS',
|
||||
'servo_config::prefs::PREFS',
|
||||
'std::borrow::ToOwned',
|
||||
'std::cmp',
|
||||
'std::mem',
|
||||
|
|
|
@ -56,8 +56,8 @@ use js::jsval::{ObjectValue, StringValue};
|
|||
use js::rust::{ToString, get_object_class, is_dom_class, is_dom_object, maybe_wrap_value};
|
||||
use libc;
|
||||
use num_traits::Float;
|
||||
use servo_config::opts;
|
||||
use std::{char, mem, ptr, slice};
|
||||
use util::opts;
|
||||
|
||||
/// A trait to check whether a given `JSObject` implements an IDL interface.
|
||||
pub trait IDLInterface {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Machinery to conditionally expose things.
|
||||
|
||||
use js::jsapi::{HandleObject, JSContext};
|
||||
use util::prefs::PREFS;
|
||||
use servo_config::prefs::PREFS;
|
||||
|
||||
/// A container with a condition.
|
||||
pub struct Guard<T: Clone + Copy> {
|
||||
|
|
|
@ -19,8 +19,8 @@ use dom::element::Element;
|
|||
use dom::node::{Node, NodeDamage};
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::text::Text;
|
||||
use servo_config::opts;
|
||||
use std::cell::Ref;
|
||||
use util::opts;
|
||||
|
||||
// https://dom.spec.whatwg.org/#characterdata
|
||||
#[dom_struct]
|
||||
|
|
|
@ -78,7 +78,7 @@ use dom::htmlunknownelement::HTMLUnknownElement;
|
|||
use dom::htmlvideoelement::HTMLVideoElement;
|
||||
use dom::svgsvgelement::SVGSVGElement;
|
||||
use html5ever_atoms::{Prefix, QualName};
|
||||
use util::prefs::PREFS;
|
||||
use servo_config::prefs::PREFS;
|
||||
|
||||
fn create_svg_element(name: QualName,
|
||||
prefix: Option<DOMString>,
|
||||
|
|
|
@ -38,8 +38,8 @@ use std::mem::replace;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use style::thread_state;
|
||||
use util::thread::spawn_named;
|
||||
|
||||
/// Set the `worker` field of a related DedicatedWorkerGlobalScope object to a particular
|
||||
/// value for the duration of this object's lifetime. This ensures that the related Worker
|
||||
|
@ -160,7 +160,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
let name = format!("WebWorker for {}", serialized_worker_url);
|
||||
let top_level_frame_id = FrameId::installed();
|
||||
|
||||
spawn_named(name, move || {
|
||||
thread::Builder::new().name(name).spawn(move || {
|
||||
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
|
||||
|
||||
if let Some(top_level_frame_id) = top_level_frame_id {
|
||||
|
@ -243,7 +243,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
global.handle_event(event);
|
||||
}
|
||||
}, reporter_name, parent_sender, CommonScriptMsg::CollectReports);
|
||||
});
|
||||
}).expect("Thread spawning failed");
|
||||
}
|
||||
|
||||
pub fn script_chan(&self) -> Box<ScriptChan + Send> {
|
||||
|
|
|
@ -113,6 +113,7 @@ use script_traits::{ScriptMsg as ConstellationMsg, TouchpadPressurePhase};
|
|||
use script_traits::{TouchEventType, TouchId};
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -133,7 +134,6 @@ use style::str::{split_html_space_chars, str_join};
|
|||
use style::stylesheets::Stylesheet;
|
||||
use time;
|
||||
use url::percent_encoding::percent_decode;
|
||||
use util::prefs::PREFS;
|
||||
|
||||
pub enum TouchEventResult {
|
||||
Processed(bool),
|
||||
|
|
|
@ -34,9 +34,9 @@ use servo_atoms::Atom;
|
|||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use task_source::TaskSource;
|
||||
use task_source::file_reading::{FileReadingTaskSource, FileReadingRunnable, FileReadingTask};
|
||||
use util::thread::spawn_named;
|
||||
|
||||
#[derive(PartialEq, Clone, Copy, JSTraceable, HeapSizeOf)]
|
||||
pub enum FileReaderFunction {
|
||||
|
@ -401,9 +401,10 @@ impl FileReader {
|
|||
let wrapper = global.get_runnable_wrapper();
|
||||
let task_source = global.file_reading_task_source();
|
||||
|
||||
spawn_named("file reader async operation".to_owned(), move || {
|
||||
thread::Builder::new().name("file reader async operation".to_owned()).spawn(move || {
|
||||
perform_annotated_read_operation(gen_id, load_data, blob_contents, fr, task_source, wrapper)
|
||||
});
|
||||
}).expect("Thread spawning failed");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ use html5ever_atoms::LocalName;
|
|||
use net_traits::ReferrerPolicy;
|
||||
use num_traits::ToPrimitive;
|
||||
use script_traits::MozBrowserEvent;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::default::Default;
|
||||
use style::attr::AttrValue;
|
||||
use util::prefs::PREFS;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLAnchorElement {
|
||||
|
|
|
@ -48,13 +48,13 @@ use script_traits::{IFrameLoadInfo, IFrameLoadInfoWithData, LoadData};
|
|||
use script_traits::{MozBrowserEvent, NewLayoutInfo, ScriptMsg as ConstellationMsg};
|
||||
use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_config::servo_version;
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::Cell;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::context::ReflowGoal;
|
||||
use task_source::TaskSource;
|
||||
use util::prefs::PREFS;
|
||||
use util::servo_version;
|
||||
|
||||
bitflags! {
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::node::{Node, UnbindContext, document_from_node, window_from_node};
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
use html5ever_atoms::LocalName;
|
||||
use parking_lot::RwLock;
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
@ -89,7 +90,7 @@ impl HTMLMetaElement {
|
|||
}
|
||||
|
||||
fn apply_viewport(&self) {
|
||||
if !::util::prefs::PREFS.get("layout.viewport.enabled").as_boolean().unwrap_or(false) {
|
||||
if !PREFS.get("layout.viewport.enabled").as_boolean().unwrap_or(false) {
|
||||
return;
|
||||
}
|
||||
let element = self.upcast::<Element>();
|
||||
|
|
|
@ -14,9 +14,9 @@ use dom::event::{Event, EventBubbles, EventCancelable};
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::uievent::UIEvent;
|
||||
use dom::window::Window;
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::cell::Cell;
|
||||
use std::default::Default;
|
||||
use util::prefs::PREFS;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MouseEvent {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::str::DOMString;
|
||||
use util::opts;
|
||||
use servo_config::opts;
|
||||
|
||||
pub fn Product() -> DOMString {
|
||||
DOMString::from("Gecko")
|
||||
|
|
|
@ -28,13 +28,12 @@ use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as Req
|
|||
use rand::random;
|
||||
use script_runtime::{CommonScriptMsg, StackRootTLS, get_reports, new_rt_and_cx, ScriptChan};
|
||||
use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg, WorkerScriptLoadOrigin};
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use style::thread_state::{self, IN_WORKER, SCRIPT};
|
||||
use util::prefs::PREFS;
|
||||
use util::thread::spawn_named;
|
||||
|
||||
/// Messages used to control service worker event loop
|
||||
pub enum ServiceWorkerScriptMsg {
|
||||
|
@ -151,7 +150,7 @@ impl ServiceWorkerGlobalScope {
|
|||
.. } = scope_things;
|
||||
|
||||
let serialized_worker_url = script_url.to_string();
|
||||
spawn_named(format!("ServiceWorker for {}", serialized_worker_url), move || {
|
||||
thread::Builder::new().name(format!("ServiceWorker for {}", serialized_worker_url)).spawn(move || {
|
||||
thread_state::initialize(SCRIPT | IN_WORKER);
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots_tls = StackRootTLS::new(&roots);
|
||||
|
@ -202,11 +201,11 @@ impl ServiceWorkerGlobalScope {
|
|||
|
||||
scope.execute_script(DOMString::from(source));
|
||||
// Service workers are time limited
|
||||
spawn_named("SWTimeoutThread".to_owned(), move || {
|
||||
thread::Builder::new().name("SWTimeoutThread".to_owned()).spawn(move || {
|
||||
let sw_lifetime_timeout = PREFS.get("dom.serviceworker.timeout_seconds").as_u64().unwrap();
|
||||
thread::sleep(Duration::new(sw_lifetime_timeout, 0));
|
||||
let _ = timer_chan.send(());
|
||||
});
|
||||
}).expect("Thread spawning failed");
|
||||
|
||||
global.dispatch_activate();
|
||||
let reporter_name = format!("service-worker-reporter-{}", random::<u64>());
|
||||
|
@ -217,7 +216,7 @@ impl ServiceWorkerGlobalScope {
|
|||
}
|
||||
}
|
||||
}, reporter_name, scope.script_chan(), CommonScriptMsg::CollectReports);
|
||||
});
|
||||
}).expect("Thread spawning failed");
|
||||
}
|
||||
|
||||
fn handle_event(&self, event: MixedMessage) -> bool {
|
||||
|
|
|
@ -32,10 +32,10 @@ use network_listener::PreInvoke;
|
|||
use profile_traits::time::{TimerMetadata, TimerMetadataFrameType};
|
||||
use profile_traits::time::{TimerMetadataReflowType, ProfilerCategory, profile};
|
||||
use script_thread::ScriptThread;
|
||||
use servo_config::resource_files::read_resource_file;
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::Cell;
|
||||
use std::mem;
|
||||
use util::resource_files::read_resource_file;
|
||||
|
||||
mod html;
|
||||
mod xml;
|
||||
|
|
|
@ -37,11 +37,11 @@ use js::jsapi::{HandleObject, HandleValue, JSContext, JSObject, JSAutoCompartmen
|
|||
use js::jsapi::{JS_NewPlainObject, JS_NewUint8ClampedArray};
|
||||
use js::jsval::{JSVal, NullValue};
|
||||
use script_traits::MsDuration;
|
||||
use servo_config::prefs::PREFS;
|
||||
use std::borrow::ToOwned;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use timers::OneshotTimerCallback;
|
||||
use util::prefs::PREFS;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct TestBinding {
|
||||
|
|
|
@ -9,11 +9,11 @@ use dom::bindings::js::RootedReference;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::htmlheadelement::HTMLHeadElement;
|
||||
use dom::node::Node;
|
||||
use servo_config::opts;
|
||||
use servo_config::resource_files::resources_dir_path;
|
||||
use std::borrow::ToOwned;
|
||||
use std::fs::read_dir;
|
||||
use std::path::PathBuf;
|
||||
use util::opts;
|
||||
use util::resource_files::resources_dir_path;
|
||||
|
||||
|
||||
pub fn load_script(head: &HTMLHeadElement) {
|
||||
|
|
|
@ -77,6 +77,9 @@ use script_traits::{DocumentState, TimerEvent, TimerEventId};
|
|||
use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, WindowSizeData, WindowSizeType};
|
||||
use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::opts;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_geometry::{f32_rect_to_au_rect, max_rect};
|
||||
use servo_url::ServoUrl;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -106,9 +109,6 @@ use timers::{IsInterval, TimerCallback};
|
|||
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
|
||||
use tinyfiledialogs::{self, MessageBoxIcon};
|
||||
use url::Position;
|
||||
use util::geometry::{self, max_rect};
|
||||
use util::opts;
|
||||
use util::prefs::PREFS;
|
||||
use webdriver_handlers::jsval_to_webdriver;
|
||||
|
||||
/// Current state of the window object
|
||||
|
@ -1413,13 +1413,13 @@ impl Window {
|
|||
}
|
||||
|
||||
pub fn set_page_clip_rect_with_new_viewport(&self, viewport: Rect<f32>) -> bool {
|
||||
let rect = geometry::f32_rect_to_au_rect(viewport.clone());
|
||||
let rect = f32_rect_to_au_rect(viewport.clone());
|
||||
self.current_viewport.set(rect);
|
||||
// We use a clipping rectangle that is five times the size of the of the viewport,
|
||||
// so that we don't collect display list items for areas too far outside the viewport,
|
||||
// but also don't trigger reflows every time the viewport changes.
|
||||
static VIEWPORT_EXPANSION: f32 = 2.0; // 2 lengths on each side plus original length is 5 total.
|
||||
let proposed_clip_rect = geometry::f32_rect_to_au_rect(
|
||||
let proposed_clip_rect = f32_rect_to_au_rect(
|
||||
viewport.inflate(viewport.size.width * VIEWPORT_EXPANSION,
|
||||
viewport.size.height * VIEWPORT_EXPANSION));
|
||||
let clip_rect = self.page_clip_rect.get();
|
||||
|
|
|
@ -53,6 +53,7 @@ use net_traits::request::{CredentialsMode, Destination, RequestInit, RequestMode
|
|||
use net_traits::trim_http_whitespace;
|
||||
use network_listener::{NetworkListener, PreInvoke};
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::prefs::PREFS;
|
||||
use servo_url::ServoUrl;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -64,7 +65,6 @@ use task_source::networking::NetworkingTaskSource;
|
|||
use time;
|
||||
use timers::{OneshotTimerCallback, OneshotTimerHandle};
|
||||
use url::Position;
|
||||
use util::prefs::PREFS;
|
||||
|
||||
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf)]
|
||||
enum XMLHttpRequestState {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue