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 350031 d632eadae7e364e18124a2aab0936cf333850702
parent 350030 25ca86f29088fae3ac4b8aa48a83a6a1f99bb7c8
child 350032 6249384ff58d9b902612c0c926f81b1a2912725f
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn, lizzard
bugs1295622
milestone50.0a2
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
@@ -1126,17 +1126,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");
 
@@ -1146,19 +1148,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;
 }