Bug 1429904 - Remove unused arguments and return values. r?njn draft
authorMarkus Stange <mstange@themasta.com>
Sat, 17 Feb 2018 19:21:05 -0500
changeset 762111 891d9289bd4a2b92cdc750ee9c5304392171800a
parent 762110 3408bf0d74379d3554f353e4501e616930b100b0
child 762112 e76187fc21bf5694a88625818075556ecb1b39be
push id101088
push userbmo:mstange@themasta.com
push dateThu, 01 Mar 2018 20:52:26 +0000
reviewersnjn
bugs1429904
milestone60.0a1
Bug 1429904 - Remove unused arguments and return values. r?njn MozReview-Commit-ID: 9P0TKavkwgA
tools/profiler/core/ProfileBuffer.h
tools/profiler/core/ProfileBufferEntry.cpp
tools/profiler/core/ProfiledThreadData.cpp
tools/profiler/core/ProfiledThreadData.h
tools/profiler/core/ProfilerBacktrace.cpp
--- a/tools/profiler/core/ProfileBuffer.h
+++ b/tools/profiler/core/ProfileBuffer.h
@@ -60,21 +60,21 @@ public:
   // Stream JSON for samples in the buffer to aWriter, using the supplied
   // UniqueStacks object.
   // Only streams samples for the given thread ID and which were taken at or
   // after aSinceTime.
   // aUniqueStacks needs to contain information about any JIT frames that we
   // might encounter in the buffer, before this method is called. In other
   // words, you need to have called AddJITInfoForRange for every range that
   // might contain JIT frame information before calling this method.
-  bool StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
-                           double aSinceTime, JSContext* cx,
+  void StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
+                           double aSinceTime,
                            UniqueStacks& aUniqueStacks) const;
 
-  bool StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
+  void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
                            const mozilla::TimeStamp& aProcessStartTime,
                            double aSinceTime,
                            UniqueStacks& aUniqueStacks) const;
   void StreamPausedRangesToJSON(SpliceableJSONWriter& aWriter,
                                 double aSinceTime) const;
 
   // Find (via |aLastSample|) the most recent sample for the thread denoted by
   // |aThreadId| and clone it, patching in the current time as appropriate.
--- a/tools/profiler/core/ProfileBufferEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -884,38 +884,34 @@ private:
 //     DynamicStringFragment("u (https")
 //     DynamicStringFragment("://perf-")
 //     DynamicStringFragment("html.io/")
 //     DynamicStringFragment("ac0da204")
 //     DynamicStringFragment("aaa44d75")
 //     DynamicStringFragment("a800.bun")
 //     DynamicStringFragment("dle.js:2")
 //     DynamicStringFragment("5)")
-//
-// This method returns true if it wrote anything to the writer.
-bool
+void
 ProfileBuffer::StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
                                    double aSinceTime,
-                                   JSContext* aContext,
                                    UniqueStacks& aUniqueStacks) const
 {
   UniquePtr<char[]> strbuf = MakeUnique<char[]>(kMaxFrameKeyLength);
 
   // Because this is a format entirely internal to the Profiler, any parsing
   // error indicates a bug in the ProfileBuffer writing or the parser itself,
   // or possibly flaky hardware.
   #define ERROR_AND_CONTINUE(msg) \
     { \
       fprintf(stderr, "ProfileBuffer parse error: %s", msg); \
       MOZ_ASSERT(false, msg); \
       continue; \
     }
 
   EntryGetter e(*this);
-  bool haveSamples = false;
 
   for (;;) {
     // This block skips entries until we find the start of the next sample.
     // This is useful in three situations.
     //
     // - The circular buffer overwrites old entries, so when we start parsing
     //   we might be in the middle of a sample, and we must skip forward to the
     //   start of the next sample.
@@ -1078,20 +1074,18 @@ ProfileBuffer::StreamSamplesToJSON(Splic
     }
 
     if (e.Has() && e.Get().IsUnsharedMemory()) {
       sample.mUSS = Some(e.Get().u.mDouble);
       e.Next();
     }
 
     WriteSample(aWriter, *aUniqueStacks.mUniqueStrings, sample);
-    haveSamples = true;
   }
 
-  return haveSamples;
   #undef ERROR_AND_CONTINUE
 }
 
 void
 ProfileBuffer::AddJITInfoForRange(uint64_t aRangeStart,
                                   int aThreadId, JSContext* aContext,
                                   JITFrameInfo& aJITFrameInfo) const
 {
@@ -1128,46 +1122,41 @@ ProfileBuffer::AddJITInfoForRange(uint64
             aJITAddressConsumer(e.Get().u.mPtr);
           }
           e.Next();
         }
       }
     });
 }
 
