Bug 1312144 - Part 0: Cleanup formatting. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Mon, 24 Oct 2016 11:31:14 -0700
changeset 319195 70280cfa7c118cf4bd686b55ece44534d3128d5b
parent 319194 9a3b906728b2f0244a74c841930e00372fd6e7f7
child 319196 3eb7745dd704c2596eea71a2da5a08695828e012
push id83094
push usererahm@mozilla.com
push dateMon, 24 Oct 2016 18:31:20 +0000
treeherdermozilla-inbound@3eb7745dd704 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1312144
milestone52.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 1312144 - Part 0: Cleanup formatting. r=froydnj This just cleans up some indentation and if statements. MozReview-Commit-ID: JT585Zg4iJY
xpfe/components/directory/nsDirectoryViewer.cpp
--- a/xpfe/components/directory/nsDirectoryViewer.cpp
+++ b/xpfe/components/directory/nsDirectoryViewer.cpp
@@ -906,147 +906,154 @@ nsHTTPIndex::AddElement(nsIRDFResource *
 
     return(NS_OK);
 }
 
 void
 nsHTTPIndex::FireTimer(nsITimer* aTimer, void* aClosure)
 {
   nsHTTPIndex *httpIndex = static_cast<nsHTTPIndex *>(aClosure);
-  if (!httpIndex)	return;
-  
+  if (!httpIndex)
+    return;
+
   // don't return out of this loop as mTimer may need to be cancelled afterwards
-  uint32_t    numItems = 0;
+  uint32_t numItems = 0;
   if (httpIndex->mConnectionList)
   {
-        httpIndex->mConnectionList->Count(&numItems);
-        if (numItems > 0)
+    httpIndex->mConnectionList->Count(&numItems);
+    if (numItems > 0)
+    {
+      nsCOMPtr<nsISupports> isupports;
+      httpIndex->mConnectionList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
+      httpIndex->mConnectionList->RemoveElementAt((uint32_t)0);
+
+      nsCOMPtr<nsIRDFResource> source;
+      if (isupports)
+        aSource = do_QueryInterface(isupports);
+
+      nsXPIDLCString uri;
+      if (aSource) {
+        httpIndex->GetDestination(aSource, uri);
+      }
+
+      if (!uri) {
+        NS_ERROR("Could not reconstruct uri");
+        return;
+      }
+
+      nsresult rv = NS_OK;
+      nsCOMPtr<nsIURI>	url;
+
+      rv = NS_NewURI(getter_AddRefs(url), uri.get());
+      nsCOMPtr<nsIChannel> channel;
+      if (NS_SUCCEEDED(rv) && (url)) {
+        rv = NS_NewChannel(getter_AddRefs(channel),
+            url,
+            nsContentUtils::GetSystemPrincipal(),
+            nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+            nsIContentPolicy::TYPE_OTHER);
+      }
+      if (NS_SUCCEEDED(rv) && (channel)) {
+        channel->SetNotificationCallbacks(httpIndex);
+        rv = channel->AsyncOpen2(httpIndex);
+      }
+    }
+  }
+
+  if (httpIndex->mNodeList)
+  {
+    httpIndex->mNodeList->Count(&numItems);
+    if (numItems > 0)
+    {
+      // account for order required: src, prop, then target
+      numItems /=3;
+      if (numItems > 10)
+        numItems = 10;
+
+      int32_t loop;
+      for (loop=0; loop<(int32_t)numItems; loop++)
+      {
+        nsCOMPtr<nsISupports> isupports;
+        httpIndex->mNodeList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
+        httpIndex->mNodeList->RemoveElementAt((uint32_t)0);
+        nsCOMPtr<nsIRDFResource> src;
+        if (isupports)
+          src = do_QueryInterface(isupports);
+        httpIndex->mNodeList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
+        httpIndex->mNodeList->RemoveElementAt((uint32_t)0);
+        nsCOMPtr<nsIRDFResource> prop;
+        if (isupports)
+          prop = do_QueryInterface(isupports);
+
+        httpIndex->mNodeList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
+        httpIndex->mNodeList->RemoveElementAt((uint32_t)0);
+        nsCOMPtr<nsIRDFNode> target;
+        if (isupports)
+          target = do_QueryInterface(isupports);
+
+        if (src && prop && target)
         {
-          nsCOMPtr<nsISupports>   isupports;
-          httpIndex->mConnectionList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
-          httpIndex->mConnectionList->RemoveElementAt((uint32_t)0);
-          
-          nsCOMPtr<nsIRDFResource>    aSource;
-          if (isupports)  aSource = do_QueryInterface(isupports);
-          
-          nsXPIDLCString uri;
-          if (aSource) {
-            httpIndex->GetDestination(aSource, uri);
+          if (prop.get() == httpIndex->kNC_Loading)
+          {
+            httpIndex->Unassert(src, prop, target);
           }
-          
-          if (!uri) {
-            NS_ERROR("Could not reconstruct uri");
-            return;
-          }
-          
-          nsresult            rv = NS_OK;
-          nsCOMPtr<nsIURI>	url;
-          
-          rv = NS_NewURI(getter_AddRefs(url), uri.get());
-          nsCOMPtr<nsIChannel>	channel;
-          if (NS_SUCCEEDED(rv) && (url)) {
-            rv = NS_NewChannel(getter_AddRefs(channel),
-                               url,
-                               nsContentUtils::GetSystemPrincipal(),
-                               nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                               nsIContentPolicy::TYPE_OTHER);
-          }
-          if (NS_SUCCEEDED(rv) && (channel)) {
-            channel->SetNotificationCallbacks(httpIndex);
-            rv = channel->AsyncOpen2(httpIndex);
+          else
+          {
+            httpIndex->Assert(src, prop, target, true);
           }
         }
-  }
-    if (httpIndex->mNodeList)
-    {
-        httpIndex->mNodeList->Count(&numItems);
-        if (numItems > 0)
-        {
-            // account for order required: src, prop, then target
-            numItems /=3;
-            if (numItems > 10)  numItems = 10;
-          
-            int32_t loop;
-            for (loop=0; loop<(int32_t)numItems; loop++)
-            {
-                nsCOMPtr<nsISupports>   isupports;
-                httpIndex->mNodeList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
-                httpIndex->mNodeList->RemoveElementAt((uint32_t)0);
-                nsCOMPtr<nsIRDFResource>    src;
-                if (isupports)  src = do_QueryInterface(isupports);
-                httpIndex->mNodeList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
-                httpIndex->mNodeList->RemoveElementAt((uint32_t)0);
-                nsCOMPtr<nsIRDFResource>    prop;
-                if (isupports)  prop = do_QueryInterface(isupports);
-                
-                httpIndex->mNodeList->GetElementAt((uint32_t)0, getter_AddRefs(isupports));
-                httpIndex->mNodeList->RemoveElementAt((uint32_t)0);
-                nsCOMPtr<nsIRDFNode>    target;
-                if (isupports)  target = do_QueryInterface(isupports);
-                
-                if (src && prop && target)
-                {
-                    if (prop.get() == httpIndex->kNC_Loading)
-                    {
-                        httpIndex->Unassert(src, prop, target);
-                    }
-                    else
-                    {
-                        httpIndex->Assert(src, prop, target, true);
-                    }
-                }
-            }                
-        }
-    }
-
-    bool refireTimer = false;
-    // check both lists to see if the timer needs to continue firing
-    if (httpIndex->mConnectionList)
-    {
-        httpIndex->mConnectionList->Count(&numItems);
-        if (numItems > 0)
-        {
-            refireTimer = true;
-        }
-        else
-        {
-            httpIndex->mConnectionList->Clear();
-        }
-    }
-    if (httpIndex->mNodeList)
-    {
-        httpIndex->mNodeList->Count(&numItems);
-        if (numItems > 0)
-        {
-            refireTimer = true;
-        }
-        else
-        {
-            httpIndex->mNodeList->Clear();
-        }
-    }
-
-    // be sure to cancel the timer, as it holds a
-    // weak reference back to nsHTTPIndex
-    httpIndex->mTimer->Cancel();
-    httpIndex->mTimer = nullptr;
-    
-    // after firing off any/all of the connections be sure
-    // to cancel the timer if we don't need to refire it
-    if (refireTimer)
-    {
-      httpIndex->mTimer = do_CreateInstance("@mozilla.org/timer;1");
-      if (httpIndex->mTimer)
-      {
-        httpIndex->mTimer->InitWithFuncCallback(nsHTTPIndex::FireTimer, aClosure, 10,
-                                                nsITimer::TYPE_ONE_SHOT);
-        // Note: don't addref "this" as we'll cancel the
-        // timer in the httpIndex destructor
       }
     }
+  }
+
+  bool refireTimer = false;
+  // check both lists to see if the timer needs to continue firing
+  if (httpIndex->mConnectionList)
+  {
+    httpIndex->mConnectionList->Count(&numItems);
+    if (numItems > 0)
+    {
+      refireTimer = true;
+    }
+    else
+    {
+      httpIndex->mConnectionList->Clear();
+    }
+  }
+  if (httpIndex->mNodeList)
+  {
+    httpIndex->mNodeList->Count(&numItems);
+    if (numItems > 0)
+    {
+      refireTimer = true;
+    }
+    else
+    {
+      httpIndex->mNodeList->Clear();
+    }
+  }
+
+  // be sure to cancel the timer, as it holds a
+  // weak reference back to nsHTTPIndex
+  httpIndex->mTimer->Cancel();
+  httpIndex->mTimer = nullptr;
+
+  // after firing off any/all of the connections be sure
+  // to cancel the timer if we don't need to refire it
+  if (refireTimer)
+  {
+    httpIndex->mTimer = do_CreateInstance("@mozilla.org/timer;1");
+    if (httpIndex->mTimer)
+    {
+      httpIndex->mTimer->InitWithFuncCallback(nsHTTPIndex::FireTimer, aClosure, 10,
+          nsITimer::TYPE_ONE_SHOT);
+      // Note: don't addref "this" as we'll cancel the
+      // timer in the httpIndex destructor
+    }
+  }
 }
 
 NS_IMETHODIMP
 nsHTTPIndex::Assert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget,
 			bool aTruthValue)
 {
 	nsresult	rv = NS_ERROR_UNEXPECTED;
 	if (mInner)