Bug 1295622 - Don't crash the content process if a memory report fails. r=njn
authorJed Davis <jld@mozilla.com>
Fri, 26 Aug 2016 21:29:00 -0400
changeset 311790 c9df0314cff2c3034c396b21a875b8fd80a712c2
parent 311789 7dc04679e7f2123e53bddf0f1a104c34d51c76e6
child 311791 396585308c33461063ee9ab01c7063c6e526874b
push id30623
push userryanvm@gmail.com
push dateTue, 30 Aug 2016 13:53:10 +0000
treeherdermozilla-central@b18c8bcdc116 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1295622
milestone51.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 1295622 - Don't crash the content process if a memory report fails. r=njn
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1055,17 +1055,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");
 
@@ -1075,20 +1077,22 @@ NS_IMETHODIMP MemoryReportRequestChild::
 
   // Run the reporters.  The callback will turn each measurement into a
   // MemoryReport.
   RefPtr<HandleReportCallback> handleReport =
     new HandleReportCallback(this, process);
   RefPtr<FinishReportingCallback> finishReporting =
     new FinishReportingCallback(this);
 
-  return mgr->GetReportsForThisProcessExtended(handleReport, nullptr,
-                                               mAnonymize,
-                                               FileDescriptorToFILE(mDMDFile, "wb"),
-                                               finishReporting, nullptr);
+  nsresult rv =
+    mgr->GetReportsForThisProcessExtended(handleReport, nullptr, mAnonymize,
+                                          FileDescriptorToFILE(mDMDFile, "wb"),
+                                          finishReporting, nullptr);
+  NS_WARN_IF(NS_FAILED(rv));
+  return rv;
 }
 
 bool
 ContentChild::DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor)
 {
   static_cast<MemoryReportRequestChild*>(actor)->Release();
   return true;
 }