Bug 697132 - Use nsCOMPtr constructor. r=Ms2ger
authorKan-Ru Chen <kanru@kanru.info>
Wed, 14 Mar 2012 18:00:29 -0400
changeset 89374 25af1ffbabcee6653351d186d83489030483daa9
parent 89373 dc72c4a740246fcd9662e4507aa7fbf69de0de94
child 89375 0975cabb34e60de276032b29db11165ee3d4474e
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-esr52@357da346ceb7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs697132
milestone14.0a1
Bug 697132 - Use nsCOMPtr constructor. r=Ms2ger
dom/base/Navigator.cpp
dom/power/PowerManagerService.cpp
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -967,18 +967,17 @@ Navigator::GetMozPower(nsIDOMMozPowerMan
   if (!mPowerManager) {
     nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
     NS_ENSURE_TRUE(win, NS_OK);
 
     mPowerManager = new power::PowerManager();
     mPowerManager->Init(win);
   }
 
-  nsCOMPtr<nsIDOMMozPowerManager> power =
-    do_QueryInterface(NS_ISUPPORTS_CAST(nsIDOMMozPowerManager*, mPowerManager));
+  nsCOMPtr<nsIDOMMozPowerManager> power(mPowerManager);
   power.forget(aPower);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Navigator::RequestWakeLock(const nsAString &aTopic, nsIDOMMozWakeLock **aWakeLock)
 {
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -158,18 +158,17 @@ NS_IMETHODIMP
 PowerManagerService::NewWakeLock(const nsAString &aTopic,
                                  nsIDOMWindow *aWindow,
                                  nsIDOMMozWakeLock **aWakeLock)
 {
   nsRefPtr<WakeLock> wakelock = new WakeLock();
   nsresult rv = wakelock->Init(aTopic, aWindow);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<nsIDOMMozWakeLock> wl =
-    do_QueryInterface(NS_ISUPPORTS_CAST(nsIDOMMozWakeLock*, wakelock));
+  nsCOMPtr<nsIDOMMozWakeLock> wl(wakelock);
   wl.forget(aWakeLock);
 
   return NS_OK;
 }
 
 } // power
 } // dom
 } // mozilla