mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
An in-memory RNG that shares its file descriptor.
This commit is contained in:
parent
143dfc879e
commit
7ace30f9bd
15 changed files with 203 additions and 23 deletions
|
@ -60,7 +60,6 @@ phf = "0.7.18"
|
|||
phf_macros = "0.7.18"
|
||||
plugins = {path = "../plugins"}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
rand = "0.3"
|
||||
range = {path = "../range"}
|
||||
ref_filter_map = "1.0.1"
|
||||
ref_slice = "1.0"
|
||||
|
@ -73,6 +72,7 @@ serde = "0.8"
|
|||
servo_atoms = {path = "../atoms"}
|
||||
servo_config = {path = "../config", features = ["servo"] }
|
||||
servo_geometry = {path = "../geometry" }
|
||||
servo_rand = {path = "../rand"}
|
||||
servo_url = {path = "../url", features = ["servo"] }
|
||||
smallvec = "0.1"
|
||||
style = {path = "../style"}
|
||||
|
|
|
@ -12,23 +12,23 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
|||
use dom::globalscope::GlobalScope;
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::jsapi::{JS_GetArrayBufferViewType, Type};
|
||||
use rand::{OsRng, Rng};
|
||||
use servo_rand::{ServoRng, Rng};
|
||||
|
||||
unsafe_no_jsmanaged_fields!(OsRng);
|
||||
unsafe_no_jsmanaged_fields!(ServoRng);
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto
|
||||
#[dom_struct]
|
||||
pub struct Crypto {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Defined in rand"]
|
||||
rng: DOMRefCell<OsRng>,
|
||||
rng: DOMRefCell<ServoRng>,
|
||||
}
|
||||
|
||||
impl Crypto {
|
||||
fn new_inherited() -> Crypto {
|
||||
Crypto {
|
||||
reflector_: Reflector::new(),
|
||||
rng: DOMRefCell::new(OsRng::new().unwrap()),
|
||||
rng: DOMRefCell::new(ServoRng::new()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ use js::rust::Runtime;
|
|||
use msg::constellation_msg::FrameId;
|
||||
use net_traits::{IpcSend, load_whole_resource};
|
||||
use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as RequestType};
|
||||
use rand::random;
|
||||
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, StackRootTLS, get_reports, new_rt_and_cx};
|
||||
use script_runtime::ScriptThreadEventCategory::WorkerEvent;
|
||||
use script_traits::{TimerEvent, TimerSource, WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
|
||||
use servo_rand::random;
|
||||
use servo_url::ServoUrl;
|
||||
use std::mem::replace;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
|
|
@ -44,9 +44,9 @@ use html5ever_atoms::LocalName;
|
|||
use hyper::header::{Charset, ContentDisposition, ContentType, DispositionParam, DispositionType};
|
||||
use hyper::method::Method;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use rand::random;
|
||||
use script_thread::{MainThreadScriptMsg, Runnable};
|
||||
use script_traits::LoadData;
|
||||
use servo_rand::random;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
|
|
@ -25,10 +25,10 @@ use js::jsval::UndefinedValue;
|
|||
use js::rust::Runtime;
|
||||
use net_traits::{load_whole_resource, IpcSend, CustomResponseMediator};
|
||||
use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as RequestType};
|
||||
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_rand::random;
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
|
||||
use std::thread;
|
||||
|
|
|
@ -73,7 +73,6 @@ extern crate parking_lot;
|
|||
extern crate phf;
|
||||
#[macro_use]
|
||||
extern crate profile_traits;
|
||||
extern crate rand;
|
||||
extern crate range;
|
||||
extern crate ref_filter_map;
|
||||
extern crate ref_slice;
|
||||
|
@ -86,6 +85,7 @@ extern crate serde;
|
|||
#[macro_use] extern crate servo_atoms;
|
||||
#[macro_use] extern crate servo_config;
|
||||
extern crate servo_geometry;
|
||||
extern crate servo_rand;
|
||||
extern crate servo_url;
|
||||
extern crate smallvec;
|
||||
#[macro_use]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue