Bug 1540301, part 3 - Eliminate nsIXPCWrappedJSClass. r=bzbarsky
authorAndrew McCreight <continuation@gmail.com>
Sat, 06 Apr 2019 12:56:53 +0000
changeset 468274 51753d8777fa37e86be6c11c94e2bbb546fdca2c
parent 468273 cdc953c774f46cda56ef33f39ad27bd04e2ea2c2
child 468275 7f52f402ed0bb476fbe12823dfd33217eca32390
push id35826
push usernerli@mozilla.com
push dateSat, 06 Apr 2019 21:48:00 +0000
treeherdermozilla-central@dc53fe5c9ced [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1540301
milestone68.0a1
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
Bug 1540301, part 3 - Eliminate nsIXPCWrappedJSClass. r=bzbarsky This interface serves no real purpose, aside from some weird XPConnect debugging function. If you are in a debugger already, you can just call the nsXPCWrappedJSClass DebugDump method directly. For now, I changed nsXPCWrappedJSClass to just implement nsISupports, but this will go away later. I also devirtualized DebugDump(), because it is no longer an XPCOM method. Differential Revision: https://phabricator.services.mozilla.com/D26216
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -26,17 +26,17 @@
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
 using namespace xpc;
 using namespace JS;
 using namespace mozilla;
 using namespace mozilla::dom;
 
-NS_IMPL_ISUPPORTS(nsXPCWrappedJSClass, nsIXPCWrappedJSClass)
+NS_IMPL_ISUPPORTS(nsXPCWrappedJSClass, nsISupports)
 
 bool AutoScriptEvaluate::StartEvaluating(HandleObject scope) {
   MOZ_ASSERT(!mEvaluated,
              "AutoScriptEvaluate::Evaluate should only be called once");
 
   if (!mJSContext) {
     return true;
   }
@@ -1101,18 +1101,17 @@ static const JSClass XPCOutParamClass = 
 bool xpc::IsOutObject(JSContext* cx, JSObject* obj) {
   return js::GetObjectJSClass(obj) == &XPCOutParamClass;
 }
 
 JSObject* xpc::NewOutObject(JSContext* cx) {
   return JS_NewObject(cx, &XPCOutParamClass);
 }
 
-NS_IMETHODIMP
-nsXPCWrappedJSClass::DebugDump(int16_t depth) {
+nsresult nsXPCWrappedJSClass::DebugDump(int16_t depth) {
 #ifdef DEBUG
   depth--;
   XPC_LOG_ALWAYS(("nsXPCWrappedJSClass @ %p with mRefCnt = %" PRIuPTR, this,
                   mRefCnt.get()));
   XPC_LOG_INDENT();
   const char* name = mInfo->Name();
   XPC_LOG_ALWAYS(("interface name is %s", name));
   char* iid = mInfo->IID().ToString();
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -791,28 +791,23 @@ nsXPConnect::DebugDumpObject(nsISupports
     return NS_OK;
   }
   if (!p) {
     XPC_LOG_ALWAYS(("*** Cound not dump object with NULL address"));
     return NS_OK;
   }
 
   nsCOMPtr<nsIXPConnect> xpc;
-  nsCOMPtr<nsIXPCWrappedJSClass> wjsc;
   nsCOMPtr<nsIXPConnectWrappedNative> wn;
   nsCOMPtr<nsIXPConnectWrappedJS> wjs;
 
   if (NS_SUCCEEDED(
           p->QueryInterface(NS_GET_IID(nsIXPConnect), getter_AddRefs(xpc)))) {
     XPC_LOG_ALWAYS(("Dumping a nsIXPConnect..."));
     xpc->DebugDump(depth);
-  } else if (NS_SUCCEEDED(p->QueryInterface(NS_GET_IID(nsIXPCWrappedJSClass),
-                                            getter_AddRefs(wjsc)))) {
-    XPC_LOG_ALWAYS(("Dumping a nsIXPCWrappedJSClass..."));
-    wjsc->DebugDump(depth);
   } else if (NS_SUCCEEDED(p->QueryInterface(
                  NS_GET_IID(nsIXPConnectWrappedNative), getter_AddRefs(wn)))) {
     XPC_LOG_ALWAYS(("Dumping a nsIXPConnectWrappedNative..."));
     wn->DebugDump(depth);
   } else if (NS_SUCCEEDED(p->QueryInterface(NS_GET_IID(nsIXPConnectWrappedJS),
                                             getter_AddRefs(wjs)))) {
     XPC_LOG_ALWAYS(("Dumping a nsIXPConnectWrappedJS..."));
     wjs->DebugDump(depth);
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1590,42 +1590,24 @@ class XPCWrappedNative final : public ns
 /***************************************************************************
 ****************************************************************************
 *
 * Core classes for wrapped JSObject for use from native code...
 *
 ****************************************************************************
 ***************************************************************************/
 
-// this interfaces exists so we can refcount nsXPCWrappedJSClass
-// {2453EBA0-A9B8-11d2-BA64-00805F8A5DD7}
-#define NS_IXPCONNECT_WRAPPED_JS_CLASS_IID          \
-  {                                                 \
-    0x2453eba0, 0xa9b8, 0x11d2, {                   \
-      0xba, 0x64, 0x0, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 \
-    }                                               \
-  }
-
-class nsIXPCWrappedJSClass : public nsISupports {
- public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXPCONNECT_WRAPPED_JS_CLASS_IID)
-  NS_IMETHOD DebugDump(int16_t depth) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIXPCWrappedJSClass,
-                              NS_IXPCONNECT_WRAPPED_JS_CLASS_IID)
-
 /*************************/
 // nsXPCWrappedJSClass represents the sharable factored out common code and
 // data for nsXPCWrappedJS instances for the same interface type.
 
-class nsXPCWrappedJSClass final : public nsIXPCWrappedJSClass {
+class nsXPCWrappedJSClass final : public nsISupports {
   // all the interface method declarations...
   NS_DECL_ISUPPORTS
-  NS_IMETHOD DebugDump(int16_t depth) override;
+  nsresult DebugDump(int16_t depth);
 
  public:
   static already_AddRefed<nsXPCWrappedJSClass> GetNewOrUsed(REFNSIID aIID);
 
   REFNSIID GetIID() const { return mInfo->IID(); }
   const nsXPTInterfaceInfo* GetInterfaceInfo() const { return mInfo; }
   const char* GetInterfaceName();