mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Remove unused enum GlobalField
This commit is contained in:
parent
efaf4cdeca
commit
2703568227
1 changed files with 0 additions and 30 deletions
|
@ -44,17 +44,6 @@ pub enum GlobalRoot {
|
|||
Worker(Root<WorkerGlobalScope>),
|
||||
}
|
||||
|
||||
/// A traced reference to a global object, for use in fields of traced Rust
|
||||
/// structures.
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
#[must_root]
|
||||
pub enum GlobalField {
|
||||
/// A field for a `Window` object.
|
||||
Window(JS<window::Window>),
|
||||
/// A field for a `WorkerGlobalScope` object.
|
||||
Worker(JS<WorkerGlobalScope>),
|
||||
}
|
||||
|
||||
impl<'a> GlobalRef<'a> {
|
||||
/// Get the `JSContext` for the `JSRuntime` associated with the thread
|
||||
/// this global object is on.
|
||||
|
@ -273,25 +262,6 @@ impl GlobalRoot {
|
|||
}
|
||||
}
|
||||
|
||||
impl GlobalField {
|
||||
/// Create a new `GlobalField` from a rooted reference.
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn from_rooted(global: &GlobalRef) -> GlobalField {
|
||||
match *global {
|
||||
GlobalRef::Window(window) => GlobalField::Window(JS::from_ref(window)),
|
||||
GlobalRef::Worker(worker) => GlobalField::Worker(JS::from_ref(worker)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a stack-bounded root for this reference.
|
||||
pub fn root(&self) -> GlobalRoot {
|
||||
match *self {
|
||||
GlobalField::Window(ref window) => GlobalRoot::Window(Root::from_ref(window)),
|
||||
GlobalField::Worker(ref worker) => GlobalRoot::Worker(Root::from_ref(worker)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the global object of the realm that the given DOM object's reflector was created in.
|
||||
pub fn global_root_from_reflector<T: Reflectable>(reflector: &T) -> GlobalRoot {
|
||||
global_root_from_object(*reflector.reflector().get_jsobject())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue