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 342496 550118c880126785191f842b7a849bfdc5819992
parent 342495 7883a513cc6a78c3fc2bd814d0bff2504d5cbeef
child 342497 6c272bb2e85065aea23d9aa24e6b472cafeebe3b
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, lizzard
bugs1297099
milestone49.0
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_ */