Bug 1297099 - Change LoadManagerSingleton WeakPtr to RefPtr. r=jesup a=lizzard
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 25 Aug 2016 10:04:58 -0400
changeset 349968 c20fd556d0658ba8d3ffbff508dfc2bfb587213d
parent 349967 b430f432c76b1d9bb08d60e3951658e97aee5595
child 349969 fc6c71b49d556ffd415e3008e626254aa10bbaf8
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, lizzard
bugs1297099
milestone50.0a2
Bug 1297099 - Change LoadManagerSingleton WeakPtr to RefPtr. r=jesup a=lizzard
dom/media/systemservices/LoadManager.h
--- a/dom/media/systemservices/LoadManager.h
+++ b/dom/media/systemservices/LoadManager.h
@@ -2,42 +2,38 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _LOADMANAGER_H_
 #define _LOADMANAGER_H_
 
 #include "LoadMonitor.h"
-#include "mozilla/WeakPtr.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Services.h"
 #include "nsTArray.h"
 #include "nsIObserver.h"
 
 #include "webrtc/common_types.h"
 #include "webrtc/video_engine/include/vie_base.h"
 
 extern mozilla::LazyLogModule gLoadManagerLog;
 
 namespace mozilla {
 
 class LoadManagerSingleton : public LoadNotificationCallback,
                              public webrtc::CPULoadStateCallbackInvoker,
                              public webrtc::CpuOveruseObserver,
-                             public SupportsWeakPtr<LoadManagerSingleton>,
                              public nsIObserver
 
 {
 public:
     static LoadManagerSingleton* Get();
 
-    MOZ_DECLARE_WEAKREFERENCE_TYPENAME(LoadManagerSingleton)
-
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIOBSERVER
 
     // LoadNotificationCallback interface
     void LoadChanged(float aSystemLoad, float aProcessLoad) override;
     // CpuOveruseObserver interface
     // Called as soon as an overuse is detected.
     void OveruseDetected() override;
@@ -85,38 +81,30 @@ class LoadManager final : public webrtc:
 public:
     explicit LoadManager(LoadManagerSingleton* aManager)
         : mManager(aManager)
     {}
     ~LoadManager() {}
 
     void AddObserver(webrtc::CPULoadStateObserver * aObserver) override
     {
-        if (mManager) {
-          mManager->AddObserver(aObserver);
-        }
+        mManager->AddObserver(aObserver);
     }
     void RemoveObserver(webrtc::CPULoadStateObserver * aObserver) override
     {
-        if (mManager) {
-          mManager->RemoveObserver(aObserver);
-        }
+        mManager->RemoveObserver(aObserver);
     }
     void OveruseDetected() override
     {
-        if (mManager) {
-          mManager->OveruseDetected();
-        }
+        mManager->OveruseDetected();
     }
     void NormalUsage() override
     {
-        if (mManager) {
-          mManager->NormalUsage();
-        }
+        mManager->NormalUsage();
     }
 
 private:
-    WeakPtr<LoadManagerSingleton> mManager;
+    RefPtr<LoadManagerSingleton> mManager;
 };
 
 } //namespace
 
 #endif /* _LOADMANAGER_H_ */