Bug 999883 - Make BackgroundHangMonitor not use mozilla::RefCounted; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 23 Apr 2014 09:45:56 -0400
changeset 180152 efdfbde5f291a9b3cb1889e7c96ba5ea070ef2e8
parent 180151 bd59c5ef0677817e38d833f065316b527d79f914
child 180153 bfd16de7bf251bb0184a3f4baf6c76552abc8dc1
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersfroydnj
bugs999883
milestone31.0a1
Bug 999883 - Make BackgroundHangMonitor not use mozilla::RefCounted; r=froydnj
xpcom/threads/BackgroundHangMonitor.cpp
--- a/xpcom/threads/BackgroundHangMonitor.cpp
+++ b/xpcom/threads/BackgroundHangMonitor.cpp
@@ -91,33 +91,33 @@ public:
   BackgroundHangManager();
   ~BackgroundHangManager();
 };
 
 /**
  * BackgroundHangThread is a per-thread object that is used
  * by all instances of BackgroundHangMonitor to monitor hangs.
  */
-class BackgroundHangThread : public RefCounted<BackgroundHangThread>
-                           , public LinkedListElement<BackgroundHangThread>
+class BackgroundHangThread : public LinkedListElement<BackgroundHangThread>
 {
 private:
   static ThreadLocal<BackgroundHangThread*> sTlsKey;
 
   BackgroundHangThread(const BackgroundHangThread&);
   BackgroundHangThread& operator=(const BackgroundHangThread&);
+  ~BackgroundHangThread();
 
   /* Keep a reference to the manager, so we can keep going even
      after BackgroundHangManager::Shutdown is called. */
   const RefPtr<BackgroundHangManager> mManager;
   // Unique thread ID for identification
   const PRThread* mThreadID;
 
 public:
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(BackgroundHangThread)
+  NS_INLINE_DECL_REFCOUNTING(BackgroundHangThread)
   static BackgroundHangThread* FindThread();
 
   static void Startup()
   {
     /* We can tolerate init() failing.
        The if block turns off warn_unused_result. */
     if (!sTlsKey.init()) {}
   }
@@ -139,17 +139,16 @@ public:
   // Stack of current hang
   Telemetry::HangHistogram::Stack mHangStack;
   // Statistics for telemetry
   Telemetry::ThreadHangStats mStats;
 
   BackgroundHangThread(const char* aName,
                        uint32_t aTimeoutMs,
                        uint32_t aMaxTimeoutMs);
-  ~BackgroundHangThread();
 
   // Report a hang; aManager->mLock IS locked
   void ReportHang(PRIntervalTime aHangTime);
   // Report a permanent hang; aManager->mLock IS locked
   void ReportPermaHang();
   // Called by BackgroundHangMonitor::NotifyActivity
   void NotifyActivity();
   // Called by BackgroundHangMonitor::NotifyWait