Bug 1065258 (part 4) - Move FinishReportingCallback earlier. r=jld.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 10 Sep 2014 00:32:58 -0700
changeset 227990 d5e7447df8644cab2a0bca1c3aac0a32d9fed9e3
parent 227989 dd2f3e9c31066fb3c219dda9423d90bcada360f6
child 227991 f43ce1b77bee82035b24d449626bba60b94cabbe
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld
bugs1065258
milestone35.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 1065258 (part 4) - Move FinishReportingCallback earlier. r=jld.
xpcom/base/nsMemoryInfoDumper.cpp
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -572,16 +572,57 @@ DumpHeader(nsIGZFileWriter* aWriter)
 static nsresult
 DumpFooter(nsIGZFileWriter* aWriter)
 {
   DUMP(aWriter, "\n  ]\n}\n");
 
   return NS_OK;
 }
 
+// This dumps the JSON footer and closes the file, and then calls the given
+// nsIFinishDumpingCallback.
+class FinishReportingCallback MOZ_FINAL : public nsIFinishReportingCallback
+{
+public:
+  NS_DECL_ISUPPORTS
+
+  FinishReportingCallback(nsIFinishDumpingCallback* aFinishDumping,
+                          nsISupports* aFinishDumpingData)
+    : mFinishDumping(aFinishDumping)
+    , mFinishDumpingData(aFinishDumpingData)
+  {
+  }
+
+  NS_IMETHOD Callback(nsISupports* aData)
+  {
+    nsCOMPtr<nsIGZFileWriter> writer = do_QueryInterface(aData);
+    NS_ENSURE_TRUE(writer, NS_ERROR_FAILURE);
+
+    nsresult rv = DumpFooter(writer);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    rv = writer->Finish();
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    if (!mFinishDumping) {
+      return NS_OK;
+    }
+
+    return mFinishDumping->Callback(mFinishDumpingData);
+  }
+
+private:
+  ~FinishReportingCallback() {}
+
+  nsCOMPtr<nsIFinishDumpingCallback> mFinishDumping;
+  nsCOMPtr<nsISupports> mFinishDumpingData;
+};
+
+NS_IMPL_ISUPPORTS(FinishReportingCallback, nsIFinishReportingCallback)
+
 class TempDirMemoryFinishCallback MOZ_FINAL : public nsIFinishReportingCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
   TempDirMemoryFinishCallback(nsGZFileWriter* aReportsWriter,
                               nsIFile* aReportsTmpFile,
                               const nsCString& aReportsFinalFilename)
@@ -803,57 +844,16 @@ nsMemoryInfoDumper::DumpDMDToFile(FILE* 
   dmd::AnalyzeReports(w);
 
   rv = dmdWriter->Finish();
   NS_WARN_IF(NS_FAILED(rv));
   return rv;
 }
 #endif  // MOZ_DMD
 
-// This dumps the JSON footer and closes the file, and then calls the given
-// nsIFinishDumpingCallback.
-class FinishReportingCallback MOZ_FINAL : public nsIFinishReportingCallback
-{
-public:
-  NS_DECL_ISUPPORTS
-
-  FinishReportingCallback(nsIFinishDumpingCallback* aFinishDumping,
-                          nsISupports* aFinishDumpingData)
-    : mFinishDumping(aFinishDumping)
-    , mFinishDumpingData(aFinishDumpingData)
-  {
-  }
-
-  NS_IMETHOD Callback(nsISupports* aData)
-  {
-    nsCOMPtr<nsIGZFileWriter> writer = do_QueryInterface(aData);
-    NS_ENSURE_TRUE(writer, NS_ERROR_FAILURE);
-
-    nsresult rv = DumpFooter(writer);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = writer->Finish();
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (!mFinishDumping) {
-      return NS_OK;
-    }
-
-    return mFinishDumping->Callback(mFinishDumpingData);
-  }
-
-private:
-  ~FinishReportingCallback() {}
-
-  nsCOMPtr<nsIFinishDumpingCallback> mFinishDumping;
-  nsCOMPtr<nsISupports> mFinishDumpingData;
-};
-
-NS_IMPL_ISUPPORTS(FinishReportingCallback, nsIFinishReportingCallback)
-
 NS_IMETHODIMP
 nsMemoryInfoDumper::DumpMemoryReportsToNamedFile(
   const nsAString& aFilename,
   nsIFinishDumpingCallback* aFinishDumping,
   nsISupports* aFinishDumpingData,
   bool aAnonymize)
 {
   MOZ_ASSERT(!aFilename.IsEmpty());