Bug 1453011 - Remove nsXPCClassInfo. r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Thu, 22 Mar 2018 09:42:21 +0100
changeset 418362 04afbcd4a5940eef731b6363679a59390e1d0616
parent 418361 078000699e1c8bd1ae4cd30cc0580f835a618e2c
child 418363 b4b82cd86014c1ccdbf3cfc1479be70f4815ed66
push id33999
push userdluca@mozilla.com
push dateTue, 15 May 2018 21:54:51 +0000
treeherdermozilla-central@380cf87c1ee3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1453011
milestone62.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 1453011 - Remove nsXPCClassInfo. r=bz.
js/xpconnect/idl/nsIXPCScriptable.idl
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/xpcObjectHelper.h
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/idl/nsIXPCScriptable.idl
+++ b/js/xpconnect/idl/nsIXPCScriptable.idl
@@ -124,41 +124,8 @@ interface nsIXPCScriptable : nsISupports
     GET_IT(AllowPropModsDuringResolve,   ALLOW_PROP_MODS_DURING_RESOLVE)
     GET_IT(AllowPropModsToPrototype,     ALLOW_PROP_MODS_TO_PROTOTYPE)
     GET_IT(IsGlobalObject,               IS_GLOBAL_OBJECT)
     GET_IT(DontReflectInterfaceNames,    DONT_REFLECT_INTERFACE_NAMES)
 
     #undef GET_IT
 %}
 };
-
-%{ C++
-
-#include "nsAutoPtr.h"
-
-#define NS_XPCCLASSINFO_IID \
-{ 0x43b67f01, 0xd4ce, 0x4b82, \
- { 0xb3, 0xf8, 0xeb, 0xf2, 0x13, 0x60, 0xfb, 0x7e } }
-
-class NS_NO_VTABLE nsXPCClassInfo : public nsIClassInfo,
-                                    public nsIXPCScriptable
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_XPCCLASSINFO_IID)
-
-  NS_IMETHOD_(MozExternalRefCountType) AddRef() override = 0;
-  NS_IMETHOD_(MozExternalRefCountType) Release() override = 0;
-
-  virtual void PreserveWrapper(nsISupports *aNative) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsXPCClassInfo, NS_XPCCLASSINFO_IID)
-
-inline
-nsresult
-CallQueryInterface(nsISupports* aSourcePtr,
-                   RefPtrGetterAddRefs<nsXPCClassInfo> aDestPtr)
-{
-  return CallQueryInterface(aSourcePtr,
-                            static_cast<nsXPCClassInfo**>(aDestPtr));
-}
-
-%}
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -543,24 +543,16 @@ XPCWrappedNative::Destroy()
 
 // This is factored out so that it can be called publicly.
 // static
 nsIXPCScriptable*
 XPCWrappedNative::GatherProtoScriptable(nsIClassInfo* classInfo)
 {
     MOZ_ASSERT(classInfo, "bad param");
 
-    nsXPCClassInfo* classInfoHelper = nullptr;
-    CallQueryInterface(classInfo, &classInfoHelper);
-    if (classInfoHelper) {
-        nsCOMPtr<nsIXPCScriptable> helper =
-          dont_AddRef(static_cast<nsIXPCScriptable*>(classInfoHelper));
-        return helper;
-    }
-
     nsCOMPtr<nsIXPCScriptable> helper;
     nsresult rv = classInfo->GetScriptableHelper(getter_AddRefs(helper));
     if (NS_SUCCEEDED(rv) && helper) {
         return helper;
     }
 
     return nullptr;
 }
--- a/js/xpconnect/src/xpcObjectHelper.h
+++ b/js/xpconnect/src/xpcObjectHelper.h
@@ -36,46 +36,25 @@ public:
 
     nsISupports* Object()
     {
         return mObject;
     }
 
     nsIClassInfo* GetClassInfo()
     {
-        if (mXPCClassInfo)
-          return mXPCClassInfo;
         if (!mClassInfo)
             mClassInfo = do_QueryInterface(mObject);
         return mClassInfo;
     }
-    nsXPCClassInfo* GetXPCClassInfo()
-    {
-        if (!mXPCClassInfo) {
-            CallQueryInterface(mObject, getter_AddRefs(mXPCClassInfo));
-        }
-        return mXPCClassInfo;
-    }
-
-    already_AddRefed<nsXPCClassInfo> forgetXPCClassInfo()
-    {
-        GetXPCClassInfo();
-
-        return mXPCClassInfo.forget();
-    }
 
     // We assert that we can reach an nsIXPCScriptable somehow.
     uint32_t GetScriptableFlags()
     {
-        // Try getting an nsXPCClassInfo - this handles DOM scriptable helpers.
-        nsCOMPtr<nsIXPCScriptable> sinfo = GetXPCClassInfo();
-
-        // If that didn't work, try just QI-ing. This handles BackstagePass.
-        if (!sinfo)
-            sinfo = do_QueryInterface(mObject);
+        nsCOMPtr<nsIXPCScriptable> sinfo = do_QueryInterface(mObject);
 
         // We should have something by now.
         MOZ_ASSERT(sinfo);
 
         // Grab the flags.
         return sinfo->GetScriptableFlags();
     }
 
@@ -87,12 +66,11 @@ public:
 private:
     xpcObjectHelper(xpcObjectHelper& aOther) = delete;
 
     nsISupports* MOZ_UNSAFE_REF("xpcObjectHelper has been specifically optimized "
                                 "to avoid unnecessary AddRefs and Releases. "
                                 "(see bug 565742)") mObject;
     nsWrapperCache*          mCache;
     nsCOMPtr<nsIClassInfo>   mClassInfo;
-    RefPtr<nsXPCClassInfo> mXPCClassInfo;
 };
 
 #endif
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1446,21 +1446,16 @@ static bool
 IsWindow(JSContext* cx, JSObject* wrapper)
 {
     return !!AsWindow(cx, wrapper);
 }
 
 void
 XPCWrappedNativeXrayTraits::preserveWrapper(JSObject* target)
 {
-    XPCWrappedNative* wn = XPCWrappedNative::Get(target);
-    RefPtr<nsXPCClassInfo> ci;
-    CallQueryInterface(wn->Native(), getter_AddRefs(ci));
-    if (ci)
-        ci->PreserveWrapper(wn->Native());
 }
 
 static bool
 XrayToString(JSContext* cx, unsigned argc, JS::Value* vp);
 
 bool
 XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext* cx, HandleObject wrapper,
                                                   HandleObject holder, HandleId id,