Bug 975295 patch 2: Remove the nsITraceRefcnt interface and any instantiation of the nsTraceRefcntImpl object. r=bsmedberg
authorL. David Baron <dbaron@dbaron.org>
Mon, 24 Feb 2014 15:27:53 -0800
changeset 170640 8c594f255751b360f2b372f2190b21a119e3db88
parent 170639 7e6499af80b58c1b1b40db280d6d5cd8b2289888
child 170641 75147b26aef99ed7a89d1213ea632097ce4f0a2f
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbsmedberg
bugs975295
milestone30.0a1
Bug 975295 patch 2: Remove the nsITraceRefcnt interface and any instantiation of the nsTraceRefcntImpl object. r=bsmedberg
xpcom/base/moz.build
xpcom/base/nsITraceRefcnt.idl
xpcom/base/nsTraceRefcntImpl.cpp
xpcom/base/nsTraceRefcntImpl.h
xpcom/build/FrozenFunctions.cpp
xpcom/build/XPCOM.h
xpcom/build/nsXPCOM.h
xpcom/build/nsXPCOMPrivate.h
xpcom/build/nsXPComInit.cpp
xpcom/glue/standalone/nsXPCOMGlue.cpp
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -18,17 +18,16 @@ XPIDL_SOURCES += [
     'nsIMemory.idl',
     'nsIMemoryInfoDumper.idl',
     'nsIMemoryReporter.idl',
     'nsIMessageLoop.idl',
     'nsIMutable.idl',
     'nsIProgrammingLanguage.idl',
     'nsISecurityConsoleMessage.idl',
     'nsISupports.idl',
-    'nsITraceRefcnt.idl',
     'nsIUUIDGenerator.idl',
     'nsIVersionComparator.idl',
     'nsIVisualEventTracer.idl',
     'nsIWeakReference.idl',
     'nsrootidl.idl',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
deleted file mode 100644
--- a/xpcom/base/nsITraceRefcnt.idl
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-
-#include "nsISupports.idl"
-
-/**  
- * nsITraceRefcnt is an interface between XPCOM Glue and XPCOM.
- *
- * @status DEPRECATED  Replaced by the NS_Log* functions.
- */
-
-[uuid(273dc92f-0fe6-4545-96a9-21be77828039)]
-interface nsITraceRefcnt : nsISupports
-{
-  void logAddRef(in voidPtr aPtr,
-                 in nsrefcnt aNewRefcnt,
-                 in string aTypeName,
-                 in unsigned long aInstanceSize);
-
-  void logRelease(in voidPtr aPtr,
-                  in nsrefcnt aNewRefcnt,
-                  in string aTypeName);
-
-  void logCtor(in voidPtr aPtr,
-               in string aTypeName,
-               in unsigned long aInstanceSize);
-
-  void logDtor(in voidPtr aPtr,
-               in string aTypeName,
-               in unsigned long aInstanceSize);
-
-
-  void logAddCOMPtr(in voidPtr aPtr, in nsISupports aObject);
-
-  void logReleaseCOMPtr(in voidPtr aPtr, in nsISupports aObject);
-};
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -1291,73 +1291,8 @@ nsTraceRefcntImpl::SetActivityIsLegal(bo
 {
 #ifdef NS_IMPL_REFCNT_LOGGING
   if (gActivityTLS == BAD_TLS_INDEX)
     PR_NewThreadPrivateIndex(&gActivityTLS, nullptr);
 
   PR_SetThreadPrivate(gActivityTLS, NS_INT32_TO_PTR(!aLegal));
 #endif
 }
-
-NS_IMPL_QUERY_INTERFACE1(nsTraceRefcntImpl, nsITraceRefcnt)
-
-NS_IMETHODIMP_(nsrefcnt) nsTraceRefcntImpl::AddRef(void)
-{
-  return 2;
-}
-
-NS_IMETHODIMP_(nsrefcnt) nsTraceRefcntImpl::Release(void)
-{
-  return 1;
-}
-
-NS_IMETHODIMP
-nsTraceRefcntImpl::LogAddRef(void *aPtr, nsrefcnt aNewRefcnt,
-                             const char *aTypeName, uint32_t aSize)
-{
-  NS_LogAddRef(aPtr, aNewRefcnt, aTypeName, aSize);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTraceRefcntImpl::LogRelease(void *aPtr, nsrefcnt aNewRefcnt,
-                              const char *aTypeName)
-{
-  NS_LogRelease(aPtr, aNewRefcnt, aTypeName);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTraceRefcntImpl::LogCtor(void *aPtr, const char *aTypeName, uint32_t aSize)
-{
-  NS_LogCtor(aPtr, aTypeName, aSize);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTraceRefcntImpl::LogDtor(void *aPtr, const char *aTypeName, uint32_t aSize)
-{
-  NS_LogDtor(aPtr, aTypeName, aSize);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTraceRefcntImpl::LogAddCOMPtr(void *aCOMPtr, nsISupports* aObject)
-{
-  NS_LogCOMPtrAddRef(aCOMPtr, aObject);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTraceRefcntImpl::LogReleaseCOMPtr(void *aCOMPtr, nsISupports* aObject)
-{
-  NS_LogCOMPtrRelease(aCOMPtr, aObject);
-  return NS_OK;
-}
-
-static const nsTraceRefcntImpl kTraceRefcntImpl;
-
-NS_METHOD
-nsTraceRefcntImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
-{
-  return const_cast<nsTraceRefcntImpl*>(&kTraceRefcntImpl)->
-    QueryInterface(aIID, aInstancePtr);
-}
--- a/xpcom/base/nsTraceRefcntImpl.h
+++ b/xpcom/base/nsTraceRefcntImpl.h
@@ -1,25 +1,21 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsTraceRefcntImpl_h___
 #define nsTraceRefcntImpl_h___
 
 #include <stdio.h> // for FILE
-#include "nsITraceRefcnt.h"
+#include "nscore.h"
 
-class nsTraceRefcntImpl : public nsITraceRefcnt
+class nsTraceRefcntImpl
 {
 public:
-  nsTraceRefcntImpl() {}
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSITRACEREFCNT
-
   static void Startup();
   static void Shutdown();
 
   enum StatisticsType {
     ALL_STATS,
     NEW_STATS
   };
 
@@ -34,18 +30,16 @@ public:
 
   static void WalkTheStack(FILE* aStream);
   /**
    * Tell nsTraceRefcnt whether refcounting, allocation, and destruction
    * activity is legal.  This is used to trigger assertions for any such
    * activity that occurs because of static constructors or destructors.
    */
   static void SetActivityIsLegal(bool aLegal);
-
-  static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
 };
 
 #define NS_TRACE_REFCNT_CONTRACTID "@mozilla.org/xpcom/trace-refcnt;1"
 #define NS_TRACE_REFCNT_CID                          \
 { /* e3e7511e-a395-4924-94b1-d527861cded4 */         \
     0xe3e7511e,                                      \
     0xa395,                                          \
     0x4924,                                          \
--- a/xpcom/build/FrozenFunctions.cpp
+++ b/xpcom/build/FrozenFunctions.cpp
@@ -34,17 +34,17 @@ static const XPCOMFunctions kFrozenFunct
     &NS_GetMemoryManager,
     &NS_NewLocalFile,
     &NS_NewNativeLocalFile,
     &NS_RegisterXPCOMExitRoutine,
     &NS_UnregisterXPCOMExitRoutine,
 
     // these functions were added post 1.4
     &NS_GetDebug,
-    &NS_GetTraceRefcnt,
+    nullptr,
 
     // these functions were added post 1.6
     &NS_StringContainerInit,
     &NS_StringContainerFinish,
     &NS_StringGetData,
     &NS_StringSetData,
     &NS_StringSetDataRange,
     &NS_StringCopy,
--- a/xpcom/build/XPCOM.h
+++ b/xpcom/build/XPCOM.h
@@ -99,17 +99,16 @@
 #include "nsIStreamBufferAccess.h"
 #include "nsIStringEnumerator.h"
 #include "nsIStorageStream.h"
 #include "nsISupportsIterators.h"
 #include "nsISupportsPrimitives.h"
 #include "nsISupportsPriority.h"
 #include "nsIThreadManager.h"
 #include "nsITimer.h"
-#include "nsITraceRefcnt.h"
 #include "nsIUUIDGenerator.h"
 #include "nsIUnicharInputStream.h"
 #include "nsIUnicharOutputStream.h"
 #include "nsIUnicharLineInputStream.h"
 #include "nsIVariant.h"
 #include "nsIVersionComparator.h"
 #include "nsIWritablePropertyBag2.h"
 
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -25,17 +25,16 @@ DECL_CLASS(nsIModule);
 DECL_CLASS(nsIComponentManager);
 DECL_CLASS(nsIComponentRegistrar);
 DECL_CLASS(nsIServiceManager);
 DECL_CLASS(nsIFile);
 DECL_CLASS(nsILocalFile);
 DECL_CLASS(nsIDirectoryServiceProvider);
 DECL_CLASS(nsIMemory);
 DECL_CLASS(nsIDebug);
-DECL_CLASS(nsITraceRefcnt);
 
 #ifdef __cplusplus
 namespace mozilla {
 struct Module;
 }
 #endif
 
 /**
@@ -407,12 +406,9 @@ NS_CycleCollectorSuspect3(void *n, nsCyc
  * and the data will be the name of the cleared category.
  * The notification will occur on the main thread.
  */
 #define NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID "xpcom-category-cleared"
 
 XPCOM_API(nsresult)
 NS_GetDebug(nsIDebug* *result);
 
-XPCOM_API(nsresult)
-NS_GetTraceRefcnt(nsITraceRefcnt* *result);
-
 #endif
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -35,17 +35,16 @@ typedef nsresult   (* ShutdownFunc)(nsIS
 typedef nsresult   (* GetServiceManagerFunc)(nsIServiceManager* *result);
 typedef nsresult   (* GetComponentManagerFunc)(nsIComponentManager* *result);
 typedef nsresult   (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result);
 typedef nsresult   (* GetMemoryManagerFunc)(nsIMemory* *result);
 typedef nsresult   (* NewLocalFileFunc)(const nsAString &path, bool followLinks, nsIFile* *result);
 typedef nsresult   (* NewNativeLocalFileFunc)(const nsACString &path, bool followLinks, nsIFile* *result);
 
 typedef nsresult   (* GetDebugFunc)(nsIDebug* *result);
-typedef nsresult   (* GetTraceRefcntFunc)(nsITraceRefcnt* *result);
 
 typedef nsresult   (* StringContainerInitFunc)(nsStringContainer&);
 typedef nsresult   (* StringContainerInit2Func)(nsStringContainer&, const char16_t *, uint32_t, uint32_t);
 typedef void       (* StringContainerFinishFunc)(nsStringContainer&);
 typedef uint32_t   (* StringGetDataFunc)(const nsAString&, const char16_t**, bool*);
 typedef uint32_t   (* StringGetMutableDataFunc)(nsAString&, uint32_t, char16_t**);
 typedef char16_t* (* StringCloneDataFunc)(const nsAString&);
 typedef nsresult   (* StringSetDataFunc)(nsAString&, const char16_t*, uint32_t);
@@ -110,17 +109,17 @@ typedef struct XPCOMFunctions{
     NewLocalFileFunc newLocalFile;
     NewNativeLocalFileFunc newNativeLocalFile;
 
     RegisterXPCOMExitRoutineFunc registerExitRoutine;
     UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
 
     // Added for Mozilla 1.5
     GetDebugFunc getDebug;
-    GetTraceRefcntFunc getTraceRefcnt;
+    void* getTraceRefcnt;
 
     // Added for Mozilla 1.7
     StringContainerInitFunc stringContainerInit;
     StringContainerFinishFunc stringContainerFinish;
     StringGetDataFunc stringGetData;
     StringSetDataFunc stringSetData;
     StringSetDataRangeFunc stringSetDataRange;
     StringCopyFunc stringCopy;
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -319,24 +319,16 @@ EXPORT_XPCOM_API(nsresult)
 NS_GetDebug(nsIDebug** result)
 {
     return nsDebugImpl::Create(nullptr,
                                NS_GET_IID(nsIDebug),
                                (void**) result);
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_GetTraceRefcnt(nsITraceRefcnt** result)
-{
-    return nsTraceRefcntImpl::Create(nullptr,
-                                     NS_GET_IID(nsITraceRefcnt),
-                                     (void**) result);
-}
-
-EXPORT_XPCOM_API(nsresult)
 NS_InitXPCOM(nsIServiceManager* *result,
                              nsIFile* binDirectory)
 {
     return NS_InitXPCOM2(result, binDirectory, nullptr);
 }
 
 class ICUReporter MOZ_FINAL : public nsIMemoryReporter
 {
--- a/xpcom/glue/standalone/nsXPCOMGlue.cpp
+++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp
@@ -556,25 +556,16 @@ NS_GetDebug(nsIDebug* *result)
 {
     if (!xpcomFunctions.getDebug)
         return NS_ERROR_NOT_INITIALIZED;
     return xpcomFunctions.getDebug(result);
 }
 
 
 XPCOM_API(nsresult)
-NS_GetTraceRefcnt(nsITraceRefcnt* *result)
-{
-    if (!xpcomFunctions.getTraceRefcnt)
-        return NS_ERROR_NOT_INITIALIZED;
-    return xpcomFunctions.getTraceRefcnt(result);
-}
-
-
-XPCOM_API(nsresult)
 NS_StringContainerInit(nsStringContainer &aStr)
 {
     if (!xpcomFunctions.stringContainerInit)
         return NS_ERROR_NOT_INITIALIZED;
     return xpcomFunctions.stringContainerInit(aStr);
 }
 
 XPCOM_API(nsresult)