Bug 1295622 - Don't crash the content process if a memory report fails. r=njn, a=lizzard
authorJed Davis <jld@mozilla.com>
Fri, 26 Aug 2016 21:29:00 -0400
changeset 340550 e64579bcbcca5cf1e53090107318429b74213ab9
parent 340549 f145c179fc1a7606d0aee00a6a9db085eb4fabe2
child 340551 99bdd0e46a4dc620743e4aa16e2797f347349024
push id6363
push userkwierso@gmail.com
push dateWed, 31 Aug 2016 21:51:03 +0000
treeherdermozilla-beta@99bdd0e46a4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn, lizzard
bugs1295622
milestone49.0
Bug 1295622 - Don't crash the content process if a memory report fails. r=njn, a=lizzard
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1180,17 +1180,19 @@ ContentChild::RecvPMemoryReportRequestCo
     nsCOMPtr<nsIMemoryReporterManager> mgr =
       do_GetService("@mozilla.org/memory-reporter-manager;1");
     rv = mgr->MinimizeMemoryUsage(actor);
     // mgr will eventually call actor->Run()
   } else {
     rv = actor->Run();
   }
 
-  return !NS_WARN_IF(NS_FAILED(rv));
+  // Bug 1295622: don't kill the process just because this failed.
+  NS_WARN_IF(NS_FAILED(rv));
+  return true;
 }
 
 NS_IMETHODIMP MemoryReportRequestChild::Run()
 {
   ContentChild *child = static_cast<ContentChild*>(Manager());
   nsCOMPtr<nsIMemoryReporterManager> mgr =
     do_GetService("@mozilla.org/memory-reporter-manager;1");
 
@@ -1200,19 +1202,22 @@ NS_IMETHODIMP MemoryReportRequestChild::
 
   // Run the reporters.  The callback will turn each measurement into a
   // MemoryReport.
   RefPtr<MemoryReportCallback> cb =
     new MemoryReportCallback(this, process);
   RefPtr<MemoryReportFinishedCallback> finished =
     new MemoryReportFinishedCallback(this);
 
-  return mgr->GetReportsForThisProcessExtended(cb, nullptr, mAnonymize,
-                                               FileDescriptorToFILE(mDMDFile, "wb"),
-                                               finished, nullptr);
+  nsresult rv =
+    mgr->GetReportsForThisProcessExtended(cb, nullptr, mAnonymize,
+                                          FileDescriptorToFILE(mDMDFile, "wb"),
+                                          finished, nullptr);
+  NS_WARN_IF(NS_FAILED(rv));
+  return rv;
 }
 
 bool
 ContentChild::DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor)
 {
   static_cast<MemoryReportRequestChild*>(actor)->Release();
   return true;
 }