Bug 1491574 - Part 1: Remove the XPCOM registration for nsProperties; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 15 Sep 2018 12:47:04 -0400
changeset 436901 1b9564e6f967e529d255e53269ddab9781733adf
parent 436900 fa882fd7194ecb9796ec1981fe0224d998facaf8
child 436902 930f94ff8388918d115d82fb022988a85e6deb41
push id34664
push useraciure@mozilla.com
push dateTue, 18 Sep 2018 07:43:05 +0000
treeherdermozilla-central@85b4d2bf888a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1491574
milestone64.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 1491574 - Part 1: Remove the XPCOM registration for nsProperties; r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D5949
image/RasterImage.cpp
image/imgRequest.cpp
xpcom/build/XPCOMInit.cpp
xpcom/build/XPCOMModule.inc
xpcom/ds/moz.build
xpcom/ds/nsProperties.h
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -45,16 +45,17 @@
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Tuple.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/gfx/Scale.h"
 
 #include "GeckoProfiler.h"
 #include "gfx2DGlue.h"
 #include "gfxPrefs.h"
+#include "nsProperties.h"
 #include <algorithm>
 
 namespace mozilla {
 
 using namespace gfx;
 using namespace layers;
 
 namespace image {
@@ -1051,20 +1052,17 @@ RasterImage::Get(const char* prop, const
   }
   return mProperties->Get(prop, iid, result);
 }
 
 NS_IMETHODIMP
 RasterImage::Set(const char* prop, nsISupports* value)
 {
   if (!mProperties) {
-    mProperties = do_CreateInstance("@mozilla.org/properties;1");
-  }
-  if (!mProperties) {
-    return NS_ERROR_OUT_OF_MEMORY;
+    mProperties = new nsProperties();
   }
   return mProperties->Set(prop, value);
 }
 
 NS_IMETHODIMP
 RasterImage::Has(const char* prop, bool* _retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -32,16 +32,17 @@
 #include "nsIScriptSecurityManager.h"
 #include "nsContentUtils.h"
 
 #include "plstr.h" // PL_strcasestr(...)
 #include "prtime.h" // for PR_Now
 #include "nsNetUtil.h"
 #include "nsIProtocolHandler.h"
 #include "imgIRequest.h"
+#include "nsProperties.h"
 
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Telemetry.h"
 
 using namespace mozilla;
 using namespace mozilla::image;
 
 #define LOG_TEST(level) (MOZ_LOG_TEST(gImgLog, (level)))
@@ -103,17 +104,17 @@ imgRequest::Init(nsIURI *aURI,
   LOG_FUNC(gImgLog, "imgRequest::Init");
 
   MOZ_ASSERT(!mImage, "Multiple calls to init");
   MOZ_ASSERT(aURI, "No uri");
   MOZ_ASSERT(aFinalURI, "No final uri");
   MOZ_ASSERT(aRequest, "No request");
   MOZ_ASSERT(aChannel, "No channel");
 
-  mProperties = do_CreateInstance("@mozilla.org/properties;1");
+  mProperties = new nsProperties();
   mURI = aURI;
   mFinalURI = aFinalURI;
   mRequest = aRequest;
   mChannel = aChannel;
   mTimedChannel = do_QueryInterface(mChannel);
   mTriggeringPrincipal = aTriggeringPrincipal;
   mCORSMode = aCORSMode;
   mReferrerPolicy = aReferrerPolicy;
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -23,17 +23,16 @@
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/dom/VideoDecoderManagerChild.h"
 
 #include "prlink.h"
 
 #include "nsCycleCollector.h"
 #include "nsObserverList.h"
 #include "nsObserverService.h"
-#include "nsProperties.h"
 #include "nsPersistentProperties.h"
 #include "nsScriptableInputStream.h"
 #include "nsBinaryStream.h"
 #include "nsStorageStream.h"
 #include "nsPipe.h"
 #include "nsScriptableBase64Encoder.h"
 
 #include "nsMemoryImpl.h"
@@ -206,18 +205,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryI
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStorageStream)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsVersionComparatorImpl)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableBase64Encoder)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariantCC)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHashPropertyBagCC)
 
-NS_GENERIC_AGGREGATED_CONSTRUCTOR(nsProperties)
-
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init)
 
 #ifdef MOZ_WIDGET_COCOA
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemInfo, Init)
 
--- a/xpcom/build/XPCOMModule.inc
+++ b/xpcom/build/XPCOMModule.inc
@@ -7,18 +7,16 @@
     COMPONENT(SCRIPTABLEINPUTSTREAM, nsScriptableInputStream::Create)
     COMPONENT(BINARYINPUTSTREAM, nsBinaryInputStreamConstructor)
     COMPONENT(BINARYOUTPUTSTREAM, nsBinaryOutputStreamConstructor)
     COMPONENT(STORAGESTREAM, nsStorageStreamConstructor)
     COMPONENT(VERSIONCOMPARATOR, nsVersionComparatorImplConstructor)
     COMPONENT(SCRIPTABLEBASE64ENCODER, nsScriptableBase64EncoderConstructor)
     COMPONENT(PIPE, nsPipeConstructor)
 
-    COMPONENT(PROPERTIES, nsPropertiesConstructor)
-
     COMPONENT(PERSISTENTPROPERTIES, nsPersistentProperties::Create)
 
     COMPONENT(ARRAY, nsArrayBase::XPCOMConstructor)
     COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor)
     COMPONENT_M(OBSERVERSERVICE, nsObserverService::Create, Module::ALLOW_IN_GPU_PROCESS)
 
     COMPONENT_M(TIMER, nsTimerConstructor, Module::ALLOW_IN_GPU_PROCESS)
 
--- a/xpcom/ds/moz.build
+++ b/xpcom/ds/moz.build
@@ -57,16 +57,17 @@ EXPORTS += [
     'nsExpirationTracker.h',
     'nsGkAtoms.h',
     'nsHashKeys.h',
     'nsHashPropertyBag.h',
     'nsInterfaceHashtable.h',
     'nsJSThingHashtable.h',
     'nsMathUtils.h',
     'nsPointerHashKeys.h',
+    'nsProperties.h',
     'nsQuickSort.h',
     'nsRefPtrHashtable.h',
     'nsSimpleEnumerator.h',
     'nsStaticAtomUtils.h',
     'nsStaticNameTable.h',
     'nsStringEnumerator.h',
     'nsSupportsPrimitives.h',
     'nsTArray-inl.h',
--- a/xpcom/ds/nsProperties.h
+++ b/xpcom/ds/nsProperties.h
@@ -8,32 +8,24 @@
 #define nsProperties_h___
 
 #include "nsIProperties.h"
 #include "nsInterfaceHashtable.h"
 #include "nsHashKeys.h"
 #include "nsAgg.h"
 #include "mozilla/Attributes.h"
 
-#define NS_PROPERTIES_CID                            \
-{ /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */         \
-    0x4de2bc90,                                      \
-    0xb1bf,                                          \
-    0x11d3,                                          \
-    {0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
-}
-
 typedef nsInterfaceHashtable<nsCharPtrHashKey,
                              nsISupports> nsProperties_HashBase;
 
 class nsProperties final
   : public nsIProperties
   , public nsProperties_HashBase
 {
 public:
   NS_DECL_AGGREGATED
   NS_DECL_NSIPROPERTIES
 
-  explicit nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); }
+  nsProperties() { NS_INIT_AGGREGATED(nullptr); }
   ~nsProperties() {}
 };
 
 #endif /* nsProperties_h___ */