Bug 1329467 - Drop non-SPS version of AutoProfilerRegister. r?mstange draft
authorJan Beich <jbeich@FreeBSD.org>
Mon, 09 Jan 2017 23:03:22 +0000
changeset 457789 431251ee911f1d4aa92039b542a25787b907b235
parent 457788 79e9d56a9608129fbcba9d89c19a96b325a5d6fe
child 541592 a67280d04e7c0232047e84d517a359bd7c6737d3
push id40894
push userbmo:jbeich@FreeBSD.org
push dateMon, 09 Jan 2017 23:05:30 +0000
reviewersmstange
bugs1329467
milestone53.0a1
Bug 1329467 - Drop non-SPS version of AutoProfilerRegister. r?mstange MozReview-Commit-ID: 9lZLPAi5ZZT
tools/profiler/public/GeckoProfiler.h
tools/profiler/public/GeckoProfilerImpl.h
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -242,29 +242,16 @@ static inline void profiler_js_operation
 static inline double profiler_time() { return 0; }
 static inline double profiler_time(const mozilla::TimeStamp& aTime) { return 0; }
 
 static inline bool profiler_in_privacy_mode() { return false; }
 
 static inline void profiler_log(const char *str) {}
 static inline void profiler_log(const char *fmt, va_list args) {}
 
-namespace mozilla {
-
-class AutoProfilerRegister final MOZ_STACK_CLASS
-{
-public:
-  explicit AutoProfilerRegister(const char* aName) {}
-private:
-  AutoProfilerRegister(const AutoProfilerRegister&) = delete;
-  AutoProfilerRegister& operator=(const AutoProfilerRegister&) = delete;
-};
-
-} // namespace mozilla
-
 #else
 
 #include "GeckoProfilerImpl.h"
 
 #endif
 
 namespace mozilla {
 
@@ -337,11 +324,31 @@ public:
   }
 
 protected:
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
   const char* mCategory;
   const char* mInfo;
 };
 
+/**
+ * Convenience class to register and unregister a thread with the profiler.
+ * Needs to be the first object on the stack of the thread.
+ */
+class MOZ_STACK_CLASS AutoProfilerRegister final
+{
+public:
+  explicit AutoProfilerRegister(const char* aName)
+  {
+    profiler_register_thread(aName, this);
+  }
+  ~AutoProfilerRegister()
+  {
+    profiler_unregister_thread();
+  }
+private:
+  AutoProfilerRegister(const AutoProfilerRegister&) = delete;
+  AutoProfilerRegister& operator=(const AutoProfilerRegister&) = delete;
+};
+
 } // namespace mozilla
 
 #endif // ifndef SAMPLER_H
--- a/tools/profiler/public/GeckoProfilerImpl.h
+++ b/tools/profiler/public/GeckoProfilerImpl.h
@@ -427,36 +427,16 @@ public:
   ~SamplerStackFramePrintfRAII() {
     mozilla_sampler_call_exit(mHandle);
   }
 private:
   char mDest[SAMPLER_MAX_STRING];
   void* mHandle;
 };
 
-/**
- * Convenience class to register and unregister a thread with the profiler.
- * Needs to be the first object on the stack of the thread.
- */
-class MOZ_STACK_CLASS AutoProfilerRegister final
-{
-public:
-  explicit AutoProfilerRegister(const char* aName)
-  {
-    profiler_register_thread(aName, this);
-  }
-  ~AutoProfilerRegister()
-  {
-    profiler_unregister_thread();
-  }
-private:
-  AutoProfilerRegister(const AutoProfilerRegister&) = delete;
-  AutoProfilerRegister& operator=(const AutoProfilerRegister&) = delete;
-};
-
 } // namespace mozilla
 
 inline PseudoStack* mozilla_get_pseudo_stack(void)
 {
   if (!stack_key_initialized)
     return nullptr;
   return tlsPseudoStack.get();
 }