Bug 1297099 - Change LoadManagerSingleton WeakPtr to RefPtr. r=jesup
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 25 Aug 2016 10:04:58 -0400
changeset 311105 521e476f0c714ff4e92c7220e81b40e56972f58c
parent 311104 dfc2a69bb100ca99aaefe1069aa6bac19123a97e
child 311106 aebc13fe16b3dfe2f8a3b5cc8e88856fb3b9589d
push id81042
push userryanvm@gmail.com
push dateThu, 25 Aug 2016 14:13:22 +0000
treeherdermozilla-inbound@ab461807ca14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1297099
milestone51.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 1297099 - Change LoadManagerSingleton WeakPtr to RefPtr. r=jesup
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_ */