From ac25827a87d86f1cf9e48aab6605f77a2c89041a Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 24 May 2018 14:06:04 +0200 Subject: Remove SPS profiler. - Conditionals and code blocks. (MOZ_ENABLE_PROFILER_SPS) - Stub out several profiler-only functions. --- dom/indexedDB/ActorsParent.cpp | 12 --- dom/indexedDB/IndexedDatabaseManager.cpp | 15 +-- dom/ipc/ContentChild.cpp | 9 -- dom/ipc/ContentParent.cpp | 114 +-------------------- dom/ipc/ContentParent.h | 6 -- dom/plugins/ipc/PluginModuleParent.cpp | 163 +------------------------------ dom/plugins/ipc/PluginModuleParent.h | 19 ---- dom/workers/RuntimeService.cpp | 13 --- 8 files changed, 6 insertions(+), 345 deletions(-) (limited to 'dom') diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 9678fb49f..4e1b9f7af 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -13470,10 +13470,6 @@ nsresult ConnectionPool:: ThreadRunnable::Run() { -#ifdef MOZ_ENABLE_PROFILER_SPS - char stackTopGuess; -#endif // MOZ_ENABLE_PROFILER_SPS - MOZ_ASSERT(!IsOnBackgroundThread()); MOZ_ASSERT(mContinueRunning); @@ -13490,10 +13486,6 @@ ThreadRunnable::Run() const nsPrintfCString threadName("IndexedDB #%lu", mSerialNumber); PR_SetCurrentThreadName(threadName.get()); - -#ifdef MOZ_ENABLE_PROFILER_SPS - profiler_register_thread(threadName.get(), &stackTopGuess); -#endif // MOZ_ENABLE_PROFILER_SPS } { @@ -13537,10 +13529,6 @@ ThreadRunnable::Run() } } -#ifdef MOZ_ENABLE_PROFILER_SPS - profiler_unregister_thread(); -#endif // MOZ_ENABLE_PROFILER_SPS - return NS_OK; } diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index f65381fe8..62ba51c08 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -153,7 +153,7 @@ const char kPrefMaxSerilizedMsgSize[] = IDB_PREF_BRANCH_ROOT "maxSerializedMsgSi const char kPrefLoggingEnabled[] = IDB_PREF_LOGGING_BRANCH_ROOT "enabled"; const char kPrefLoggingDetails[] = IDB_PREF_LOGGING_BRANCH_ROOT "details"; -#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS) +#if defined(DEBUG) const char kPrefLoggingProfiler[] = IDB_PREF_LOGGING_BRANCH_ROOT "profiler-marks"; #endif @@ -415,10 +415,7 @@ IndexedDatabaseManager::Init() Preferences::RegisterCallback(LoggingModePrefChangedCallback, kPrefLoggingDetails); -#ifdef MOZ_ENABLE_PROFILER_SPS - Preferences::RegisterCallback(LoggingModePrefChangedCallback, - kPrefLoggingProfiler); -#endif + Preferences::RegisterCallbackAndCall(LoggingModePrefChangedCallback, kPrefLoggingEnabled); @@ -479,10 +476,6 @@ IndexedDatabaseManager::Destroy() Preferences::UnregisterCallback(LoggingModePrefChangedCallback, kPrefLoggingDetails); -#ifdef MOZ_ENABLE_PROFILER_SPS - Preferences::UnregisterCallback(LoggingModePrefChangedCallback, - kPrefLoggingProfiler); -#endif Preferences::UnregisterCallback(LoggingModePrefChangedCallback, kPrefLoggingEnabled); @@ -1060,15 +1053,13 @@ IndexedDatabaseManager::LoggingModePrefChangedCallback( } bool useProfiler = -#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS) +#if defined(DEBUG) Preferences::GetBool(kPrefLoggingProfiler); -#if !defined(MOZ_ENABLE_PROFILER_SPS) if (useProfiler) { NS_WARNING("IndexedDB cannot create profiler marks because this build does " "not have profiler extensions enabled!"); useProfiler = false; } -#endif #else false; #endif diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index bf8aca1e6..d5da9b53b 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2612,15 +2612,6 @@ ContentChild::RecvShutdown() GetIPCChannel()->SetAbortOnError(false); -#ifdef MOZ_ENABLE_PROFILER_SPS - if (profiler_is_active()) { - // We're shutting down while we were profiling. Send the - // profile up to the parent so that we don't lose this - // information. - Unused << RecvGatherProfile(); - } -#endif - // Start a timer that will insure we quickly exit after a reasonable // period of time. Prevents shutdown hangs after our connection to the // parent closes. diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index bb5e13e2b..593c2db27 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -81,9 +81,6 @@ #include "mozilla/Preferences.h" #include "mozilla/ProcessHangMonitor.h" #include "mozilla/ProcessHangMonitorIPC.h" -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "mozilla/ProfileGatherer.h" -#endif #include "mozilla/ScopeExit.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" @@ -220,11 +217,6 @@ #include "nsIBrowserSearchService.h" #endif -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "nsIProfiler.h" -#include "nsIProfileSaveEvent.h" -#endif - #ifdef XP_WIN #include "mozilla/widget/AudioSession.h" #endif @@ -245,9 +237,6 @@ extern const char* kForceEnableE10sPref; using base::ChildPrivileges; using base::KillProcess; -#ifdef MOZ_ENABLE_PROFILER_SPS -using mozilla::ProfileGatherer; -#endif using namespace mozilla::dom::power; using namespace mozilla::media; @@ -514,14 +503,6 @@ static const char* sObserverTopics[] = { "file-watcher-update", #ifdef ACCESSIBILITY "a11y-init-or-shutdown", -#endif -#ifdef MOZ_ENABLE_PROFILER_SPS - "profiler-started", - "profiler-stopped", - "profiler-paused", - "profiler-resumed", - "profiler-subprocess-gather", - "profiler-subprocess", #endif "cacheservice:empty-cache", }; @@ -1305,26 +1286,6 @@ ContentParent::Init() } #endif -#ifdef MOZ_ENABLE_PROFILER_SPS - nsCOMPtr profiler(do_GetService("@mozilla.org/tools/profiler;1")); - bool profilerActive = false; - DebugOnly rv = profiler->IsActive(&profilerActive); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - if (profilerActive) { - nsCOMPtr currentProfilerParams; - rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - nsCOMPtr gatherer; - rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - mGatherer = static_cast(gatherer.get()); - - StartProfiler(currentProfilerParams); - } -#endif - RefPtr gmps(GeckoMediaPluginServiceParent::GetSingleton()); gmps->UpdateContentProcessGMPCapabilities(); } @@ -1751,12 +1712,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why) mConsoleService = nullptr; -#ifdef MOZ_ENABLE_PROFILER_SPS - if (mGatherer && !mProfile.IsEmpty()) { - mGatherer->OOPExitProfile(mProfile); - } -#endif - if (obs) { RefPtr props = new nsHashPropertyBag(); @@ -2556,27 +2511,6 @@ ContentParent::Observe(nsISupports* aSubject, NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess"); } -#ifdef MOZ_ENABLE_PROFILER_SPS - // Need to do this before the mIsAlive check to avoid missing profiles. - if (!strcmp(aTopic, "profiler-subprocess-gather")) { - if (mGatherer) { - mGatherer->WillGatherOOPProfile(); - if (mIsAlive && mSubprocess) { - Unused << SendGatherProfile(); - } - } - } - else if (!strcmp(aTopic, "profiler-subprocess")) { - nsCOMPtr pse = do_QueryInterface(aSubject); - if (pse) { - if (!mProfile.IsEmpty()) { - pse->AddSubProfile(mProfile.get()); - mProfile.Truncate(); - } - } - } -#endif - if (!mIsAlive || !mSubprocess) return NS_OK; @@ -2662,22 +2596,6 @@ ContentParent::Observe(nsISupports* aSubject, Unused << SendShutdownA11y(); } } -#endif -#ifdef MOZ_ENABLE_PROFILER_SPS - else if (!strcmp(aTopic, "profiler-started")) { - nsCOMPtr params(do_QueryInterface(aSubject)); - StartProfiler(params); - } - else if (!strcmp(aTopic, "profiler-stopped")) { - mGatherer = nullptr; - Unused << SendStopProfiler(); - } - else if (!strcmp(aTopic, "profiler-paused")) { - Unused << SendPauseProfiler(true); - } - else if (!strcmp(aTopic, "profiler-resumed")) { - Unused << SendPauseProfiler(false); - } #endif else if (!strcmp(aTopic, "cacheservice:empty-cache")) { Unused << SendNotifyEmptyHTTPCache(); @@ -4559,13 +4477,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab, bool ContentParent::RecvProfile(const nsCString& aProfile) { -#ifdef MOZ_ENABLE_PROFILER_SPS - if (NS_WARN_IF(!mGatherer)) { - return true; - } - mProfile = aProfile; - mGatherer->GatheredOOPProfile(); -#endif + /*** STUB ***/ return true; } @@ -4658,29 +4570,7 @@ ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName, void ContentParent::StartProfiler(nsIProfilerStartParams* aParams) { -#ifdef MOZ_ENABLE_PROFILER_SPS - if (NS_WARN_IF(!aParams)) { - return; - } - - ProfilerInitParams ipcParams; - - ipcParams.enabled() = true; - aParams->GetEntries(&ipcParams.entries()); - aParams->GetInterval(&ipcParams.interval()); - ipcParams.features() = aParams->GetFeatures(); - ipcParams.threadFilters() = aParams->GetThreadFilterNames(); - - Unused << SendStartProfiler(ipcParams); - - nsCOMPtr profiler(do_GetService("@mozilla.org/tools/profiler;1")); - if (NS_WARN_IF(!profiler)) { - return; - } - nsCOMPtr gatherer; - profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - mGatherer = static_cast(gatherer.get()); -#endif + /*** STUB ***/ } bool diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 87384e030..c5d23e888 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -42,9 +42,6 @@ class nsIWidget; namespace mozilla { class PRemoteSpellcheckEngineParent; -#ifdef MOZ_ENABLE_PROFILER_SPS -class ProfileGatherer; -#endif namespace embedding { class PrintingParent; @@ -1128,9 +1125,6 @@ private: PProcessHangMonitorParent* mHangMonitorActor; -#ifdef MOZ_ENABLE_PROFILER_SPS - RefPtr mGatherer; -#endif nsCString mProfile; UniquePtr mDriverCrashGuard; diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index ee005b14a..2772691eb 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -18,9 +18,6 @@ #include "mozilla/plugins/PluginBridge.h" #include "mozilla/plugins/PluginInstanceParent.h" #include "mozilla/Preferences.h" -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "mozilla/ProfileGatherer.h" -#endif #include "mozilla/ProcessHangMonitor.h" #include "mozilla/Services.h" #include "mozilla/Telemetry.h" @@ -46,11 +43,6 @@ #include "PluginUtilsWin.h" #endif -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "nsIProfiler.h" -#include "nsIProfileSaveEvent.h" -#endif - #ifdef MOZ_WIDGET_GTK #include #elif XP_MACOSX @@ -61,9 +53,6 @@ using base::KillProcess; using mozilla::PluginLibrary; -#ifdef MOZ_ENABLE_PROFILER_SPS -using mozilla::ProfileGatherer; -#endif using mozilla::ipc::MessageChannel; using mozilla::ipc::GeckoChildProcessHost; using mozilla::dom::CrashReporterParent; @@ -544,25 +533,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded) } #endif } - -#ifdef MOZ_ENABLE_PROFILER_SPS - nsCOMPtr profiler(do_GetService("@mozilla.org/tools/profiler;1")); - bool profilerActive = false; - DebugOnly rv = profiler->IsActive(&profilerActive); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - if (profilerActive) { - nsCOMPtr currentProfilerParams; - rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - nsCOMPtr gatherer; - rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - mGatherer = static_cast(gatherer.get()); - - StartProfiler(currentProfilerParams); - } -#endif } bool @@ -648,10 +618,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath, mSandboxLevel = aSandboxLevel; mRunID = GeckoChildProcessHost::GetUniqueID(); -#ifdef MOZ_ENABLE_PROFILER_SPS - InitPluginProfiling(); -#endif - mozilla::HangMonitor::RegisterAnnotator(*this); } @@ -661,10 +627,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent() NS_RUNTIMEABORT("unsafe destruction"); } -#ifdef MOZ_ENABLE_PROFILER_SPS - ShutdownPluginProfiling(); -#endif - #ifdef XP_WIN // If we registered for audio notifications, stop. mozilla::plugins::PluginUtilsWin::RegisterForAudioDeviceChanges(this, @@ -2680,133 +2642,10 @@ PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( return true; } -#ifdef MOZ_ENABLE_PROFILER_SPS -class PluginProfilerObserver final : public nsIObserver, - public nsSupportsWeakReference -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIOBSERVER - - explicit PluginProfilerObserver(PluginModuleChromeParent* pmp) - : mPmp(pmp) - {} - -private: - ~PluginProfilerObserver() {} - PluginModuleChromeParent* mPmp; -}; - -NS_IMPL_ISUPPORTS(PluginProfilerObserver, nsIObserver, nsISupportsWeakReference) - -NS_IMETHODIMP -PluginProfilerObserver::Observe(nsISupports *aSubject, - const char *aTopic, - const char16_t *aData) -{ - if (!strcmp(aTopic, "profiler-started")) { - nsCOMPtr params(do_QueryInterface(aSubject)); - mPmp->StartProfiler(params); - } else if (!strcmp(aTopic, "profiler-stopped")) { - mPmp->StopProfiler(); - } else if (!strcmp(aTopic, "profiler-subprocess-gather")) { - mPmp->GatherAsyncProfile(); - } else if (!strcmp(aTopic, "profiler-subprocess")) { - nsCOMPtr pse = do_QueryInterface(aSubject); - mPmp->GatheredAsyncProfile(pse); - } - return NS_OK; -} - -void -PluginModuleChromeParent::InitPluginProfiling() -{ - nsCOMPtr observerService = mozilla::services::GetObserverService(); - if (observerService) { - mProfilerObserver = new PluginProfilerObserver(this); - observerService->AddObserver(mProfilerObserver, "profiler-started", false); - observerService->AddObserver(mProfilerObserver, "profiler-stopped", false); - observerService->AddObserver(mProfilerObserver, "profiler-subprocess-gather", false); - observerService->AddObserver(mProfilerObserver, "profiler-subprocess", false); - } -} - -void -PluginModuleChromeParent::ShutdownPluginProfiling() -{ - nsCOMPtr observerService = mozilla::services::GetObserverService(); - if (observerService) { - observerService->RemoveObserver(mProfilerObserver, "profiler-started"); - observerService->RemoveObserver(mProfilerObserver, "profiler-stopped"); - observerService->RemoveObserver(mProfilerObserver, "profiler-subprocess-gather"); - observerService->RemoveObserver(mProfilerObserver, "profiler-subprocess"); - } -} - -void -PluginModuleChromeParent::StartProfiler(nsIProfilerStartParams* aParams) -{ - if (NS_WARN_IF(!aParams)) { - return; - } - - ProfilerInitParams ipcParams; - - ipcParams.enabled() = true; - aParams->GetEntries(&ipcParams.entries()); - aParams->GetInterval(&ipcParams.interval()); - ipcParams.features() = aParams->GetFeatures(); - ipcParams.threadFilters() = aParams->GetThreadFilterNames(); - - Unused << SendStartProfiler(ipcParams); - - nsCOMPtr profiler(do_GetService("@mozilla.org/tools/profiler;1")); - if (NS_WARN_IF(!profiler)) { - return; - } - nsCOMPtr gatherer; - profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - mGatherer = static_cast(gatherer.get()); -} - -void -PluginModuleChromeParent::StopProfiler() -{ - mGatherer = nullptr; - Unused << SendStopProfiler(); -} - -void -PluginModuleChromeParent::GatherAsyncProfile() -{ - if (NS_WARN_IF(!mGatherer)) { - return; - } - mGatherer->WillGatherOOPProfile(); - Unused << SendGatherProfile(); -} - -void -PluginModuleChromeParent::GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent) -{ - if (aSaveEvent && !mProfile.IsEmpty()) { - aSaveEvent->AddSubProfile(mProfile.get()); - mProfile.Truncate(); - } -} -#endif // MOZ_ENABLE_PROFILER_SPS - bool PluginModuleChromeParent::RecvProfile(const nsCString& aProfile) { -#ifdef MOZ_ENABLE_PROFILER_SPS - if (NS_WARN_IF(!mGatherer)) { - return true; - } - - mProfile = aProfile; - mGatherer->GatheredOOPProfile(); -#endif + /*** STUB ***/ return true; } diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index 040cd9168..3f4ed8ce1 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -30,10 +30,6 @@ class nsIProfileSaveEvent; class nsPluginTag; namespace mozilla { -#ifdef MOZ_ENABLE_PROFILER_SPS -class ProfileGatherer; -#endif - namespace layers { class TextureClientRecycleAllocator; } // namespace layers @@ -467,13 +463,6 @@ class PluginModuleChromeParent void CachedSettingChanged(); -#ifdef MOZ_ENABLE_PROFILER_SPS - void GatherAsyncProfile(); - void GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent); - void StartProfiler(nsIProfilerStartParams* aParams); - void StopProfiler(); -#endif - virtual bool RecvProfile(const nsCString& aProfile) override; @@ -519,11 +508,6 @@ private: virtual void UpdatePluginTimeout() override; -#ifdef MOZ_ENABLE_PROFILER_SPS - void InitPluginProfiling(); - void ShutdownPluginProfiling(); -#endif - void RegisterSettingsCallbacks(); void UnregisterSettingsCallbacks(); @@ -606,9 +590,6 @@ private: // processes in existence! dom::ContentParent* mContentParent; nsCOMPtr mPluginOfflineObserver; -#ifdef MOZ_ENABLE_PROFILER_SPS - RefPtr mGatherer; -#endif nsCString mProfile; bool mIsBlocklisted; static bool sInstantiated; diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 1739f3d31..ad95d4896 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -2811,13 +2811,6 @@ WorkerThreadPrimaryRunnable::Run() } { -#ifdef MOZ_ENABLE_PROFILER_SPS - PseudoStack* stack = mozilla_get_pseudo_stack(); - if (stack) { - stack->sampleContext(cx); - } -#endif - { JSAutoRequest ar(cx); @@ -2829,12 +2822,6 @@ WorkerThreadPrimaryRunnable::Run() } BackgroundChild::CloseForCurrentThread(); - -#ifdef MOZ_ENABLE_PROFILER_SPS - if (stack) { - stack->sampleContext(nullptr); - } -#endif } // There may still be runnables on the debugger event queue that hold a -- cgit v1.2.3