From 2b23d44aa089a67f414ac06c2991349f694a41fe Mon Sep 17 00:00:00 2001 From: Andrew Quartey Date: Thu, 29 Aug 2013 11:39:17 -0400 Subject: [PATCH] Bug 811371 - Drop nsISupports inheritance on WebGL object classes. r=bjacob --- content/canvas/src/WebGLActiveInfo.cpp | 7 ------- content/canvas/src/WebGLActiveInfo.h | 3 +-- content/canvas/src/WebGLBuffer.cpp | 9 ++------- content/canvas/src/WebGLBuffer.h | 7 +++---- content/canvas/src/WebGLFramebuffer.cpp | 17 +++++++---------- content/canvas/src/WebGLFramebuffer.h | 7 +++---- content/canvas/src/WebGLObjectModel.h | 3 +-- content/canvas/src/WebGLProgram.cpp | 9 ++------- content/canvas/src/WebGLProgram.h | 7 +++---- content/canvas/src/WebGLRenderbuffer.cpp | 9 ++------- content/canvas/src/WebGLRenderbuffer.h | 7 +++---- content/canvas/src/WebGLShader.cpp | 9 ++------- content/canvas/src/WebGLShader.h | 7 +++---- .../canvas/src/WebGLShaderPrecisionFormat.cpp | 7 ------- content/canvas/src/WebGLShaderPrecisionFormat.h | 7 +++---- content/canvas/src/WebGLTexture.cpp | 9 ++------- content/canvas/src/WebGLTexture.h | 7 +++---- content/canvas/src/WebGLUniformLocation.cpp | 8 ++------ content/canvas/src/WebGLUniformLocation.h | 7 +++---- content/canvas/src/WebGLVertexAttribData.h | 3 +-- 20 files changed, 46 insertions(+), 103 deletions(-) diff --git a/content/canvas/src/WebGLActiveInfo.cpp b/content/canvas/src/WebGLActiveInfo.cpp index fe402dabf22..bf0cd68fd8f 100644 --- a/content/canvas/src/WebGLActiveInfo.cpp +++ b/content/canvas/src/WebGLActiveInfo.cpp @@ -13,10 +13,3 @@ JSObject* WebGLActiveInfo::WrapObject(JSContext *cx, JS::Handle scope) { return dom::WebGLActiveInfoBinding::Wrap(cx, scope, this); } - -NS_IMPL_ADDREF(WebGLActiveInfo) -NS_IMPL_RELEASE(WebGLActiveInfo) - -NS_INTERFACE_MAP_BEGIN(WebGLActiveInfo) - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END diff --git a/content/canvas/src/WebGLActiveInfo.h b/content/canvas/src/WebGLActiveInfo.h index 191e2228bed..fe24079669f 100644 --- a/content/canvas/src/WebGLActiveInfo.h +++ b/content/canvas/src/WebGLActiveInfo.h @@ -19,7 +19,6 @@ template class Handle; namespace mozilla { class WebGLActiveInfo MOZ_FINAL - : public nsISupports { public: WebGLActiveInfo(WebGLint size, WebGLenum type, const nsACString& name) : @@ -44,7 +43,7 @@ public: JSObject* WrapObject(JSContext *cx, JS::Handle scope); - NS_DECL_ISUPPORTS + NS_INLINE_DECL_REFCOUNTING(WebGLActiveInfo) protected: WebGLint mSize; diff --git a/content/canvas/src/WebGLBuffer.cpp b/content/canvas/src/WebGLBuffer.cpp index 5aa392a4508..815087b810e 100644 --- a/content/canvas/src/WebGLBuffer.cpp +++ b/content/canvas/src/WebGLBuffer.cpp @@ -61,10 +61,5 @@ WebGLBuffer::WrapObject(JSContext *cx, JS::Handle scope) { NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLBuffer) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLBuffer) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLBuffer) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLBuffer) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLBuffer, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLBuffer, Release) diff --git a/content/canvas/src/WebGLBuffer.h b/content/canvas/src/WebGLBuffer.h index cd4060dcb27..5b5833f8a73 100644 --- a/content/canvas/src/WebGLBuffer.h +++ b/content/canvas/src/WebGLBuffer.h @@ -20,11 +20,10 @@ namespace mozilla { class WebGLElementArrayCache; class WebGLBuffer MOZ_FINAL - : public nsISupports + : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement , public WebGLContextBoundObject - , public nsWrapperCache { public: WebGLBuffer(WebGLContext *context); @@ -63,8 +62,8 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle scope) MOZ_OVERRIDE; - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLBuffer) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLBuffer) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLBuffer) protected: diff --git a/content/canvas/src/WebGLFramebuffer.cpp b/content/canvas/src/WebGLFramebuffer.cpp index ac83ba6deeb..996854eed3e 100644 --- a/content/canvas/src/WebGLFramebuffer.cpp +++ b/content/canvas/src/WebGLFramebuffer.cpp @@ -532,9 +532,11 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - CycleCollectionNoteEdgeName(aCallback, aName, aFlags); - aCallback.NoteXPCOMChild(aField.mTexturePtr); - aCallback.NoteXPCOMChild(aField.mRenderbufferPtr); + CycleCollectionNoteChild(aCallback, aField.mTexturePtr.get(), + aName, aFlags); + + CycleCollectionNoteChild(aCallback, aField.mRenderbufferPtr.get(), + aName, aFlags); } NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_7(WebGLFramebuffer, @@ -546,10 +548,5 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_7(WebGLFramebuffer, mDepthStencilAttachment.mTexturePtr, mDepthStencilAttachment.mRenderbufferPtr) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLFramebuffer) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLFramebuffer) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLFramebuffer) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLFramebuffer, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLFramebuffer, Release) diff --git a/content/canvas/src/WebGLFramebuffer.h b/content/canvas/src/WebGLFramebuffer.h index 9f3d3d1b208..d627acf6841 100644 --- a/content/canvas/src/WebGLFramebuffer.h +++ b/content/canvas/src/WebGLFramebuffer.h @@ -18,11 +18,10 @@ class WebGLTexture; class WebGLRenderbuffer; class WebGLFramebuffer MOZ_FINAL - : public nsISupports + : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement , public WebGLContextBoundObject - , public nsWrapperCache { public: WebGLFramebuffer(WebGLContext *context); @@ -149,8 +148,8 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle scope) MOZ_OVERRIDE; - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLFramebuffer) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLFramebuffer) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLFramebuffer) bool CheckAndInitializeRenderbuffers(); diff --git a/content/canvas/src/WebGLObjectModel.h b/content/canvas/src/WebGLObjectModel.h index 2c05b8b31e2..a4cd7c59492 100644 --- a/content/canvas/src/WebGLObjectModel.h +++ b/content/canvas/src/WebGLObjectModel.h @@ -329,8 +329,7 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - CycleCollectionNoteEdgeName(aCallback, aName, aFlags); - aCallback.NoteXPCOMChild(aField); + CycleCollectionNoteChild(aCallback, aField.get(), aName, aFlags); } #endif diff --git a/content/canvas/src/WebGLProgram.cpp b/content/canvas/src/WebGLProgram.cpp index 028c588cb9f..98893d7c594 100644 --- a/content/canvas/src/WebGLProgram.cpp +++ b/content/canvas/src/WebGLProgram.cpp @@ -245,10 +245,5 @@ WebGLProgram::GetUniformInfoForMappedIdentifier(const nsACString& name) { NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(WebGLProgram, mAttachedShaders) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLProgram) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLProgram) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLProgram) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLProgram, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLProgram, Release) diff --git a/content/canvas/src/WebGLProgram.h b/content/canvas/src/WebGLProgram.h index 0d6a5c8901f..a03f7a7311d 100644 --- a/content/canvas/src/WebGLProgram.h +++ b/content/canvas/src/WebGLProgram.h @@ -22,11 +22,10 @@ typedef nsDataHashtable CStringMap; typedef nsDataHashtable CStringToUniformInfoMap; class WebGLProgram MOZ_FINAL - : public nsISupports + : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement , public WebGLContextBoundObject - , public nsWrapperCache { public: WebGLProgram(WebGLContext *context); @@ -107,8 +106,8 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle scope) MOZ_OVERRIDE; - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLProgram) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLProgram) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLProgram) // public post-link data std::map mActiveAttribMap; diff --git a/content/canvas/src/WebGLRenderbuffer.cpp b/content/canvas/src/WebGLRenderbuffer.cpp index f3c86866486..dc9e595300b 100644 --- a/content/canvas/src/WebGLRenderbuffer.cpp +++ b/content/canvas/src/WebGLRenderbuffer.cpp @@ -67,10 +67,5 @@ WebGLRenderbuffer::MemoryUsage() const { NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLRenderbuffer) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLRenderbuffer) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLRenderbuffer) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLRenderbuffer) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLRenderbuffer, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLRenderbuffer, Release) diff --git a/content/canvas/src/WebGLRenderbuffer.h b/content/canvas/src/WebGLRenderbuffer.h index b93ccf9d424..f18a8de2fce 100644 --- a/content/canvas/src/WebGLRenderbuffer.h +++ b/content/canvas/src/WebGLRenderbuffer.h @@ -15,12 +15,11 @@ namespace mozilla { class WebGLRenderbuffer MOZ_FINAL - : public nsISupports + : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement , public WebGLRectangleObject , public WebGLContextBoundObject - , public nsWrapperCache { public: WebGLRenderbuffer(WebGLContext *context); @@ -53,8 +52,8 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle scope) MOZ_OVERRIDE; - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLRenderbuffer) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLRenderbuffer) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLRenderbuffer) protected: diff --git a/content/canvas/src/WebGLShader.cpp b/content/canvas/src/WebGLShader.cpp index cebeff59023..2dc4d4c91b2 100644 --- a/content/canvas/src/WebGLShader.cpp +++ b/content/canvas/src/WebGLShader.cpp @@ -53,10 +53,5 @@ WebGLShader::SetTranslationSuccess() { NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLShader) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLShader) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLShader) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLShader) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLShader, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLShader, Release) diff --git a/content/canvas/src/WebGLShader.h b/content/canvas/src/WebGLShader.h index fb6ce919d20..e8cdec9d8aa 100644 --- a/content/canvas/src/WebGLShader.h +++ b/content/canvas/src/WebGLShader.h @@ -24,11 +24,10 @@ struct WebGLMappedIdentifier { }; class WebGLShader MOZ_FINAL - : public nsISupports + : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement , public WebGLContextBoundObject - , public nsWrapperCache { friend class WebGLContext; friend class WebGLProgram; @@ -80,8 +79,8 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle scope) MOZ_OVERRIDE; - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLShader) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLShader) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLShader) protected: diff --git a/content/canvas/src/WebGLShaderPrecisionFormat.cpp b/content/canvas/src/WebGLShaderPrecisionFormat.cpp index 7d116a5ca9f..36f8c18cffe 100644 --- a/content/canvas/src/WebGLShaderPrecisionFormat.cpp +++ b/content/canvas/src/WebGLShaderPrecisionFormat.cpp @@ -9,13 +9,6 @@ using namespace mozilla; -NS_INTERFACE_MAP_BEGIN(WebGLShaderPrecisionFormat) - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END - -NS_IMPL_ADDREF(WebGLShaderPrecisionFormat) -NS_IMPL_RELEASE(WebGLShaderPrecisionFormat) - JSObject* WebGLShaderPrecisionFormat::WrapObject(JSContext *cx, JS::Handle scope) { diff --git a/content/canvas/src/WebGLShaderPrecisionFormat.h b/content/canvas/src/WebGLShaderPrecisionFormat.h index 25d8cafee98..016c4aa770f 100644 --- a/content/canvas/src/WebGLShaderPrecisionFormat.h +++ b/content/canvas/src/WebGLShaderPrecisionFormat.h @@ -13,8 +13,7 @@ namespace mozilla { class WebGLBuffer; class WebGLShaderPrecisionFormat MOZ_FINAL - : public nsISupports - , public WebGLContextBoundObject + : public WebGLContextBoundObject { public: WebGLShaderPrecisionFormat(WebGLContext *context, WebGLint rangeMin, WebGLint rangeMax, WebGLint precision) : @@ -27,8 +26,6 @@ public: JSObject* WrapObject(JSContext *cx, JS::Handle scope); - NS_DECL_ISUPPORTS - // WebIDL WebGLShaderPrecisionFormat API WebGLint RangeMin() const { return mRangeMin; @@ -40,6 +37,8 @@ public: return mPrecision; } + NS_INLINE_DECL_REFCOUNTING(WebGLShaderPrecisionFormat) + protected: WebGLint mRangeMin; WebGLint mRangeMax; diff --git a/content/canvas/src/WebGLTexture.cpp b/content/canvas/src/WebGLTexture.cpp index 2c72af81774..1f23096eeea 100644 --- a/content/canvas/src/WebGLTexture.cpp +++ b/content/canvas/src/WebGLTexture.cpp @@ -360,10 +360,5 @@ WebGLTexture::NeedFakeBlack() { NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLTexture) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLTexture) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLTexture) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLTexture) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLTexture, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLTexture, Release) diff --git a/content/canvas/src/WebGLTexture.h b/content/canvas/src/WebGLTexture.h index 64fd1f867ef..e4a29d5415e 100644 --- a/content/canvas/src/WebGLTexture.h +++ b/content/canvas/src/WebGLTexture.h @@ -24,11 +24,10 @@ inline bool is_pot_assuming_nonnegative(WebGLsizei x) // NOTE: When this class is switched to new DOM bindings, update the (then-slow) // WrapObject calls in GetParameter and GetFramebufferAttachmentParameter. class WebGLTexture MOZ_FINAL - : public nsISupports + : public nsWrapperCache , public WebGLRefCountedObject , public LinkedListElement , public WebGLContextBoundObject - , public nsWrapperCache { public: WebGLTexture(WebGLContext *context); @@ -51,8 +50,8 @@ public: virtual JSObject* WrapObject(JSContext *cx, JS::Handle scope) MOZ_OVERRIDE; - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLTexture) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLTexture) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLTexture) protected: diff --git a/content/canvas/src/WebGLUniformLocation.cpp b/content/canvas/src/WebGLUniformLocation.cpp index 976f13432a9..38f0f754809 100644 --- a/content/canvas/src/WebGLUniformLocation.cpp +++ b/content/canvas/src/WebGLUniformLocation.cpp @@ -29,9 +29,5 @@ WebGLUniformLocation::WebGLUniformLocation(WebGLContext *context, WebGLProgram * NS_IMPL_CYCLE_COLLECTION_1(WebGLUniformLocation, mProgram) -NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLUniformLocation) -NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLUniformLocation) - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLUniformLocation) - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLUniformLocation, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLUniformLocation, Release) diff --git a/content/canvas/src/WebGLUniformLocation.h b/content/canvas/src/WebGLUniformLocation.h index 9ab71d1b463..7f34bb9573a 100644 --- a/content/canvas/src/WebGLUniformLocation.h +++ b/content/canvas/src/WebGLUniformLocation.h @@ -14,8 +14,7 @@ namespace mozilla { class WebGLProgram; class WebGLUniformLocation MOZ_FINAL - : public nsISupports - , public WebGLContextBoundObject + : public WebGLContextBoundObject { public: WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info); @@ -36,8 +35,8 @@ public: JSObject* WrapObject(JSContext *cx, JS::Handle scope); - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(WebGLUniformLocation) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation) + NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(WebGLUniformLocation) protected: // nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted. diff --git a/content/canvas/src/WebGLVertexAttribData.h b/content/canvas/src/WebGLVertexAttribData.h index b2d9f1b9719..16d175fb2d9 100644 --- a/content/canvas/src/WebGLVertexAttribData.h +++ b/content/canvas/src/WebGLVertexAttribData.h @@ -75,8 +75,7 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, const char* aName, uint32_t aFlags = 0) { - CycleCollectionNoteEdgeName(aCallback, aName, aFlags); - aCallback.NoteXPCOMChild(aField.buf); + CycleCollectionNoteChild(aCallback, aField.buf.get(), aName, aFlags); } #endif \ No newline at end of file