From 1290c1879415c80b374bc3ff6378aec899850048 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 1 Jan 2015 12:20:31 +0100 Subject: [PATCH] Remove the 'b lifetime from Root. It does not add any safety, as the reference is constructed from a raw pointer without limiting the lifetime in any way. --- .../dom/bindings/codegen/Configuration.py | 2 +- components/script/dom/bindings/conversions.rs | 2 +- components/script/dom/bindings/global.rs | 8 ++-- components/script/dom/bindings/js.rs | 42 +++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py index 6ebe6467e52..ac103c86378 100644 --- a/components/script/dom/bindings/codegen/Configuration.py +++ b/components/script/dom/bindings/codegen/Configuration.py @@ -156,7 +156,7 @@ class Descriptor(DescriptorProvider): self.needsRooting = True self.returnType = "Temporary<%s>" % ifaceName self.argumentType = "JSRef<%s>" % ifaceName - self.memberType = "Root<'b, %s>" % ifaceName + self.memberType = "Root<%s>" % ifaceName self.nativeType = "JS<%s>" % ifaceName self.concreteType = ifaceName diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 2931e7d700d..068f4287206 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -471,7 +471,7 @@ impl FromJSValConvertible<()> for JS { } } -impl<'b, T: Reflectable> ToJSValConvertible for Root<'b, T> { +impl ToJSValConvertible for Root { fn to_jsval(&self, cx: *mut JSContext) -> JSVal { self.reflector().to_jsval(cx) } diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 259d3f6b2b3..3640aabb88d 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -32,9 +32,9 @@ pub enum GlobalRef<'a> { } /// A stack-based rooted reference to a global object. -pub enum GlobalRoot<'b> { - Window(Root<'b, window::Window>), - Worker(Root<'b, WorkerGlobalScope>), +pub enum GlobalRoot { + Window(Root), + Worker(Root), } /// A traced reference to a global object, for use in fields of traced Rust @@ -98,7 +98,7 @@ impl<'a> Reflectable for GlobalRef<'a> { } } -impl<'b> GlobalRoot<'b> { +impl GlobalRoot { /// Obtain a safe reference to the global object that cannot outlive the /// lifetime of this root. pub fn root_ref<'c>(&'c self) -> GlobalRef<'c> { diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 20029a45d9e..42ba52b6d34 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -91,7 +91,7 @@ impl Temporary { } /// Create a stack-bounded root for this value. - pub fn root<'b>(self) -> Root<'b, T> { + pub fn root(self) -> Root { let collection = StackRoots.get().unwrap(); unsafe { Root::new(&**collection, &self.inner) @@ -150,7 +150,7 @@ impl JS { /// Root this JS-owned value to prevent its collection as garbage. - pub fn root<'b>(&self) -> Root<'b, T> { + pub fn root(&self) -> Root { let collection = StackRoots.get().unwrap(); unsafe { Root::new(&**collection, self) @@ -310,7 +310,7 @@ pub trait RootedReference { fn root_ref<'a>(&'a self) -> Option>; } -impl<'b, T: Reflectable> RootedReference for Option> { +impl RootedReference for Option> { fn root_ref<'a>(&'a self) -> Option> { self.as_ref().map(|root| root.root_ref()) } @@ -321,7 +321,7 @@ pub trait OptionalRootedReference { fn root_ref<'a>(&'a self) -> Option>>; } -impl<'b, T: Reflectable> OptionalRootedReference for Option>> { +impl OptionalRootedReference for Option>> { fn root_ref<'a>(&'a self) -> Option>> { self.as_ref().map(|inner| inner.root_ref()) } @@ -367,11 +367,11 @@ impl, U: Reflectable> OptionalSettable for Cell /// Root a rootable `Option` type (used for `Option>`) pub trait OptionalRootable { - fn root<'b>(self) -> Option>; + fn root(self) -> Option>; } impl OptionalRootable for Option> { - fn root<'b>(self) -> Option> { + fn root(self) -> Option> { self.map(|inner| inner.root()) } } @@ -389,22 +389,22 @@ impl<'a, T: Reflectable> OptionalUnrootable for Option> { /// Root a rootable `Option` type (used for `Option>`) pub trait OptionalRootedRootable { - fn root<'b>(&self) -> Option>; + fn root(&self) -> Option>; } impl OptionalRootedRootable for Option> { - fn root<'b>(&self) -> Option> { + fn root(&self) -> Option> { self.as_ref().map(|inner| inner.root()) } } /// Root a rootable `Option