Bug 996444 - Remove gTelephonyList. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Tue, 22 Apr 2014 17:57:05 +0800
changeset 179981 7f19a9a6127e1e6087c6edb558f7eab42338834f
parent 179980 9710ee1a02c516d419fdda9161314cd13fb9ce4e
child 179982 d050c422919ae6c4ba75663a3ce1fbe237556f76
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewershsinyi
bugs996444
milestone31.0a1
Bug 996444 - Remove gTelephonyList. r=hsinyi
dom/telephony/Telephony.cpp
--- a/dom/telephony/Telephony.cpp
+++ b/dom/telephony/Telephony.cpp
@@ -25,24 +25,16 @@
 #include "CallsList.h"
 #include "TelephonyCall.h"
 #include "TelephonyCallGroup.h"
 
 using namespace mozilla::dom;
 using mozilla::ErrorResult;
 using mozilla::dom::telephony::kOutgoingPlaceholderCallIndex;
 
-namespace {
-
-typedef nsAutoTArray<Telephony*, 2> TelephonyList;
-
-TelephonyList* gTelephonyList;
-
-} // anonymous namespace
-
 class Telephony::Listener : public nsITelephonyListener
 {
   Telephony* mTelephony;
 
 public:
   NS_DECL_ISUPPORTS
   NS_FORWARD_SAFE_NSITELEPHONYLISTENER(mTelephony)
 
@@ -116,36 +108,21 @@ public:
     mTelephony->NotifyCallsChanged(nullptr);
     return NS_OK;
   }
 };
 
 Telephony::Telephony(nsPIDOMWindow* aOwner)
   : DOMEventTargetHelper(aOwner), mActiveCall(nullptr), mEnumerated(false)
 {
-  if (!gTelephonyList) {
-    gTelephonyList = new TelephonyList();
-  }
-
-  gTelephonyList->AppendElement(this);
 }
 
 Telephony::~Telephony()
 {
   Shutdown();
-
-  NS_ASSERTION(gTelephonyList, "This should never be null!");
-  NS_ASSERTION(gTelephonyList->Contains(this), "Should be in the list!");
-
-  if (gTelephonyList->Length() == 1) {
-    delete gTelephonyList;
-    gTelephonyList = nullptr;
-  } else {
-    gTelephonyList->RemoveElement(this);
-  }
 }
 
 void
 Telephony::Shutdown()
 {
   if (mListener) {
     mListener->Disconnect();