Remove use of unstable box syntax.

http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
This commit is contained in:
Simon Sapin 2017-10-16 14:35:30 +02:00
parent a5100e3c78
commit aa15dc269f
270 changed files with 580 additions and 514 deletions

View file

@ -26,7 +26,7 @@ impl OESStandardDerivatives {
impl WebGLExtension for OESStandardDerivatives {
type Extension = OESStandardDerivatives;
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESStandardDerivatives> {
reflect_dom_object(box OESStandardDerivatives::new_inherited(),
reflect_dom_object(Box::new(OESStandardDerivatives::new_inherited()),
&*ctx.global(),
OESStandardDerivativesBinding::Wrap)
}

View file

@ -25,7 +25,7 @@ impl OESTextureFloat {
impl WebGLExtension for OESTextureFloat {
type Extension = OESTextureFloat;
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureFloat> {
reflect_dom_object(box OESTextureFloat::new_inherited(),
reflect_dom_object(Box::new(OESTextureFloat::new_inherited()),
&*ctx.global(),
OESTextureFloatBinding::Wrap)
}

View file

@ -25,7 +25,7 @@ impl OESTextureFloatLinear {
impl WebGLExtension for OESTextureFloatLinear {
type Extension = OESTextureFloatLinear;
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureFloatLinear> {
reflect_dom_object(box OESTextureFloatLinear::new_inherited(),
reflect_dom_object(Box::new(OESTextureFloatLinear::new_inherited()),
&*ctx.global(),
OESTextureFloatLinearBinding::Wrap)
}

View file

@ -25,7 +25,7 @@ impl OESTextureHalfFloat {
impl WebGLExtension for OESTextureHalfFloat {
type Extension = OESTextureHalfFloat;
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureHalfFloat> {
reflect_dom_object(box OESTextureHalfFloat::new_inherited(),
reflect_dom_object(Box::new(OESTextureHalfFloat::new_inherited()),
&*ctx.global(),
OESTextureHalfFloatBinding::Wrap)
}

View file

@ -26,7 +26,7 @@ impl OESTextureHalfFloatLinear {
impl WebGLExtension for OESTextureHalfFloatLinear {
type Extension = OESTextureHalfFloatLinear;
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESTextureHalfFloatLinear> {
reflect_dom_object(box OESTextureHalfFloatLinear::new_inherited(),
reflect_dom_object(Box::new(OESTextureHalfFloatLinear::new_inherited()),
&*ctx.global(),
OESTextureHalfFloatLinearBinding::Wrap)
}

View file

@ -133,7 +133,7 @@ impl OESVertexArrayObjectMethods for OESVertexArrayObject {
impl WebGLExtension for OESVertexArrayObject {
type Extension = OESVertexArrayObject;
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESVertexArrayObject> {
reflect_dom_object(box OESVertexArrayObject::new_inherited(ctx),
reflect_dom_object(Box::new(OESVertexArrayObject::new_inherited(ctx)),
&*ctx.global(),
OESVertexArrayObjectBinding::Wrap)
}

View file

@ -39,7 +39,7 @@ impl WebGLVertexArrayObjectOES {
}
pub fn new(global: &GlobalScope, id: WebGLVertexArrayId) -> DomRoot<WebGLVertexArrayObjectOES> {
reflect_dom_object(box WebGLVertexArrayObjectOES::new_inherited(id),
reflect_dom_object(Box::new(WebGLVertexArrayObjectOES::new_inherited(id)),
global,
WebGLVertexArrayObjectOESBinding::Wrap)
}

View file

@ -99,7 +99,7 @@ impl WebGLExtensions {
pub fn register<T:'static + WebGLExtension + JSTraceable + HeapSizeOf>(&self) {
let name = T::name().to_uppercase();
self.extensions.borrow_mut().insert(name, box TypedWebGLExtensionWrapper::<T>::new());
self.extensions.borrow_mut().insert(name, Box::new(TypedWebGLExtensionWrapper::<T>::new()));
}
pub fn get_suported_extensions(&self) -> Vec<&'static str> {