diff --git a/tools/profiler/core/Sampler.cpp b/tools/profiler/core/Sampler.cpp index 1f2adeb20bfb..d0f0ac8a8504 100644 --- a/tools/profiler/core/Sampler.cpp +++ b/tools/profiler/core/Sampler.cpp @@ -186,7 +186,7 @@ Sampler::~Sampler() MOZ_COUNT_DTOR(Sampler); if (gIsActive) - Stop(); + PlatformStop(); // Destroy ThreadInfo for all threads { diff --git a/tools/profiler/core/platform-linux.cc b/tools/profiler/core/platform-linux.cc index 34d8d35ec3b0..ca1a621a3458 100644 --- a/tools/profiler/core/platform-linux.cc +++ b/tools/profiler/core/platform-linux.cc @@ -90,7 +90,7 @@ static pthread_t gSignalSenderThread; #if defined(USE_LUL_STACKWALK) // A singleton instance of the library. It is initialised at first -// use. Currently only the main thread can call Sampler::Start, so +// use. Currently only the main thread can call PlatformStart(), so // there is no need for a mechanism to ensure that it is only // created once in a multi-thread-use situation. lul::LUL* sLUL = nullptr; @@ -358,7 +358,9 @@ static void* SignalSender(void* arg) { return 0; } -void Sampler::Start() { +static void +PlatformStart() +{ MOZ_RELEASE_ASSERT(NS_IsMainThread()); LOG("Sampler started"); @@ -366,7 +368,7 @@ void Sampler::Start() { #if defined(USE_EHABI_STACKWALK) mozilla::EHABIStackWalkInit(); #elif defined(USE_LUL_STACKWALK) - // NOTE: this isn't thread-safe. But we expect Sampler::Start to be + // NOTE: this isn't thread-safe. But we expect PlatformStart() to be // called only from the main thread, so this is OK in general. if (!sLUL) { sLUL_initialization_routine(); @@ -417,8 +419,9 @@ void Sampler::Start() { LOG("Profiler thread started"); } - -void Sampler::Stop() { +static void +PlatformStop() +{ MOZ_RELEASE_ASSERT(NS_IsMainThread()); MOZ_ASSERT(gIsActive); diff --git a/tools/profiler/core/platform-macos.cc b/tools/profiler/core/platform-macos.cc index 2e33a7272696..71adf9c5092b 100644 --- a/tools/profiler/core/platform-macos.cc +++ b/tools/profiler/core/platform-macos.cc @@ -266,13 +266,17 @@ private: SamplerThread* SamplerThread::mInstance = NULL; -void Sampler::Start() { +static void +PlatformStart() +{ MOZ_ASSERT(!gIsActive); gIsActive = true; SamplerThread::AddActiveSampler(); } -void Sampler::Stop() { +static void +PlatformStop() +{ MOZ_ASSERT(gIsActive); gIsActive = false; SamplerThread::RemoveActiveSampler(); diff --git a/tools/profiler/core/platform-win32.cc b/tools/profiler/core/platform-win32.cc index 14ecd0e1360d..431ff7f79c70 100644 --- a/tools/profiler/core/platform-win32.cc +++ b/tools/profiler/core/platform-win32.cc @@ -301,13 +301,17 @@ private: SamplerThread* SamplerThread::mInstance = NULL; -void Sampler::Start() { +static void +PlatformStart() +{ MOZ_ASSERT(!gIsActive); gIsActive = true; SamplerThread::StartSampler(); } -void Sampler::Stop() { +static void +PlatformStop() +{ MOZ_ASSERT(gIsActive); gIsActive = false; SamplerThread::StopSampler(); diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 191ff7538dad..eab6eb25242e 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -1211,7 +1211,7 @@ profiler_init(void* stackTop) // at this point. That would match the lifetime implied by destruction of it // in profiler_shutdown() just below. However, that gives a big delay on // startup, even if no profiling is actually to be done. So, instead, sLUL is - // created on demand at the first call to Sampler::Start. + // created on demand at the first call to PlatformStart(). PseudoStack* stack = new PseudoStack(); tlsPseudoStack.set(stack); @@ -1532,6 +1532,10 @@ hasFeature(const char** aFeatures, uint32_t aFeatureCount, const char* aFeature) return false; } +// Platform-specific start/stop actions. +static void PlatformStart(); +static void PlatformStop(); + // Values are only honored on the first start void profiler_start(int aProfileEntries, double aInterval, @@ -1606,8 +1610,8 @@ profiler_start(int aProfileEntries, double aInterval, gUseStackWalk = hasFeature(aFeatures, aFeatureCount, "stackwalk"); MOZ_ASSERT(!gIsActive && !gIsPaused); - gSampler->Start(); - MOZ_ASSERT(gIsActive && !gIsPaused); // Start() sets gIsActive. + PlatformStart(); + MOZ_ASSERT(gIsActive && !gIsPaused); // PlatformStart() sets gIsActive. if (gProfileJS || privacyMode) { mozilla::StaticMutexAutoLock lock(sRegisteredThreadsMutex); @@ -1697,8 +1701,8 @@ profiler_stop() } gFeatures.clear(); - gSampler->Stop(); - MOZ_ASSERT(!gIsActive && !gIsPaused); // Stop() clears these. + PlatformStop(); + MOZ_ASSERT(!gIsActive && !gIsPaused); // PlatformStop() clears these. gProfileJava = false; gProfileJS = false; diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index ebfbc68a66c0..40bd281e3a18 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -211,10 +211,6 @@ public: Sampler(); ~Sampler(); - // Start and stop sampler. - void Start(); - void Stop(); - // We can't new/delete the type safely without defining it // (-Wdelete-incomplete). Use these to hide the details from // clients.