Back out changeset 63d194784378 (bug 1002281) for b2g build bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 13 Nov 2014 21:51:22 -0800
changeset 215711 dbaf57dec1a3ab6cde5a7ef64a6fbbf2cc4b060a
parent 215710 e299958f1fd53a3debe4386d5666f76300ec21a3
child 215712 d75aafdbe1a6db60ae5312dd8cd5bf014bb5c79e
push id27823
push usercbook@mozilla.com
push dateFri, 14 Nov 2014 11:59:57 +0000
treeherdermozilla-central@bbb68df450c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1002281
milestone36.0a1
backs out63d19478437854b2c9807e963498259dce373bc2
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out changeset 63d194784378 (bug 1002281) for b2g build bustage CLOSED TREE
dom/canvas/WebGLBindableName.h
dom/canvas/WebGLBuffer.cpp
dom/canvas/WebGLBuffer.h
dom/canvas/WebGLContextBuffers.cpp
dom/canvas/WebGLContextGL.cpp
dom/canvas/WebGLFramebuffer.cpp
dom/canvas/WebGLFramebuffer.h
dom/canvas/WebGLRenderbuffer.cpp
dom/canvas/WebGLRenderbuffer.h
dom/canvas/WebGLSampler.cpp
dom/canvas/WebGLTexture.cpp
dom/canvas/WebGLTexture.h
dom/canvas/WebGLTransformFeedback.cpp
dom/canvas/WebGLVertexArray.cpp
dom/canvas/WebGLVertexArray.h
--- a/dom/canvas/WebGLBindableName.h
+++ b/dom/canvas/WebGLBindableName.h
@@ -9,62 +9,50 @@
 #include "WebGLTypes.h"
 
 #include "GLDefs.h"
 #include "mozilla/TypeTraits.h"
 #include "mozilla/Assertions.h"
 
 namespace mozilla {
 
-/** Represents a binding to a GL binding point
+/** Represents a GL name that can be bound to a target.
  */
 template<typename T>
-class WebGLBindable
+class WebGLBindableName
 {
 public:
-    WebGLBindable() : mTarget(LOCAL_GL_NONE) { }
-    bool HasEverBeenBound() const { return mTarget != LOCAL_GL_NONE; }
 
-    void BindTo(T target) {
+    WebGLBindableName()
+        : mGLName(0)
+        , mTarget(LOCAL_GL_NONE)
+    { }
+
+    void BindTo(T target)
+    {
         MOZ_ASSERT(target != LOCAL_GL_NONE, "Can't bind to GL_NONE.");
         MOZ_ASSERT(!HasEverBeenBound() || mTarget == target, "Rebinding is illegal.");
 
         bool targetChanged = (target != mTarget);
         mTarget = target;
         if (targetChanged)
             OnTargetChanged();
     }
 
+    bool HasEverBeenBound() const { return mTarget != LOCAL_GL_NONE; }
+    GLuint GLName() const { return mGLName; }
     T Target() const {
         MOZ_ASSERT(HasEverBeenBound());
         return mTarget;
     }
 
 protected:
+
     //! Called after mTarget has been changed by BindTo(target).
     virtual void OnTargetChanged() {}
 
+    GLuint mGLName;
     T mTarget;
 };
 
-
-/** Represents a GL name that can be bound to a target.
- */
-template<typename T>
-class WebGLBindableName
-    : public WebGLBindable<T>
-{
-public:
-
-    WebGLBindableName(GLuint name)
-        : WebGLBindable<T>()
-        , mGLName(name)
-    { }
-    GLuint GLName() const { return mGLName; }
-
-protected:
-    const GLuint mGLName;
-};
-
-
 } // namespace mozilla
 
 #endif // !WEBGLBINDABLENAME_H_
--- a/dom/canvas/WebGLBuffer.cpp
+++ b/dom/canvas/WebGLBuffer.cpp
@@ -7,21 +7,23 @@
 
 #include "GLContext.h"
 #include "mozilla/dom/WebGLRenderingContextBinding.h"
 #include "WebGLContext.h"
 #include "WebGLElementArrayCache.h"
 
 using namespace mozilla;
 
-WebGLBuffer::WebGLBuffer(WebGLContext* context, GLuint buf)
-    : WebGLBindableName<BufferBinding>(buf)
+WebGLBuffer::WebGLBuffer(WebGLContext *context)
+    : WebGLBindableName<BufferBinding>()
     , WebGLContextBoundObject(context)
     , mByteLength(0)
 {
+    mContext->MakeContextCurrent();
+    mContext->gl->fGenBuffers(1, &mGLName);
     mContext->mBuffers.insertBack(this);
 }
 
 WebGLBuffer::~WebGLBuffer() {
     DeleteOnce();
 }
 
 void
--- a/dom/canvas/WebGLBuffer.h
+++ b/dom/canvas/WebGLBuffer.h
@@ -22,17 +22,17 @@ class WebGLElementArrayCache;
 class WebGLBuffer MOZ_FINAL
     : public nsWrapperCache
     , public WebGLBindableName<BufferBinding>
     , public WebGLRefCountedObject<WebGLBuffer>
     , public LinkedListElement<WebGLBuffer>
     , public WebGLContextBoundObject
 {
 public:
-    explicit WebGLBuffer(WebGLContext* context, GLuint buf);
+    explicit WebGLBuffer(WebGLContext* aContext);
 
     void Delete();
 
     size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
     WebGLsizeiptr ByteLength() const { return mByteLength; }
 
     void SetByteLength(WebGLsizeiptr byteLength) { mByteLength = byteLength; }
--- a/dom/canvas/WebGLContextBuffers.cpp
+++ b/dom/canvas/WebGLContextBuffers.cpp
@@ -356,21 +356,17 @@ WebGLContext::BufferSubData(GLenum targe
 }
 
 already_AddRefed<WebGLBuffer>
 WebGLContext::CreateBuffer()
 {
     if (IsContextLost())
         return nullptr;
 
-    GLuint buf = 0;
-    MakeContextCurrent();
-    gl->fGenBuffers(1, &buf);
-
-    nsRefPtr<WebGLBuffer> globj = new WebGLBuffer(this, buf);
+    nsRefPtr<WebGLBuffer> globj = new WebGLBuffer(this);
     return globj.forget();
 }
 
 void
 WebGLContext::DeleteBuffer(WebGLBuffer *buffer)
 {
     if (IsContextLost())
         return;
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1367,22 +1367,17 @@ WebGLContext::GetRenderbufferParameter(G
     return JS::NullValue();
 }
 
 already_AddRefed<WebGLTexture>
 WebGLContext::CreateTexture()
 {
     if (IsContextLost())
         return nullptr;
-
-    GLuint tex = 0;
-    MakeContextCurrent();
-    gl->fGenTextures(1, &tex);
-
-    nsRefPtr<WebGLTexture> globj = new WebGLTexture(this, tex);
+    nsRefPtr<WebGLTexture> globj = new WebGLTexture(this);
     return globj.forget();
 }
 
 static GLenum
 GetAndClearError(GLenum* errorVar)
 {
     MOZ_ASSERT(errorVar);
     GLenum ret = *errorVar;
@@ -3098,22 +3093,17 @@ WebGLContext::ValidateProgram(WebGLProgr
     gl->fValidateProgram(progname);
 }
 
 already_AddRefed<WebGLFramebuffer>
 WebGLContext::CreateFramebuffer()
 {
     if (IsContextLost())
         return nullptr;
-
-    GLuint fbo = 0;
-    MakeContextCurrent();
-    gl->fGenFramebuffers(1, &fbo);
-
-    nsRefPtr<WebGLFramebuffer> globj = new WebGLFramebuffer(this, fbo);
+    nsRefPtr<WebGLFramebuffer> globj = new WebGLFramebuffer(this);
     return globj.forget();
 }
 
 already_AddRefed<WebGLRenderbuffer>
 WebGLContext::CreateRenderbuffer()
 {
     if (IsContextLost())
         return nullptr;
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -21,24 +21,26 @@ using namespace mozilla;
 using namespace mozilla::gl;
 
 JSObject*
 WebGLFramebuffer::WrapObject(JSContext* cx)
 {
     return dom::WebGLFramebufferBinding::Wrap(cx, this);
 }
 
-WebGLFramebuffer::WebGLFramebuffer(WebGLContext* context, GLuint fbo)
-    : WebGLBindableName<FBTarget>(fbo)
+WebGLFramebuffer::WebGLFramebuffer(WebGLContext* context)
+    : WebGLBindableName<FBTarget>()
     , WebGLContextBoundObject(context)
     , mStatus(0)
     , mDepthAttachment(LOCAL_GL_DEPTH_ATTACHMENT)
     , mStencilAttachment(LOCAL_GL_STENCIL_ATTACHMENT)
     , mDepthStencilAttachment(LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
 {
+    mContext->MakeContextCurrent();
+    mContext->gl->fGenFramebuffers(1, &mGLName);
     mContext->mFramebuffers.insertBack(this);
 
     mColorAttachments.SetLength(1);
     mColorAttachments[0].mAttachmentPoint = LOCAL_GL_COLOR_ATTACHMENT0;
 }
 
 WebGLFramebuffer::Attachment::Attachment(FBAttachment aAttachmentPoint)
     : mAttachmentPoint(aAttachmentPoint)
--- a/dom/canvas/WebGLFramebuffer.h
+++ b/dom/canvas/WebGLFramebuffer.h
@@ -29,17 +29,17 @@ class WebGLFramebuffer MOZ_FINAL
     , public WebGLRefCountedObject<WebGLFramebuffer>
     , public LinkedListElement<WebGLFramebuffer>
     , public WebGLContextBoundObject
     , public SupportsWeakPtr<WebGLFramebuffer>
 {
 public:
     MOZ_DECLARE_REFCOUNTED_TYPENAME(WebGLFramebuffer)
 
-    explicit WebGLFramebuffer(WebGLContext* context, GLuint fbo);
+    explicit WebGLFramebuffer(WebGLContext* context);
 
     struct Attachment
     {
         // deleting a texture or renderbuffer immediately detaches it
         WebGLRefPtr<WebGLTexture> mTexturePtr;
         WebGLRefPtr<WebGLRenderbuffer> mRenderbufferPtr;
         FBAttachment mAttachmentPoint;
         TexImageTarget mTexImageTarget;
--- a/dom/canvas/WebGLRenderbuffer.cpp
+++ b/dom/canvas/WebGLRenderbuffer.cpp
@@ -37,18 +37,18 @@ NeedsDepthStencilEmu(GLContext* gl, GLen
     return !SupportsDepthStencil(gl);
 }
 
 JSObject*
 WebGLRenderbuffer::WrapObject(JSContext *cx) {
     return dom::WebGLRenderbufferBinding::Wrap(cx, this);
 }
 
-WebGLRenderbuffer::WebGLRenderbuffer(WebGLContext* context)
-    : WebGLBindable<RBTarget>()
+WebGLRenderbuffer::WebGLRenderbuffer(WebGLContext *context)
+    : WebGLBindableName<RBTarget>()
     , WebGLContextBoundObject(context)
     , mPrimaryRB(0)
     , mSecondaryRB(0)
     , mInternalFormat(0)
     , mInternalFormatForGL(0)
     , mImageDataStatus(WebGLImageDataStatus::NoImageData)
 {
     mContext->MakeContextCurrent();
--- a/dom/canvas/WebGLRenderbuffer.h
+++ b/dom/canvas/WebGLRenderbuffer.h
@@ -13,17 +13,17 @@
 #include "nsWrapperCache.h"
 
 #include "mozilla/LinkedList.h"
 
 namespace mozilla {
 
 class WebGLRenderbuffer MOZ_FINAL
     : public nsWrapperCache
-    , public WebGLBindable<RBTarget>
+    , public WebGLBindableName<RBTarget>
     , public WebGLRefCountedObject<WebGLRenderbuffer>
     , public LinkedListElement<WebGLRenderbuffer>
     , public WebGLRectangleObject
     , public WebGLContextBoundObject
     , public WebGLFramebufferAttachable
 {
 public:
     explicit WebGLRenderbuffer(WebGLContext* context);
--- a/dom/canvas/WebGLSampler.cpp
+++ b/dom/canvas/WebGLSampler.cpp
@@ -8,18 +8,17 @@
 
 #include "GLContext.h"
 
 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
 
 using namespace mozilla;
 
 WebGLSampler::WebGLSampler(WebGLContext* context)
-    : WebGLBindableName(0),
-      WebGLContextBoundObject(context)
+    : WebGLContextBoundObject(context)
 {
     MOZ_CRASH("Not Implemented.");
 }
 
 WebGLSampler::~WebGLSampler()
 {}
 
 void
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -14,35 +14,37 @@
 #include "WebGLTexelConversions.h"
 
 #include <algorithm>
 #include "mozilla/MathAlgorithms.h"
 
 using namespace mozilla;
 
 JSObject*
-WebGLTexture::WrapObject(JSContext* cx) {
+WebGLTexture::WrapObject(JSContext *cx) {
     return dom::WebGLTextureBinding::Wrap(cx, this);
 }
 
-WebGLTexture::WebGLTexture(WebGLContext* context, GLuint tex)
-    : WebGLBindableName<TexTarget>(tex)
+WebGLTexture::WebGLTexture(WebGLContext *context)
+    : WebGLBindableName<TexTarget>()
     , WebGLContextBoundObject(context)
     , mMinFilter(LOCAL_GL_NEAREST_MIPMAP_LINEAR)
     , mMagFilter(LOCAL_GL_LINEAR)
     , mWrapS(LOCAL_GL_REPEAT)
     , mWrapT(LOCAL_GL_REPEAT)
     , mFacesCount(0)
     , mMaxLevelWithCustomImages(0)
     , mHaveGeneratedMipmap(false)
     , mImmutable(false)
     , mBaseMipmapLevel(0)
     , mMaxMipmapLevel(1000)
     , mFakeBlackStatus(WebGLTextureFakeBlackStatus::IncompleteTexture)
 {
+    mContext->MakeContextCurrent();
+    mContext->gl->fGenTextures(1, &mGLName);
     mContext->mTextures.insertBack(this);
 }
 
 void
 WebGLTexture::Delete() {
     mImageInfos.Clear();
     mContext->MakeContextCurrent();
     mContext->gl->fDeleteTextures(1, &mGLName);
--- a/dom/canvas/WebGLTexture.h
+++ b/dom/canvas/WebGLTexture.h
@@ -33,17 +33,17 @@ class WebGLTexture MOZ_FINAL
     : public nsWrapperCache
     , public WebGLBindableName<TexTarget>
     , public WebGLRefCountedObject<WebGLTexture>
     , public LinkedListElement<WebGLTexture>
     , public WebGLContextBoundObject
     , public WebGLFramebufferAttachable
 {
 public:
-    explicit WebGLTexture(WebGLContext* aContext, GLuint tex);
+    explicit WebGLTexture(WebGLContext* aContext);
 
     void Delete();
 
     WebGLContext *GetParentObject() const {
         return Context();
     }
 
     virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
--- a/dom/canvas/WebGLTransformFeedback.cpp
+++ b/dom/canvas/WebGLTransformFeedback.cpp
@@ -8,18 +8,17 @@
 
 #include "GLContext.h"
 
 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
 
 using namespace mozilla;
 
 WebGLTransformFeedback::WebGLTransformFeedback(WebGLContext* context)
-    : WebGLBindableName(0)
-    , WebGLContextBoundObject(context)
+    : WebGLContextBoundObject(context)
 {
     MOZ_CRASH("Not Implemented.");
 }
 
 WebGLTransformFeedback::~WebGLTransformFeedback()
 {}
 
 void
--- a/dom/canvas/WebGLVertexArray.cpp
+++ b/dom/canvas/WebGLVertexArray.cpp
@@ -15,19 +15,18 @@
 using namespace mozilla;
 
 JSObject*
 WebGLVertexArray::WrapObject(JSContext *cx) {
     return dom::WebGLVertexArrayBinding::Wrap(cx, this);
 }
 
 WebGLVertexArray::WebGLVertexArray(WebGLContext* context)
-    : WebGLBindable<VAOBinding>()
+    : WebGLBindableName<VAOBinding>()
     , WebGLContextBoundObject(context)
-    , mGLName(0)
 {
     context->mVertexArrays.insertBack(this);
 }
 
 WebGLVertexArray*
 WebGLVertexArray::Create(WebGLContext* context)
 {
     WebGLVertexArray* array;
--- a/dom/canvas/WebGLVertexArray.h
+++ b/dom/canvas/WebGLVertexArray.h
@@ -17,17 +17,17 @@
 #include "mozilla/LinkedList.h"
 
 namespace mozilla {
 
 class WebGLVertexArrayFake;
 
 class WebGLVertexArray
     : public nsWrapperCache
-    , public WebGLBindable<VAOBinding>
+    , public WebGLBindableName<VAOBinding>
     , public WebGLRefCountedObject<WebGLVertexArray>
     , public LinkedListElement<WebGLVertexArray>
     , public WebGLContextBoundObject
 {
 // -----------------------------------------------------------------------------
 // PUBLIC
 public:
     static WebGLVertexArray* Create(WebGLContext* context);
@@ -56,18 +56,16 @@ public:
     virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
 
     NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLVertexArray)
     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLVertexArray)
 
     // -------------------------------------------------------------------------
     // MEMBER FUNCTIONS
 
-    GLuint GLName() const { return mGLName; }
-
     void EnsureAttrib(GLuint index);
     bool HasAttrib(GLuint index) {
         return index < mAttribs.Length();
     }
     bool IsAttribArrayEnabled(GLuint index) {
         return HasAttrib(index) && mAttribs[index].enabled;
     }
 
@@ -79,17 +77,16 @@ protected:
 
     virtual ~WebGLVertexArray() {
         MOZ_ASSERT(IsDeleted());
     };
 
     // -------------------------------------------------------------------------
     // MEMBERS
 
-    GLuint mGLName;
     nsTArray<WebGLVertexAttribData> mAttribs;
     WebGLRefPtr<WebGLBuffer> mElementArrayBuffer;
 
     // -------------------------------------------------------------------------
     // FRIENDSHIPS
 
     friend class WebGLVertexArrayFake;
     friend class WebGLContext;