Bug 1429904 - Remove ProfileBuffer::Reset(). r?njn draft
authorMarkus Stange <mstange@themasta.com>
Thu, 15 Feb 2018 21:49:05 -0500
changeset 762112 e76187fc21bf5694a88625818075556ecb1b39be
parent 762111 891d9289bd4a2b92cdc750ee9c5304392171800a
child 765429 6d91d0cc7d61af160b2ccd340adf23cb41389eed
push id101088
push userbmo:mstange@themasta.com
push dateThu, 01 Mar 2018 20:52:26 +0000
reviewersnjn
bugs1429904
milestone60.0a1
Bug 1429904 - Remove ProfileBuffer::Reset(). r?njn MozReview-Commit-ID: AzIyYByoesS
tools/profiler/core/ProfileBuffer.cpp
tools/profiler/core/ProfileBuffer.h
--- a/tools/profiler/core/ProfileBuffer.cpp
+++ b/tools/profiler/core/ProfileBuffer.cpp
@@ -105,27 +105,16 @@ ProfileBuffer::DeleteExpiredStoredMarker
   // Delete markers of samples that have been overwritten due to circular
   // buffer wraparound.
   while (mStoredMarkers.peek() &&
          mStoredMarkers.peek()->HasExpired(mRangeStart)) {
     delete mStoredMarkers.popHead();
   }
 }
 
-void
-ProfileBuffer::Reset()
-{
-  // Empty the buffer (make sure that mRangeEnd - mRangeStart == 0) and
-  // increase the positions by twice the buffer size for good measure.
-  // This method isn't really intended to stay around for long; the only user
-  // wants to flush only one thread's data and ends up accidentally flushing
-  // the whole buffer which holds data for all threads, see bug 1429904.
-  mRangeStart = mRangeEnd = mRangeEnd + 2 * mEntrySize;
-}
-
 size_t
 ProfileBuffer::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
   size_t n = aMallocSizeOf(this);
   n += aMallocSizeOf(mEntries.get());
 
   // Measurement of the following members may be added later if DMD finds it
   // is worthwhile:
--- a/tools/profiler/core/ProfileBuffer.h
+++ b/tools/profiler/core/ProfileBuffer.h
@@ -81,19 +81,18 @@ public:
   // Mutate |aLastSample| to point to the newly inserted sample.
   // Returns whether duplication was successful.
   bool DuplicateLastSample(int aThreadId,
                            const mozilla::TimeStamp& aProcessStartTime,
                            mozilla::Maybe<uint64_t>& aLastSample);
 
   void AddStoredMarker(ProfilerMarker* aStoredMarker);
 
-  // The following two methods are not signal safe! They delete markers.
+  // The following method is not signal safe!
   void DeleteExpiredStoredMarkers();
-  void Reset();
 
   // Access an entry in the buffer.
   ProfileBufferEntry& GetEntry(uint64_t aPosition) const
   {
     return mEntries[aPosition & mEntryIndexMask];
   }
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;