Bug 1328378 (part 2) - Remove BeginUnwind() and EndUnwind(). r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 27 Feb 2017 12:31:44 +1100
changeset 374172 16d6cb0afff570c36c5aea1e4b9f59a86abc75a5
parent 374171 63fa61a6e3d12a7d562e5108706b8d0a75dc7e4b
child 374173 6b7e1d039956e207ca24ebfc2629ebd3b6f3c3f0
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
bugs1328378
milestone54.0a1
Bug 1328378 (part 2) - Remove BeginUnwind() and EndUnwind(). r=mstange. Both of these functions are now trivial and identical in both ThreadInfo and SyncProfile. This patch inlines and removes them.
tools/profiler/core/SyncProfile.cpp
tools/profiler/core/SyncProfile.h
tools/profiler/core/ThreadInfo.cpp
tools/profiler/core/ThreadInfo.h
tools/profiler/core/platform.cpp
--- a/tools/profiler/core/SyncProfile.cpp
+++ b/tools/profiler/core/SyncProfile.cpp
@@ -14,21 +14,15 @@ SyncProfile::SyncProfile(int aThreadId, 
   SetProfile(new ProfileBuffer(GET_BACKTRACE_DEFAULT_ENTRIES));
 }
 
 SyncProfile::~SyncProfile()
 {
   MOZ_COUNT_DTOR(SyncProfile);
 }
 
-void
-SyncProfile::EndUnwind()
-{
-  ThreadInfo::EndUnwind();
-}
-
 // SyncProfiles' stacks are deduplicated in the context of the containing
 // profile in which the backtrace is as a marker payload.
 void
 SyncProfile::StreamJSON(SpliceableJSONWriter& aWriter, UniqueStacks& aUniqueStacks)
 {
   ThreadInfo::StreamSamplesAndMarkers(aWriter, /* aSinceTime = */ 0, aUniqueStacks);
 }
--- a/tools/profiler/core/SyncProfile.h
+++ b/tools/profiler/core/SyncProfile.h
@@ -14,16 +14,14 @@ class SyncProfile : public ThreadInfo
 public:
   SyncProfile(int aThreadId, PseudoStack* aStack);
   ~SyncProfile();
 
   // SyncProfiles' stacks are deduplicated in the context of the containing
   // profile in which the backtrace is as a marker payload.
   void StreamJSON(SpliceableJSONWriter& aWriter, UniqueStacks& aUniqueStacks);
 
-  virtual void EndUnwind();
-
 private:
   friend class ProfilerBacktrace;
 };
 
 #endif // __SYNCPROFILE_H
 
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -232,28 +232,16 @@ ThreadInfo::FlushSamplesAndMarkers()
     mSavedStreamedMarkers = b.WriteFunc()->CopyData();
   }
 
   // Reset the buffer. Attempting to symbolicate JS samples after mContext has
   // gone away will crash.
   mBuffer->reset();
 }
 
-void
-ThreadInfo::BeginUnwind()
-{
-  mMutex->Lock();
-}
-
-void
-ThreadInfo::EndUnwind()
-{
-  mMutex->Unlock();
-}
-
 mozilla::Mutex&
 ThreadInfo::GetMutex()
 {
   return *mMutex.get();
 }
 
 void
 ThreadInfo::DuplicateLastSample(const TimeStamp& aStartTime)
--- a/tools/profiler/core/ThreadInfo.h
+++ b/tools/profiler/core/ThreadInfo.h
@@ -65,19 +65,16 @@ public:
   void addStoredMarker(ProfilerMarker* aStoredMarker);
   mozilla::Mutex& GetMutex();
   void StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime = 0);
 
   // Call this method when the JS entries inside the buffer are about to
   // become invalid, i.e., just before JS shutdown.
   void FlushSamplesAndMarkers();
 
-  void BeginUnwind();
-  virtual void EndUnwind();
-
   void DuplicateLastSample(const mozilla::TimeStamp& aStartTime);
 
   ThreadResponsiveness* GetThreadResponsiveness() { return &mRespInfo; }
 
   void UpdateThreadResponsiveness() {
     mRespInfo.Update(mIsMainThread, mThread);
   }
 
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -2454,19 +2454,19 @@ profiler_get_backtrace()
 #else
 # error "unknown platform"
 #endif
 #endif
 
   sample.isSamplingCurrentThread = true;
   sample.timestamp = mozilla::TimeStamp::Now();
 
-  profile->BeginUnwind();
+  profile->GetMutex().Lock();
   Tick(&sample);
-  profile->EndUnwind();
+  profile->GetMutex().Unlock();
 
   return UniqueProfilerBacktrace(new ProfilerBacktrace(profile));
 }
 
 void
 ProfilerBacktraceDestructor::operator()(ProfilerBacktrace* aBacktrace)
 {
   delete aBacktrace;