mirror of
https://github.com/servo/servo
synced 2026-05-05 06:32:13 +02:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user