Bug 1372864 - Change CheckResponsivenessTask::mMonitor to a Mutex. r=mstange.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 14 Jun 2017 21:06:41 +1000
changeset 363979 e7e17d33bbdaf16f6f84438d6d350c4211f7bc11
parent 363978 a7b4774740d77165f010aaab4af98e6e64044311
child 363980 e17a88314c71d7b3962fdb93faaa44c956f7f425
push id91463
push usernnethercote@mozilla.com
push dateThu, 15 Jun 2017 06:59:04 +0000
treeherdermozilla-inbound@e7e17d33bbda [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1372864
milestone56.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 1372864 - Change CheckResponsivenessTask::mMonitor to a Mutex. r=mstange. A mutex is good enough.
tools/profiler/gecko/ThreadResponsiveness.cpp
--- a/tools/profiler/gecko/ThreadResponsiveness.cpp
+++ b/tools/profiler/gecko/ThreadResponsiveness.cpp
@@ -3,28 +3,28 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ThreadResponsiveness.h"
 #include "platform.h"
 #include "nsComponentManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsITimer.h"
-#include "mozilla/Monitor.h"
+#include "mozilla/Mutex.h"
 
-using mozilla::Monitor;
-using mozilla::MonitorAutoLock;
+using mozilla::Mutex;
+using mozilla::MutexAutoLock;
 using mozilla::TimeStamp;
 
 class CheckResponsivenessTask : public mozilla::Runnable,
                                 public nsITimerCallback {
 public:
   CheckResponsivenessTask()
     : mLastTracerTime(TimeStamp::Now())
-    , mMonitor("CheckResponsivenessTask")
+    , mMutex("CheckResponsivenessTask")
     , mTimer(nullptr)
     , mHasEverBeenSuccessfullyDispatched(false)
     , mStop(false)
   {
   }
 
 protected:
   ~CheckResponsivenessTask()
@@ -48,17 +48,17 @@ public:
     if (NS_SUCCEEDED(rv)) {
       mHasEverBeenSuccessfullyDispatched = true;
     }
   }
 
   // Can only run on the main thread.
   NS_IMETHOD Run() override
   {
-    MonitorAutoLock mon(mMonitor);
+    MutexAutoLock mon(mMutex);
     if (mStop)
       return NS_OK;
 
     // This is raced on because we might pause the thread here
     // for profiling so if we tried to use a monitor to protect
     // mLastTracerTime we could deadlock. We're risking seeing
     // a partial write which will show up as an outlier in our
     // performance data.
@@ -73,29 +73,29 @@ public:
 
   NS_IMETHOD Notify(nsITimer* aTimer) final
   {
     NS_DispatchToMainThread(this);
     return NS_OK;
   }
 
   void Terminate() {
-    MonitorAutoLock mon(mMonitor);
+    MutexAutoLock mon(mMutex);
     mStop = true;
   }
 
   const TimeStamp& GetLastTracerTime() const {
     return mLastTracerTime;
   }
 
   NS_DECL_ISUPPORTS_INHERITED
 
 private:
   TimeStamp mLastTracerTime;
-  Monitor mMonitor;
+  Mutex mMutex;
   nsCOMPtr<nsITimer> mTimer;
   bool mHasEverBeenSuccessfullyDispatched; // only accessed on the "update" thread
   bool mStop;
 };
 
 NS_IMPL_ISUPPORTS_INHERITED(CheckResponsivenessTask, mozilla::Runnable,
                             nsITimerCallback)