diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-05-24 14:06:04 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-05-24 14:06:04 +0200 |
commit | ac25827a87d86f1cf9e48aab6605f77a2c89041a (patch) | |
tree | c3533a008e606f4f6393e838b4305cf6d07f47d2 /dom/plugins | |
parent | c8b38a18031f6ae0fca8b2bef73daa86f6f96ae8 (diff) | |
download | UXP-ac25827a87d86f1cf9e48aab6605f77a2c89041a.tar UXP-ac25827a87d86f1cf9e48aab6605f77a2c89041a.tar.gz UXP-ac25827a87d86f1cf9e48aab6605f77a2c89041a.tar.lz UXP-ac25827a87d86f1cf9e48aab6605f77a2c89041a.tar.xz UXP-ac25827a87d86f1cf9e48aab6605f77a2c89041a.zip |
Remove SPS profiler.
- Conditionals and code blocks. (MOZ_ENABLE_PROFILER_SPS)
- Stub out several profiler-only functions.
Diffstat (limited to 'dom/plugins')
-rwxr-xr-x | dom/plugins/ipc/PluginModuleParent.cpp | 163 | ||||
-rw-r--r-- | dom/plugins/ipc/PluginModuleParent.h | 19 |
2 files changed, 1 insertions, 181 deletions
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 <glib.h> #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<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1")); - bool profilerActive = false; - DebugOnly<nsresult> rv = profiler->IsActive(&profilerActive); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - if (profilerActive) { - nsCOMPtr<nsIProfilerStartParams> currentProfilerParams; - rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - nsCOMPtr<nsISupports> gatherer; - rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - mGatherer = static_cast<ProfileGatherer*>(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<nsIProfilerStartParams> 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<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject); - mPmp->GatheredAsyncProfile(pse); - } - return NS_OK; -} - -void -PluginModuleChromeParent::InitPluginProfiling() -{ - nsCOMPtr<nsIObserverService> 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<nsIObserverService> 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<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1")); - if (NS_WARN_IF(!profiler)) { - return; - } - nsCOMPtr<nsISupports> gatherer; - profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - mGatherer = static_cast<ProfileGatherer*>(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<nsIObserver> mPluginOfflineObserver; -#ifdef MOZ_ENABLE_PROFILER_SPS - RefPtr<mozilla::ProfileGatherer> mGatherer; -#endif nsCString mProfile; bool mIsBlocklisted; static bool sInstantiated; |