Bug 1153056 - Fix about:webrtc to not blank on zero allocated PeerConnections. r=jesup, a=sledru
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 10 Apr 2015 08:40:17 -0400
changeset 258486 e487ace8d7f9
parent 258485 4954faa47dd0
child 258487 97856a6ac44d
push id4678
push userryanvm@gmail.com
push date2015-04-15 13:36 +0000
treeherdermozilla-beta@e487ace8d7f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, sledru
bugs1153056
milestone38.0
Bug 1153056 - Fix about:webrtc to not blank on zero allocated PeerConnections. r=jesup, a=sledru
media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
--- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
+++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
@@ -162,41 +162,36 @@ WebrtcGlobalInformation::GetAllStats(
          p != ctx->mPeerConnections.end();
          ++p) {
       MOZ_ASSERT(p->second);
 
       if (!pcIdFilter.WasPassed() ||
           pcIdFilter.Value().EqualsASCII(p->second->GetIdAsAscii().c_str())) {
         if (p->second->HasMedia()) {
           queries->append(nsAutoPtr<RTCStatsQuery>(new RTCStatsQuery(true)));
-          if (NS_WARN_IF(NS_FAILED(p->second->BuildStatsQuery_m(nullptr, // all tracks
-                                                                queries->back())))) {
-            queries->popBack();
-          } else {
-            MOZ_ASSERT(queries->back()->report);
+          rv = p->second->BuildStatsQuery_m(nullptr, queries->back()); // all tracks
+          if (NS_WARN_IF(NS_FAILED(rv))) {
+            aRv.Throw(rv);
+            return;
           }
+          MOZ_ASSERT(queries->back()->report);
         }
       }
     }
   }
 
-  if (!queries->empty()) {
-    // CallbackObject does not support threadsafe refcounting, and must be
-    // destroyed on main.
-    nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
-      new nsMainThreadPtrHolder<WebrtcGlobalStatisticsCallback>(&aStatsCallback));
+  // CallbackObject does not support threadsafe refcounting, and must be
+  // destroyed on main.
+  nsMainThreadPtrHandle<WebrtcGlobalStatisticsCallback> callbackHandle(
+    new nsMainThreadPtrHolder<WebrtcGlobalStatisticsCallback>(&aStatsCallback));
 
-    rv = RUN_ON_THREAD(stsThread,
-                       WrapRunnableNM(&GetAllStats_s, callbackHandle, queries),
-                       NS_DISPATCH_NORMAL);
-
-    aRv = rv;
-  } else {
-    aRv = NS_OK;
-  }
+  rv = RUN_ON_THREAD(stsThread,
+                     WrapRunnableNM(&GetAllStats_s, callbackHandle, queries),
+                     NS_DISPATCH_NORMAL);
+  aRv = rv;
 }
 
 void
 WebrtcGlobalInformation::GetLogging(
   const GlobalObject& aGlobal,
   const nsAString& aPattern,
   WebrtcGlobalLoggingCallback& aLoggingCallback,
   ErrorResult& aRv)