Rename Root<T> to DomRoot<T>

In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
This commit is contained in:
Anthony Ramine 2017-09-26 01:53:40 +02:00
parent 577370746e
commit f87c2a8d76
291 changed files with 1774 additions and 1770 deletions

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding;
use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::Root;
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{WebGLExtension, WebGLExtensions};
@ -25,7 +25,7 @@ impl OESStandardDerivatives {
impl WebGLExtension for OESStandardDerivatives {
type Extension = OESStandardDerivatives;
fn new(ctx: &WebGLRenderingContext) -> Root<OESStandardDerivatives> {
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESStandardDerivatives> {
reflect_dom_object(box OESStandardDerivatives::new_inherited(),
&*ctx.global(),
OESStandardDerivativesBinding::Wrap)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::OESTextureFloatBinding;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::Root;
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions};
@ -24,7 +24,7 @@ impl OESTextureFloat {
impl WebGLExtension for OESTextureFloat {
type Extension = OESTextureFloat;
fn new(ctx: &WebGLRenderingContext) -> Root<OESTextureFloat> {
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureFloat> {
reflect_dom_object(box OESTextureFloat::new_inherited(),
&*ctx.global(),
OESTextureFloatBinding::Wrap)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::OESTextureFloatLinearBinding;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::Root;
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{constants as webgl, WebGLExtension, WebGLExtensions};
@ -24,7 +24,7 @@ impl OESTextureFloatLinear {
impl WebGLExtension for OESTextureFloatLinear {
type Extension = OESTextureFloatLinear;
fn new(ctx: &WebGLRenderingContext) -> Root<OESTextureFloatLinear> {
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureFloatLinear> {
reflect_dom_object(box OESTextureFloatLinear::new_inherited(),
&*ctx.global(),
OESTextureFloatLinearBinding::Wrap)

View file

@ -4,7 +4,7 @@
use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::{self, OESTextureHalfFloatConstants};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::Root;
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{constants as webgl, ext_constants as gl, WebGLExtension, WebGLExtensions};
@ -24,7 +24,7 @@ impl OESTextureHalfFloat {
impl WebGLExtension for OESTextureHalfFloat {
type Extension = OESTextureHalfFloat;
fn new(ctx: &WebGLRenderingContext) -> Root<OESTextureHalfFloat> {
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureHalfFloat> {
reflect_dom_object(box OESTextureHalfFloat::new_inherited(),
&*ctx.global(),
OESTextureHalfFloatBinding::Wrap)

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants;
use dom::bindings::codegen::Bindings::OESTextureHalfFloatLinearBinding;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::Root;
use dom::bindings::root::DomRoot;
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use super::{WebGLExtension, WebGLExtensions};
@ -25,7 +25,7 @@ impl OESTextureHalfFloatLinear {
impl WebGLExtension for OESTextureHalfFloatLinear {
type Extension = OESTextureHalfFloatLinear;
fn new(ctx: &WebGLRenderingContext) -> Root<OESTextureHalfFloatLinear> {
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureHalfFloatLinear> {
reflect_dom_object(box OESTextureHalfFloatLinear::new_inherited(),
&*ctx.global(),
OESTextureHalfFloatLinearBinding::Wrap)

View file

@ -6,7 +6,7 @@ use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError};
use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods};
use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::{Dom, MutNullableDom, Root};
use dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES;
use dom_struct::dom_struct;
@ -46,7 +46,7 @@ impl OESVertexArrayObject {
impl OESVertexArrayObjectMethods for OESVertexArrayObject {
// https://www.khronos.org/registry/webgl/extensions/OES_vertex_array_object/
fn CreateVertexArrayOES(&self) -> Option<Root<WebGLVertexArrayObjectOES>> {
fn CreateVertexArrayOES(&self) -> Option<DomRoot<WebGLVertexArrayObjectOES>> {
let (sender, receiver) = webgl_channel().unwrap();
self.ctx.send_command(WebGLCommand::CreateVertexArray(sender));
@ -132,7 +132,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject {
impl WebGLExtension for OESVertexArrayObject {
type Extension = OESVertexArrayObject;
fn new(ctx: &WebGLRenderingContext) -> Root<OESVertexArrayObject> {
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESVertexArrayObject> {
reflect_dom_object(box OESVertexArrayObject::new_inherited(ctx),
&*ctx.global(),
OESVertexArrayObjectBinding::Wrap)

View file

@ -8,7 +8,7 @@ use core::iter::FromIterator;
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::root::{Dom, MutNullableDom, Root};
use dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use dom::globalscope::GlobalScope;
use dom::webglbuffer::WebGLBuffer;
use dom::webglobject::WebGLObject;
@ -38,7 +38,7 @@ impl WebGLVertexArrayObjectOES {
}
}
pub fn new(global: &GlobalScope, id: WebGLVertexArrayId) -> Root<WebGLVertexArrayObjectOES> {
pub fn new(global: &GlobalScope, id: WebGLVertexArrayId) -> DomRoot<WebGLVertexArrayObjectOES> {
reflect_dom_object(box WebGLVertexArrayObjectOES::new_inherited(id),
global,
WebGLVertexArrayObjectOESBinding::Wrap)
@ -68,15 +68,15 @@ impl WebGLVertexArrayObjectOES {
self.bound_attrib_buffers.borrow()
}
pub fn bound_attrib_buffers(&self) -> Vec<Root<WebGLBuffer>> {
self.bound_attrib_buffers.borrow().iter().map(|(_, b)| Root::from_ref(&**b)).collect()
pub fn bound_attrib_buffers(&self) -> Vec<DomRoot<WebGLBuffer>> {
self.bound_attrib_buffers.borrow().iter().map(|(_, b)| DomRoot::from_ref(&**b)).collect()
}
pub fn set_bound_attrib_buffers<'a, T>(&self, iter: T) where T: Iterator<Item=(u32, &'a WebGLBuffer)> {
*self.bound_attrib_buffers.borrow_mut() = HashMap::from_iter(iter.map(|(k,v)| (k, Dom::from_ref(v))));
}
pub fn bound_buffer_element_array(&self) -> Option<Root<WebGLBuffer>> {
pub fn bound_buffer_element_array(&self) -> Option<DomRoot<WebGLBuffer>> {
self.bound_buffer_element_array.get()
}