-// This method returns true if it wrote anything to the writer.
-bool
+void
 ProfileBuffer::StreamMarkersToJSON(SpliceableJSONWriter& aWriter,
                                    int aThreadId,
                                    const TimeStamp& aProcessStartTime,
                                    double aSinceTime,
                                    UniqueStacks& aUniqueStacks) const
 {
   EntryGetter e(*this);
-  bool haveMarkers = false;
 
   // Stream all markers whose threadId matches aThreadId. We skip other entries,
   // because we process them in StreamSamplesToJSON().
   //
   // NOTE: The ThreadId of a marker is determined by its GetThreadId() method,
   // rather than ThreadId buffer entries, as markers can be added outside of
   // samples.
   while (e.Has()) {
     if (e.Get().IsMarker()) {
       const ProfilerMarker* marker = e.Get().u.mMarker;
       if (marker->GetTime() >= aSinceTime &&
           marker->GetThreadId() == aThreadId) {
         marker->StreamJSON(aWriter, aProcessStartTime, aUniqueStacks);
-        haveMarkers = true;
       }
     }
     e.Next();
   }
-
-  return haveMarkers;
 }
 
 static void
 AddPausedRange(SpliceableJSONWriter& aWriter, const char* aReason,
                const Maybe<double>& aStartTime, const Maybe<double>& aEndTime)
 {
   aWriter.Start();
   if (aStartTime) {
--- a/tools/profiler/core/ProfiledThreadData.cpp
+++ b/tools/profiler/core/ProfiledThreadData.cpp
@@ -53,20 +53,17 @@ ProfiledThreadData::StreamJSON(const Pro
   UniqueStacks uniqueStacks(Move(jitFrameInfo));
 
   aWriter.Start();
   {
     StreamSamplesAndMarkers(mThreadInfo->Name(), mThreadInfo->ThreadId(),
                             aBuffer, aWriter,
                             aProcessStartTime,
                             mThreadInfo->RegisterTime(), mUnregisterTime,
-                            aSinceTime, aCx,
-                            nullptr,
-                            nullptr,
-                            uniqueStacks);
+                            aSinceTime, uniqueStacks);
 
     aWriter.StartObjectProperty("stackTable");
     {
       {
         JSONSchemaWriter schema(aWriter);
         schema.WriteField("prefix");
         schema.WriteField("frame");
       }
@@ -112,19 +109,16 @@ void
 StreamSamplesAndMarkers(const char* aName,
                         int aThreadId,
                         const ProfileBuffer& aBuffer,
                         SpliceableJSONWriter& aWriter,
                         const TimeStamp& aProcessStartTime,
                         const TimeStamp& aRegisterTime,
                         const TimeStamp& aUnregisterTime,
                         double aSinceTime,
-                        JSContext* aContext,
-                        UniquePtr<char[]>&& aPartialSamplesJSON,
-                        UniquePtr<char[]>&& aPartialMarkersJSON,
                         UniqueStacks& aUniqueStacks)
 {
   aWriter.StringProperty("processType",
                          XRE_ChildProcessTypeToString(XRE_GetProcessType()));
 
   aWriter.StringProperty("name", aName);
   aWriter.IntProperty("tid", static_cast<int64_t>(aThreadId));
   aWriter.IntProperty("pid", static_cast<int64_t>(getpid()));
@@ -151,45 +145,34 @@ StreamSamplesAndMarkers(const char* aNam
       schema.WriteField("time");
       schema.WriteField("responsiveness");
       schema.WriteField("rss");
       schema.WriteField("uss");
     }
 
     aWriter.StartArrayProperty("data");
     {
-      if (aPartialSamplesJSON) {
-        // We would only have saved streamed samples during shutdown
-        // streaming, which cares about dumping the entire buffer, and thus
-        // should have passed in 0 for aSinceTime.
-        MOZ_ASSERT(aSinceTime == 0);
-        aWriter.Splice(aPartialSamplesJSON.get());
-      }
       aBuffer.StreamSamplesToJSON(aWriter, aThreadId, aSinceTime,
-                                  aContext, aUniqueStacks);
+                                  aUniqueStacks);
     }
     aWriter.EndArray();
   }
   aWriter.EndObject();
 
   aWriter.StartObjectProperty("markers");
   {
     {
       JSONSchemaWriter schema(aWriter);
       schema.WriteField("name");
       schema.WriteField("time");
       schema.WriteField("data");
     }
 
     aWriter.StartArrayProperty("data");
     {
-      if (aPartialMarkersJSON) {
-        MOZ_ASSERT(aSinceTime == 0);
-        aWriter.Splice(aPartialMarkersJSON.get());
-      }
       aBuffer.StreamMarkersToJSON(aWriter, aThreadId, aProcessStartTime,
                                   aSinceTime, aUniqueStacks);
     }
     aWriter.EndArray();
   }
   aWriter.EndObject();
 }
 
--- a/tools/profiler/core/ProfiledThreadData.h
+++ b/tools/profiler/core/ProfiledThreadData.h
@@ -124,14 +124,11 @@ private:
 void
 StreamSamplesAndMarkers(const char* aName, int aThreadId,
                         const ProfileBuffer& aBuffer,
                         SpliceableJSONWriter& aWriter,
                         const mozilla::TimeStamp& aProcessStartTime,
                         const TimeStamp& aRegisterTime,
                         const TimeStamp& aUnregisterTime,
                         double aSinceTime,
-                        JSContext* aContext,
-                        UniquePtr<char[]>&& aPartialSamplesJSON,
-                        UniquePtr<char[]>&& aPartialMarkersJSON,
                         UniqueStacks& aUniqueStacks);
 
 #endif  // ProfiledThreadData_h
--- a/tools/profiler/core/ProfilerBacktrace.cpp
+++ b/tools/profiler/core/ProfilerBacktrace.cpp
@@ -32,13 +32,10 @@ ProfilerBacktrace::StreamJSON(Spliceable
   // ProfileBuffer::AddJITInfoForRange because mBuffer does not contain any
   // JitReturnAddr entries. For synchronous samples, JIT frames get expanded
   // at sample time.
   StreamSamplesAndMarkers(mName.get(), mThreadId,
                           *mBuffer.get(), aWriter, aProcessStartTime,
                           /* aRegisterTime */ TimeStamp(),
                           /* aUnregisterTime */ TimeStamp(),
                           /* aSinceTime */ 0,
-                          /* aContext */ nullptr,
-                          /* aSavedStreamedSamples */ nullptr,
-                          /* aSavedStreamedMarkers */ nullptr,
                           aUniqueStacks);
 }