Bug 1340928 (part 13) - Merge two ProfileGatherer::Start() variants. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 22 Feb 2017 11:35:43 +1100
changeset 373485 e5f1cf49bed1d6466244b54d9d9b2483a1fc0627
parent 373484 34b0a316c4130407a4b7bcaca4be8557945ddb9b
child 373486 d0d5dcaa2c361b2b5bd66f9ff06292098305c726
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1340928
milestone54.0a1
Bug 1340928 (part 13) - Merge two ProfileGatherer::Start() variants. r=mstange. The |nsIFile*| one is only called by the |const nsACString&| one, so this patch combines them.
tools/profiler/gecko/ProfileGatherer.cpp
tools/profiler/gecko/ProfileGatherer.h
--- a/tools/profiler/gecko/ProfileGatherer.cpp
+++ b/tools/profiler/gecko/ProfileGatherer.cpp
@@ -98,25 +98,32 @@ ProfileGatherer::Start(double aSinceTime
 
   if (!mPendingProfiles) {
     Finish();
   }
 }
 
 void
 ProfileGatherer::Start(double aSinceTime,
-                       nsIFile* aFile)
+                       const nsACString& aFileName)
 {
   MOZ_ASSERT(NS_IsMainThread());
+
+  nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
+  nsresult rv = file->InitWithNativePath(aFileName);
+  if (NS_FAILED(rv)) {
+    MOZ_CRASH();
+  }
+
   if (mGathering) {
     return;
   }
 
   mSinceTime = aSinceTime;
-  mFile = aFile;
+  mFile = file;
   mGathering = true;
   mPendingProfiles = 0;
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os) {
     DebugOnly<nsresult> rv =
       os->AddObserver(this, "profiler-subprocess", false);
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "AddObserver failed");
@@ -125,28 +132,16 @@ ProfileGatherer::Start(double aSinceTime
   }
 
   if (!mPendingProfiles) {
     Finish();
   }
 }
 
 void
-ProfileGatherer::Start(double aSinceTime,
-                       const nsACString& aFileName)
-{
-  nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
-  nsresult rv = file->InitWithNativePath(aFileName);
-  if (NS_FAILED(rv)) {
-    MOZ_CRASH();
-  }
-  Start(aSinceTime, file);
-}
-
-void
 ProfileGatherer::Finish()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mIsCancelled) {
     // We somehow got called after we were cancelled! This shouldn't
     // be possible, but doing a belt-and-suspenders check to be sure.
     return;
--- a/tools/profiler/gecko/ProfileGatherer.h
+++ b/tools/profiler/gecko/ProfileGatherer.h
@@ -15,17 +15,16 @@ class ProfileGatherer final : public nsI
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
   explicit ProfileGatherer();
   void WillGatherOOPProfile();
   void GatheredOOPProfile();
   void Start(double aSinceTime, mozilla::dom::Promise* aPromise);
-  void Start(double aSinceTime, nsIFile* aFile);
   void Start(double aSinceTime, const nsACString& aFileName);
   void Cancel();
   void OOPExitProfile(const nsCString& aProfile);
 
 private:
   ~ProfileGatherer() {};
   void Finish();
   void Reset();