Port |Bug 1207245 - get rid of nsRefPtr / RefPtr split| rs=bustage-fix
authorPatrick Cloke <clokep@gmail.com>
Mon, 19 Oct 2015 10:39:53 -0400
changeset 779 45eb4fb2d037835b5a234d428baaaa0b6fe0df89
parent 778 cfb3392fcd203413bf8de1d48a721167edf6dffe
child 780 7f82a8aa600d0e94f6e2b69919844835878da8d4
push id55
push userclokep@gmail.com
push dateMon, 19 Oct 2015 15:34:21 +0000
reviewersbustage-fix
bugs1207245
Port |Bug 1207245 - get rid of nsRefPtr / RefPtr split| rs=bustage-fix Ran the following: perl -p -i -e 's#mozilla/nsRefPtr.h#mozilla/RefPtr.h#' perl -p -i -e 's#mozilla::RefPtr#RefPtr#' perl -p -i -e 's#nsRefPtr<#RefPtr<#' perl -p -i -e 's#byRef#getter_AddRefs#'
purplexpcom/src/purpleCoreService.cpp
purplexpcom/src/purpleDNS.cpp
purplexpcom/src/purpleInitAccounts.cpp
purplexpcom/src/purpleInitContacts.cpp
purplexpcom/src/purpleSockets.cpp
purplexpcom/src/purpleSockets.h
purplexpcom/src/purpleTimer.cpp
purplexpcom/src/purpleTimer.h
--- a/purplexpcom/src/purpleCoreService.cpp
+++ b/purplexpcom/src/purpleCoreService.cpp
@@ -236,17 +236,17 @@ nsresult purpleCoreService::InitProxies(
 {
   /* Get the list of proxies */
   nsCString proxyList;
   nsresult rv = mPrefService->GetCharPref(PREF_MESSENGER_PROXIES,
                                           getter_Copies(proxyList));
 
   LOG(("InitProxies list = %s", proxyList.get()));
 
-  nsRefPtr<purpleProxy> proxy;
+  RefPtr<purpleProxy> proxy;
   char *newStr = proxyList.BeginWriting();
   nsAutoCString key;
   for (char *token = NS_strtok(",", &newStr);
        token;
        token = NS_strtok(",", &newStr)) {
     key = token;
     key.StripWhitespace();
 
@@ -342,17 +342,17 @@ NS_IMETHODIMP purpleCoreService::CreateP
       if ((found = mProxies[j]->GetKey().Equals(key))) {
         break;
       }
     }
     ++i;
   } while (found);
 
   /* Actually create the new proxy */
-  nsRefPtr<purpleProxy> proxy = new purpleProxy();
+  RefPtr<purpleProxy> proxy = new purpleProxy();
   rv = proxy->Init(key, aType, aHost, aPort, aUsername, aPassword);
   NS_ENSURE_SUCCESS(rv, rv);
 
   /* Save the proxy list pref */
   if (proxyList.IsEmpty())
     proxyList = key;
   else {
     proxyList.Append(',');
--- a/purplexpcom/src/purpleDNS.cpp
+++ b/purplexpcom/src/purpleDNS.cpp
@@ -55,17 +55,17 @@ gboolean purpleDNS::Resolve(PurpleDnsQue
   nsCString host(purple_dnsquery_get_host(query_data));
   LOG(("Resolving with moz: %s", host.get()));
   NS_ENSURE_TRUE(sRequests, false);
 
   nsCOMPtr<nsIDNSService> dns = do_GetService("@mozilla.org/network/dns-service;1");
   nsCOMPtr<nsIDNSRecord> record;
   nsCOMPtr<nsICancelable> cancelable;
   nsCOMPtr<nsIThread> thread = do_GetMainThread();
-  nsRefPtr<purpleDNSRequest> listener;
+  RefPtr<purpleDNSRequest> listener;
   listener = new purpleDNSRequest();
   listener->mAccountId = purpleAccountScoper::GetCurrentAccountId();
   listener->query_data = query_data;
   listener->resolved_cb = resolved_cb;
   listener->failed_cb = failed_cb;
 
   nsresult rv = dns->AsyncResolve(host, 0, listener, thread,
                                   getter_AddRefs(listener->asyncResolv));
--- a/purplexpcom/src/purpleInitAccounts.cpp
+++ b/purplexpcom/src/purpleInitAccounts.cpp
@@ -148,17 +148,17 @@ class purpleAuthorizationRequest final :
                                const char *remote_user,
                                PurpleAccountRequestAuthorizationCb authorize_cb,
                                PurpleAccountRequestAuthorizationCb deny_cb,
                                void *user_data);
     void Cancel();
 
   private:
     ~purpleAuthorizationRequest() {}
-    nsRefPtr<purpleAccount> mAccount;
+    RefPtr<purpleAccount> mAccount;
     nsCString mRemoteUser;
     PurpleAccountRequestAuthorizationCb mAuthorizeCb, mDenyCb;
     void *mUserData;
 };
 
 NS_IMPL_ISUPPORTS(purpleAuthorizationRequest, prplIBuddyRequest)
 
 purpleAuthorizationRequest::purpleAuthorizationRequest(purpleAccount *aAccount,
--- a/purplexpcom/src/purpleInitContacts.cpp
+++ b/purplexpcom/src/purpleInitContacts.cpp
@@ -28,17 +28,17 @@ int blist_signals_handle = 0;
 static void buddy_signals(PurpleBuddy *aBuddy, const char *aSignal)
 {
   // FIXME when this was handled by purpleCoreService, signals sent
   // while mQuitting was true were ignored.
 
   LOG(("Attempting to send %s signal, group = %s, buddy = %s", aSignal,
        purple_group_get_name(purple_buddy_get_group(aBuddy)), aBuddy->name));
 
-  nsRefPtr<purpleAccountBuddy> pab =
+  RefPtr<purpleAccountBuddy> pab =
     purpleAccountBuddy::fromPurpleBuddy(aBuddy);
   NS_ENSURE_TRUE(pab, );
 
   nsresult rv = pab->NotifyObservers(aSignal);
   NS_ENSURE_SUCCESS(rv, );
 }
 
 void buddy_availability_changed(PurpleBuddy *aBuddy)
--- a/purplexpcom/src/purpleSockets.cpp
+++ b/purplexpcom/src/purpleSockets.cpp
@@ -272,17 +272,17 @@ void purpleSocketWatcher::goingOffline()
 {
   LOG(("purpleSocketWatcher:unInit: Removing %i pending watchers",
        sSockets->Length()));
 
   // We don't loop from 0 to Length - 1 because the libpurple callback
   // can cancel some watchers so the length of the array may change
   // during the loop. See bug 158
   for (PRInt32 i = sSockets->Length(); i; i = sSockets->Length()) {
-    nsRefPtr<purpleSocket> socket = (*sSockets)[i - 1];
+    RefPtr<purpleSocket> socket = (*sSockets)[i - 1];
     sSockets->RemoveElementAt(i - 1);
     socket->CallLibpurpleCallback();
     socket->Cancel();
   }
 
   sSts = nullptr;
 }
 
--- a/purplexpcom/src/purpleSockets.h
+++ b/purplexpcom/src/purpleSockets.h
@@ -67,17 +67,17 @@ class purpleSocket final : public nsIRun
   ~purpleSocket();
   static PRUint32 sLastSocket;
   PRUint32 mAccountId;
   PRUint32 mId;
   PRInt32 mFd;
   PurpleInputFunction mFunction;
   gpointer mData;
   PurpleInputCondition mCondition;
-  nsRefPtr<purpleSocketInternal> mInternal;
+  RefPtr<purpleSocketInternal> mInternal;
 };
 
 typedef void (purpleSocket:: *purpleSocketFunc)(void);
 
 class purpleSocketWatcher
 {
  public:
   static PRUint32 AddWatch(gint aFd, PurpleInputCondition aCondition,
--- a/purplexpcom/src/purpleTimer.cpp
+++ b/purplexpcom/src/purpleTimer.cpp
@@ -15,23 +15,23 @@
 //
 // NSPR_LOG_MODULES=purpleTimer:5
 //
 static PRLogModuleInfo *gPurpleTimerLog = nullptr;
 #define LOG(args) MOZ_LOG(gPurpleTimerLog, mozilla::LogLevel::Debug, args)
 
 /* Init static members */
 PRUint32 purpleTimer::sLastTimer = 0;
-nsTArray<nsRefPtr<purpleTimeout> > *purpleTimer::sTimeouts = nullptr;
+nsTArray<RefPtr<purpleTimeout> > *purpleTimer::sTimeouts = nullptr;
 
 void purpleTimer::init()
 {
   if (!gPurpleTimerLog)
     gPurpleTimerLog = PR_NewLogModule("purpleTimer");
-  sTimeouts = new nsTArray<nsRefPtr<purpleTimeout> >();
+  sTimeouts = new nsTArray<RefPtr<purpleTimeout> >();
 }
 
 void purpleTimer::unInit()
 {
   LOG(("purpleTimer::unInit: removing %i leftover timeouts",
        sTimeouts->Length()));
 
   for (PRUint32 i = 0; i < sTimeouts->Length(); ++i) {
--- a/purplexpcom/src/purpleTimer.h
+++ b/purplexpcom/src/purpleTimer.h
@@ -35,11 +35,11 @@ class purpleTimer
   static PRUint32 AddTimeout(PRUint32 aInterval,
                              GSourceFunc aFunction,
                              gpointer aData);
   static void ExecTimer(nsITimer *aTimer, void *aTimerClosure);
   static gboolean CancelTimer(PRUint32 aId);
   static nsresult CancelTimerFromAccountId(PRUint32 aAccountId);
 
  private:
-  static nsTArray<nsRefPtr<purpleTimeout> > *sTimeouts;
+  static nsTArray<RefPtr<purpleTimeout> > *sTimeouts;
   static PRUint32 sLastTimer;
 };