diff --git a/layout/base/RestyleTracker.cpp b/layout/base/RestyleTracker.cpp index af896af5016..9ee2a40433f 100644 --- a/layout/base/RestyleTracker.cpp +++ b/layout/base/RestyleTracker.cpp @@ -83,7 +83,7 @@ CollectLaterSiblings(nsISupports* aElement, struct RestyleEnumerateData : RestyleTracker::Hints { nsRefPtr mElement; -#ifdef MOZ_ENABLE_PROFILER_SPS +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) UniquePtr mBacktrace; #endif }; @@ -143,7 +143,7 @@ CollectRestyles(nsISupports* aElement, currentRestyle->mElement = element; currentRestyle->mRestyleHint = aData->mRestyleHint; currentRestyle->mChangeHint = aData->mChangeHint; -#ifdef MOZ_ENABLE_PROFILER_SPS +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) currentRestyle->mBacktrace = Move(aData->mBacktrace); #endif @@ -311,8 +311,8 @@ RestyleTracker::DoProcessRestyles() continue; } +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) Maybe profilerRAII; -#ifdef MOZ_ENABLE_PROFILER_SPS if (profiler_feature_active("restyle")) { profilerRAII.emplace("Paint", "Styles", Move(data->mBacktrace)); } @@ -353,8 +353,8 @@ RestyleTracker::DoProcessRestyles() index++, collector.count); LOG_RESTYLE_INDENT(); +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) Maybe profilerRAII; -#ifdef MOZ_ENABLE_PROFILER_SPS if (profiler_feature_active("restyle")) { profilerRAII.emplace("Paint", "Styles", Move(currentRestyle->mBacktrace)); } diff --git a/layout/base/RestyleTracker.h b/layout/base/RestyleTracker.h index ef984a21fe8..3512181dc89 100644 --- a/layout/base/RestyleTracker.h +++ b/layout/base/RestyleTracker.h @@ -18,7 +18,7 @@ #include "mozilla/RestyleLogging.h" #include "GeckoProfiler.h" -#ifdef MOZ_ENABLE_PROFILER_SPS +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) #include "ProfilerBacktrace.h" #endif @@ -296,7 +296,7 @@ public: // that we called AddPendingRestyle for and found the element this is // the RestyleData for as its nearest restyle root. nsTArray> mDescendants; -#ifdef MOZ_ENABLE_PROFILER_SPS +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) UniquePtr mBacktrace; #endif }; @@ -397,7 +397,7 @@ RestyleTracker::AddPendingRestyleToTable(Element* aElement, if (!existingData) { RestyleData* rd = new RestyleData(aRestyleHint, aMinChangeHint); -#ifdef MOZ_ENABLE_PROFILER_SPS +#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(MOZILLA_XPCOMRT_API) if (profiler_feature_active("restyle")) { rd->mBacktrace.reset(profiler_get_backtrace()); } diff --git a/tools/profiler/GeckoProfiler.h b/tools/profiler/GeckoProfiler.h index f17998da63a..77760d64716 100644 --- a/tools/profiler/GeckoProfiler.h +++ b/tools/profiler/GeckoProfiler.h @@ -50,10 +50,6 @@ #define SAMPLER_H #include "js/TypeDecls.h" -#include "mozilla/GuardObjects.h" -#include "mozilla/UniquePtr.h" -#include "mozilla/GuardObjects.h" -#include "ProfilerBacktrace.h" namespace mozilla { class TimeStamp; @@ -229,28 +225,4 @@ public: } }; -class ProfilerBacktrace; - -class MOZ_STACK_CLASS GeckoProfilerTracingRAII { -public: - GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo, - mozilla::UniquePtr aBacktrace - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : mCategory(aCategory) - , mInfo(aInfo) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - profiler_tracing(mCategory, mInfo, aBacktrace.release(), TRACING_INTERVAL_START); - } - - ~GeckoProfilerTracingRAII() { - profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_END); - } - -protected: - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - const char* mCategory; - const char* mInfo; -}; - #endif // ifndef SAMPLER_H diff --git a/tools/profiler/GeckoProfilerImpl.h b/tools/profiler/GeckoProfilerImpl.h index c12b88550a4..16da7dceed3 100644 --- a/tools/profiler/GeckoProfilerImpl.h +++ b/tools/profiler/GeckoProfilerImpl.h @@ -12,6 +12,8 @@ #include #include "mozilla/ThreadLocal.h" #include "mozilla/Assertions.h" +#include "mozilla/GuardObjects.h" +#include "mozilla/UniquePtr.h" #include "nscore.h" #include "GeckoProfilerFunc.h" #include "PseudoStack.h" @@ -356,6 +358,28 @@ static inline void profiler_tracing(const char* aCategory, const char* aInfo, namespace mozilla { +class MOZ_STACK_CLASS GeckoProfilerTracingRAII { +public: + GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo, + mozilla::UniquePtr aBacktrace + MOZ_GUARD_OBJECT_NOTIFIER_PARAM) + : mCategory(aCategory) + , mInfo(aInfo) + { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + profiler_tracing(mCategory, mInfo, aBacktrace.release(), TRACING_INTERVAL_START); + } + + ~GeckoProfilerTracingRAII() { + profiler_tracing(mCategory, mInfo, TRACING_INTERVAL_END); + } + +protected: + MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER + const char* mCategory; + const char* mInfo; +}; + class MOZ_STACK_CLASS SamplerStackFrameRAII { public: // we only copy the strings at save time, so to take multiple parameters we'd need to copy them then.