Bug 888389 - Cycle collect PowerManager. r=smaug
authorAndrew McCreight <amccreight@mozilla.com>
Thu, 18 Jul 2013 09:07:28 -0700
changeset 152270 e489921e3808e70a28215ca43e96fcaaef822b64
parent 152269 a4c0795e4c360896bb17024858965970f37c6662
child 152271 09b7b201d1ecb21f9c9a0b1ec736017c83255595
push id382
push userakeybl@mozilla.com
push dateMon, 21 Oct 2013 21:47:13 +0000
treeherdermozilla-release@5f1868ee45cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs888389
milestone25.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 888389 - Cycle collect PowerManager. r=smaug
dom/base/Navigator.cpp
dom/power/PowerManager.cpp
dom/power/PowerManager.h
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -135,17 +135,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Na
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMimeTypes)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
-  // mPowerManager isn't cycle collected
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSmsManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileMessageManager)
 #ifdef MOZ_B2G_RIL
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTelephony)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVoicemail)
 #endif
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
 #ifdef MOZ_B2G_RIL
--- a/dom/power/PowerManager.cpp
+++ b/dom/power/PowerManager.cpp
@@ -17,25 +17,27 @@
 #include "nsError.h"
 
 DOMCI_DATA(MozPowerManager, mozilla::dom::power::PowerManager)
 
 namespace mozilla {
 namespace dom {
 namespace power {
 
-NS_INTERFACE_MAP_BEGIN(PowerManager)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PowerManager)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMozPowerManager)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMozPowerManager)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMozWakeLockListener)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozPowerManager)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_ADDREF(PowerManager)
-NS_IMPL_RELEASE(PowerManager)
+NS_IMPL_CYCLE_COLLECTION_1(PowerManager, mListeners)
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(PowerManager)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(PowerManager)
 
 nsresult
 PowerManager::Init(nsIDOMWindow *aWindow)
 {
   mWindow = do_GetWeakReference(aWindow);
 
   nsCOMPtr<nsIPowerManagerService> pmService =
     do_GetService(POWERMANAGERSERVICE_CONTRACTID);
--- a/dom/power/PowerManager.h
+++ b/dom/power/PowerManager.h
@@ -18,17 +18,18 @@ namespace mozilla {
 namespace dom {
 namespace power {
 
 class PowerManager
   : public nsIDOMMozPowerManager
   , public nsIDOMMozWakeLockListener
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(PowerManager, nsIDOMMozPowerManager)
   NS_DECL_NSIDOMMOZPOWERMANAGER
   NS_DECL_NSIDOMMOZWAKELOCKLISTENER
 
   PowerManager() {};
   virtual ~PowerManager() {};
 
   nsresult Init(nsIDOMWindow *aWindow);
   nsresult Shutdown();